Skip to content

Added support for discord-botlist.eu #318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Interface/ListIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Carbon from './Lists/Carbon'
import DBots from './Lists/DBots'
import DiscordBoats from './Lists/DiscordBoats'
import DiscordBotList from './Lists/DiscordBotList'
import DiscordBotlistEU from './Lists/DiscordBotlistEU'
import DiscordBotsCo from './Lists/DiscordBotsCo'
import DiscordBotsGG from './Lists/DiscordBotsGG'
import DiscordExtremeList from './Lists/DiscordExtremeList'
Expand Down Expand Up @@ -51,6 +52,8 @@ export const serviceList = {
'discord.boats': DiscordBoats,
'discordbotlist': DiscordBotList,
'discordbotlist.com': DiscordBotList,
'dbleu': DiscordBotlistEU,
'discordbotlisteu': DiscordBotlistEU,
'discordbotsco': DiscordBotsCo,
'discordbots.co': DiscordBotsCo,
'discordbotsgg': DiscordBotsGG,
Expand Down
61 changes: 61 additions & 0 deletions src/Interface/Lists/DiscordBotlistEU.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { Service, ServicePostOptions } from '../Service'
import { Util } from '../../Utils/Util'

/**
* Represents the DiscordBotlistEU service.
* @see https://docs.discord-botlist.eu/
*/
export default class DiscordBotlistEU extends Service {
/** The values that can be used to select the service. */
static get aliases() {
return ['dbleu', 'discordbotlisteu']
}

/** The logo URL. */
static get logoURL() {
return 'https://cdn.discord-botlist.eu/pictures/logo.png'
}

/** Service's name. */
static get serviceName() {
return 'DiscordBotlist.EU'
}

/** The website URL. */
static get websiteURL() {
return 'https://discord-botlist.eu/'
}

/** The base URL of the service's API. */
static get baseURL() {
return 'https://api.discord-botlist.eu/v1'
}

/**
* Posts statistics to this service.
* <warn>Shard data posting is not supported for this service.</warn>
* @param options The options of the request
*/
static post(options: ServicePostOptions) {
const { token, serverCount } = options
return super._post({
method: 'post',
url: `/update`,
headers: { Authorization: token },
data: { serverCount: Util.resolveCount(serverCount) }
})
}

/**
* Get's the bots votes
*/
getVotes() {
return this._request(
{
url: `/votes`,
headers: { Authorization: this.token }
},
{ requiresToken: true }
)
}
}