From cc99d4fd83f9990c174705d9cb6084b4a8de53c3 Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Tue, 5 Oct 2021 19:49:46 +0200 Subject: [PATCH 01/15] feat(DiscordLabs): support votes endpoint --- src/Interface/Lists/DiscordLabs.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Interface/Lists/DiscordLabs.ts b/src/Interface/Lists/DiscordLabs.ts index 89d8c3e8..179d2228 100644 --- a/src/Interface/Lists/DiscordLabs.ts +++ b/src/Interface/Lists/DiscordLabs.ts @@ -60,4 +60,12 @@ export default class DiscordLabs extends Service { getBot(id: IDResolvable) { return this._request({ url: `/bot/${Util.resolveID(id)}` }) } + + /** + * Gets the votes for this bot. + * @param id The bot's id. + */ + getVotes(id: IDResolvable) { + return this._request({ url: `/bot/${Util.resolveID(id)}/votes` }) + } } From 3165a6e46290db393f50db563fab48f4c4906d1c Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Tue, 5 Oct 2021 22:46:07 +0200 Subject: [PATCH 02/15] fix!: remove AstroBotList Bot list has been discontinued. --- src/Interface/ListIndex.ts | 3 -- src/Interface/Lists/AstroBotList.ts | 62 ----------------------------- 2 files changed, 65 deletions(-) delete mode 100644 src/Interface/Lists/AstroBotList.ts diff --git a/src/Interface/ListIndex.ts b/src/Interface/ListIndex.ts index ca83f52f..353d7a98 100644 --- a/src/Interface/ListIndex.ts +++ b/src/Interface/ListIndex.ts @@ -2,7 +2,6 @@ // // This section is automatically generated by the 'build:source' script, any change will be overwritten -import AstroBotList from './Lists/AstroBotList' import BladeBotList from './Lists/BladeBotList' import Blist from './Lists/Blist' import BotsForDiscord from './Lists/BotsForDiscord' @@ -32,8 +31,6 @@ import YABL from './Lists/YABL' // prettier-ignore export const serviceList = { - 'astrobotlist': AstroBotList, - 'botlists.com': AstroBotList, 'bladebotlist': BladeBotList, 'bladebotlist.xyz': BladeBotList, 'blist': Blist, diff --git a/src/Interface/Lists/AstroBotList.ts b/src/Interface/Lists/AstroBotList.ts deleted file mode 100644 index 5fbeddd5..00000000 --- a/src/Interface/Lists/AstroBotList.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { Service, ServicePostOptions } from '../Service' -import { Util } from '../../Utils/Util' - -/** - * Represents the Astro Bot List service. - * @see https://botlists.com/api/docs - */ -export default class AstroBotList extends Service { - /** The values that can be used to select the service. */ - static get aliases() { - return ['astrobotlist', 'botlists.com'] - } - - /** The logo URL. */ - static get logoURL() { - return 'https://cdn.bot-list.xyz/7364djcas.png' - } - - /** Service's name. */ - static get serviceName() { - return 'Astro Bot List' - } - - /** The website URL. */ - static get websiteURL() { - return 'https://botlists.com' - } - - /** The base URL of the service's API. */ - static get baseURL() { - return 'https://botlists.com/api' - } - - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions) { - const { token, serverCount } = options - return super._post({ - method: 'post', - url: '/bot', - headers: { token }, - data: { - guild_count: Util.resolveCount(serverCount) - } - }) - } - - /** Gets the stats of this bot. */ - getOwnStats() { - return this._request( - { - url: '/bot', - headers: { token: this.token } - }, - { - requiresToken: true - } - ) - } -} From fe76f90944a8661aebafc6a8c9f1341724ac9032 Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Tue, 5 Oct 2021 23:17:03 +0200 Subject: [PATCH 03/15] feat(DiscordListSpace)!: use new endpoints, remove old ones --- src/Interface/Lists/DiscordListSpace.ts | 156 +++++++++++++++++++----- 1 file changed, 125 insertions(+), 31 deletions(-) diff --git a/src/Interface/Lists/DiscordListSpace.ts b/src/Interface/Lists/DiscordListSpace.ts index 1bc76520..2a46e9d7 100644 --- a/src/Interface/Lists/DiscordListSpace.ts +++ b/src/Interface/Lists/DiscordListSpace.ts @@ -1,5 +1,5 @@ import { Service, ServicePostOptions } from '../Service' -import { Util, CountResolvable, IDResolvable } from '../../Utils/Util' +import { Util, IDResolvable } from '../../Utils/Util' import { Query } from '../../Utils/Constants' /** @@ -34,7 +34,7 @@ export default class DiscordListSpace extends Service { /** The base URL of the service's API. */ static get baseURL() { - return 'https://api.discordlist.space/v1' + return 'https://api.discordlist.space/v2' } /** @@ -47,7 +47,7 @@ export default class DiscordListSpace extends Service { return super._post({ method: 'post', url: `/bots/${Util.resolveID(clientID)}`, - headers: { Authorization: token }, + headers: { Authorization: token, 'Content-Type': 'application/json' }, data: { server_count: Util.resolveCount(serverCount) } }) } @@ -57,19 +57,69 @@ export default class DiscordListSpace extends Service { return this._request({ url: '/statistics' }) } - /** Gets a list of bots on this service. */ - getBots() { - return this._request({ url: '/bots' }) + /** + * Gets all the available languages that bots or servers can set as their language. + * @param query The query to use in the request. + */ + getLanguages(query?: Query) { + return this._request({ url: '/languages', params: query }) } - /** Gets the bot listed on this service. */ + /** + * Gets all available tags for use on bots or servers. + * @param query The query to use in the request. + */ + getTags(query?: Query) { + return this._request({ url: '/tags', params: query }) + } + + /** + * Gets a list of bots on this service. + * @param query The query to use in the request. + */ + getBots(query?: Query) { + return this._request({ url: '/bots', params: query }) + } + + /** + * Gets the bot listed on this service. + * @param id The bot's ID. + */ getBot(id: IDResolvable) { return this._request({ url: `/bots/${Util.resolveID(id)}` }) } + /** + * Gets the reviews of a bot. + * @param id The bot's ID. + * @param query The query to use in the request. + */ + getBotReviews(id: IDResolvable, query?: Query) { + return this._request({ + url: `/bots/${Util.resolveID(id)}/reviews`, + params: query + }) + } + + /** + * Gets the analytics on a bot. + * @param id The bot's ID. + * @param query The query to use in the request. + */ + getBotAnalytics(id: IDResolvable, query?: Query) { + return this._request( + { + url: `/bots/${Util.resolveID(id)}/analytics`, + headers: { Authorization: this.token }, + params: query + }, + { requiresToken: true } + ) + } + /** * Gets the list of people who voted this bot on this service. - * @param id The bot's ID + * @param id The bot's ID. */ getBotVotes(id: IDResolvable) { return this._request( @@ -84,16 +134,65 @@ export default class DiscordListSpace extends Service { } /** - * Gets the uptime of a bot listed on this service. - * @param id The bot's ID + * Checks if a specific user has upvoted the bot. + * @param botID The bot's ID. + * @param userID The user's ID. */ - getBotUptime(id: IDResolvable) { - return this._request({ url: `/bots/${Util.resolveID(id)}/uptime` }) + getUserUpvote(botID: IDResolvable, userID: IDResolvable) { + return this._request( + { + url: `/bots/${Util.resolveID(botID)}/upvotes/status/${Util.resolveID( + userID + )}`, + headers: { Authorization: this.token } + }, + { requiresToken: true } + ) + } + + /** + * Gets the top upvoters of this month. + * @param id The bot's ID. + * @param query The query to use with the request. + */ + getUpvoteLeaderboard(id: IDResolvable, query?: Query) { + return this._request({ + url: `/bots/${Util.resolveID(id)}/upvotes/leaderboard`, + params: query + }) + } + + /** + * Gets the bot listing audit log. + * @param id The bot's ID. + * @param query The query to use with the request. + */ + getAuditLog(id: IDResolvable, query?: Query) { + return this._request( + { + url: `/bots/${Util.resolveID(id)}/audit`, + headers: { Authorization: this.token }, + params: query + }, + { requiresToken: true } + ) + } + + /** + * Gets the owners of the bot listing. + * @param id The bot's ID. + * @param query The query to use in the request. + */ + getBotOwners(id: IDResolvable, query?: Query) { + return this._request({ + url: `/bots/${Util.resolveID(id)}/owners`, + params: query + }) } /** * Gets the user listed on this service. - * @param id The user's ID + * @param id The user's ID. */ getUser(id: IDResolvable) { return this._request({ url: `/users/${Util.resolveID(id)}` }) @@ -101,29 +200,24 @@ export default class DiscordListSpace extends Service { /** * Gets the user's bots listed for this service. - * @param id The user's ID + * @param id The user's ID. */ getUserBots(id: IDResolvable) { - return this._request({ url: `/users/${Util.resolveID(id)}/bots` }) + return this._request({ + url: `/users/${Util.resolveID(id)}/bots`, + headers: { Authorization: this.token } + }) } /** - * Gets the widget URL for this bot. - * @param id The bot's ID - * @param style The style of the widget, cannot be zero - * @param query The query string that will be used in the request + * Get all the lists that a user owns. + * @param id The user's ID. + * @param query The query to use in the request. */ - getWidgetURL( - id: IDResolvable, - style: CountResolvable = 1, - query: Query = {} - ) { - return this._appendQuery( - `https://api.botlist.space/widget/${Util.resolveID( - id - )}/${Util.resolveCount(style)}`, - query, - false - ) + getUserReviews(id: IDResolvable, query?: Query) { + return this._request({ + url: `/users/${Util.resolveID(id)}/reviews`, + params: query + }) } } From daa1480b9f3d651d98c9168ee90140bb29792b3d Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Tue, 5 Oct 2021 23:20:43 +0200 Subject: [PATCH 04/15] chore: minor formatting changes --- src/Interface/Lists/BladeBotList.ts | 14 +++++++------- src/Interface/Lists/TopGG.ts | 26 +++++++++++++------------- src/Interface/Lists/VoidBots.ts | 16 ++++++++-------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/Interface/Lists/BladeBotList.ts b/src/Interface/Lists/BladeBotList.ts index 57dcdbf4..dade0beb 100644 --- a/src/Interface/Lists/BladeBotList.ts +++ b/src/Interface/Lists/BladeBotList.ts @@ -33,7 +33,7 @@ export default class BladeBotList extends Service { /** * Posts statistics to this service. - * @param options The options of the request + * @param options The options of the request. */ static post(options: ServicePostOptions) { const { token, clientID, serverCount, shard } = options @@ -52,20 +52,20 @@ export default class BladeBotList extends Service { /** * Gets the bot listed on this service. - * @param id The bot's ID + * @param id The bot's ID. */ getBot(id: IDResolvable) { return this._request({ url: `/bots/${Util.resolveID(id)}` }) } /** - * Checks whether a user has given a vote to the bot - * @param botId The bot's ID - * @param userID The user's ID + * Checks whether a user has given a vote to the bot. + * @param botID The bot's ID. + * @param userID The user's ID. */ - userVoted(botId: IDResolvable, userID: IDResolvable) { + userVoted(botID: IDResolvable, userID: IDResolvable) { return this._request({ - url: `/bots/${Util.resolveID(botId)}/votes/${Util.resolveID(userID)}` + url: `/bots/${Util.resolveID(botID)}/votes/${Util.resolveID(userID)}` }) } } diff --git a/src/Interface/Lists/TopGG.ts b/src/Interface/Lists/TopGG.ts index 78948e58..19757f5a 100644 --- a/src/Interface/Lists/TopGG.ts +++ b/src/Interface/Lists/TopGG.ts @@ -34,7 +34,7 @@ export default class TopGG extends Service { /** * Posts statistics to this service. - * @param options The options of the request + * @param options The options of the request. */ static post(options: ServicePostOptions) { const { token, clientID, serverCount, shard } = options @@ -54,7 +54,7 @@ export default class TopGG extends Service { /** * Gets the user listed on this service. - * @param id The user's ID + * @param id The user's ID. */ getUser(id: IDResolvable) { return this._request( @@ -68,7 +68,7 @@ export default class TopGG extends Service { /** * Gets the a of bots on this service that match your query (refer to Top.gg docs for query parameters). - * @param query The query string that will be used in the request + * @param query The query string that will be used in the request. */ getBots(query: Query) { return this._request( @@ -79,7 +79,7 @@ export default class TopGG extends Service { /** * Gets the bot listed on this service. - * @param id The bot's ID + * @param id The bot's ID. */ getBot(id: IDResolvable) { return this._request( @@ -93,7 +93,7 @@ export default class TopGG extends Service { /** * Gets the bot's stats listed on this service. - * @param id The bot's ID + * @param id The bot's ID. */ getBotStats(id: IDResolvable) { return this._request( @@ -107,7 +107,7 @@ export default class TopGG extends Service { /** * Gets the list of people who voted this bot on this service. - * @param id The bot's ID + * @param id The bot's ID. */ getBotVotes(id: IDResolvable) { return this._request( @@ -121,13 +121,13 @@ export default class TopGG extends Service { /** * Checks whether or not a user has voted for a bot on this service. - * @param botId The bot's ID - * @param userID The user's ID + * @param botID The bot's ID. + * @param userID The user's ID. */ - userVoted(botId: IDResolvable, userID: IDResolvable) { + userVoted(botID: IDResolvable, userID: IDResolvable) { return this._request( { - url: `/bots/${Util.resolveID(botId)}/check`, + url: `/bots/${Util.resolveID(botID)}/check`, params: { userId: Util.resolveID(userID) }, headers: { Authorization: this.token } }, @@ -137,9 +137,9 @@ export default class TopGG extends Service { /** * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request - * @param smallWidget The sub-path name to turn the widget into a badge (i.e. owner) + * @param id The bot's ID. + * @param query The query string that will be used in the request. + * @param smallWidget The sub-path name to turn the widget into a badge (i.e. owner). */ getWidgetURL(id: IDResolvable, query?: Query, smallWidget?: string) { const subPath = smallWidget ? `${smallWidget}/` : '' diff --git a/src/Interface/Lists/VoidBots.ts b/src/Interface/Lists/VoidBots.ts index 074cc7e2..9c43ba28 100644 --- a/src/Interface/Lists/VoidBots.ts +++ b/src/Interface/Lists/VoidBots.ts @@ -33,7 +33,7 @@ export default class VoidBots extends Service { /** * Posts statistics to this service. - * @param options The options of the request + * @param options The options of the request. */ static post(options: ServicePostOptions) { const { token, clientID, serverCount, shard } = options @@ -52,7 +52,7 @@ export default class VoidBots extends Service { /** * Gets the bot listed on this service. - * @param id The bot's ID + * @param id The bot's ID. */ getBot(id: IDResolvable) { return this._request( @@ -68,13 +68,13 @@ export default class VoidBots extends Service { /** * Checks whether or not a user has voted for a bot on this service. - * @param botId The bot's ID - * @param userID The user's ID + * @param botID The bot's ID. + * @param userID The user's ID. */ - userVoted(botId: IDResolvable, userID: IDResolvable) { + userVoted(botID: IDResolvable, userID: IDResolvable) { return this._request( { - url: `/bot/voted/${Util.resolveID(botId)}/${Util.resolveID(userID)}`, + url: `/bot/voted/${Util.resolveID(botID)}/${Util.resolveID(userID)}`, headers: { Authorization: this.token } @@ -85,7 +85,7 @@ export default class VoidBots extends Service { /** * Gets the bot's reviews on this service. - * @param id The bot's ID + * @param id The bot's ID. */ getBotReviews(id: IDResolvable) { return this._request( @@ -99,7 +99,7 @@ export default class VoidBots extends Service { /** * Gets the bot's analytics on this service. - * @param id The bot's ID + * @param id The bot's ID. */ getBotAnalytics(id: IDResolvable) { return this._request( From d3be7f6edf811e695f25e53c04c1dd8f4cd05306 Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Tue, 5 Oct 2021 21:22:38 +0000 Subject: [PATCH 05/15] [auto] docs: update docs --- docs/general/services.md | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/docs/general/services.md b/docs/general/services.md index 3821fefb..3e1ad769 100644 --- a/docs/general/services.md +++ b/docs/general/services.md @@ -1,17 +1,4 @@ -# Supported Services (27) - -
-

- astrobotlist logo -

- - -

Astro Bot List

- -Keys: `astrobotlist`, `botlists.com` -Class: [AstroBotList](/#/docs/main/$$$ref/class/AstroBotList) -Website: https://botlists.com -
+# Supported Services (26)

From f68d1428316402f1f9f835a47dcfc6a0fec55c8d Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Wed, 6 Oct 2021 21:53:20 +0200 Subject: [PATCH 06/15] fix(InfinityBotList): update endpoints --- src/Interface/Lists/InfinityBotList.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Interface/Lists/InfinityBotList.ts b/src/Interface/Lists/InfinityBotList.ts index df350967..31a5371c 100644 --- a/src/Interface/Lists/InfinityBotList.ts +++ b/src/Interface/Lists/InfinityBotList.ts @@ -33,17 +33,18 @@ export default class InfinityBotList extends Service { /** * Posts statistics to this service. - * @param options The options of the request + * @param options The options of the request. */ static post(options: ServicePostOptions) { const { clientID, token, serverCount, shard } = options return super._post({ method: 'post', - url: `/bot/${Util.resolveID(clientID)}`, + url: `/bot/${Util.resolveID(clientID)}/stats`, headers: { authorization: token }, data: { + botid: clientID, servers: Util.resolveCount(serverCount), ...(shard?.count ? { @@ -56,17 +57,17 @@ export default class InfinityBotList extends Service { /** * Gets the bot listed on this service. - * @param id The bot's ID + * @param id The bot's ID. */ getBot(id: IDResolvable) { return this._request({ - url: `/bot/${Util.resolveID(id)}/info` + url: `/bot/${Util.resolveID(id)}` }) } /** * Gets the user listed on this service. - * @param id The user's ID + * @param id The user's ID. */ getUser(id: IDResolvable) { return this._request({ From bffc57c720a1fcde9d9c9aecf9f24e5f276ed9a6 Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Wed, 6 Oct 2021 22:06:14 +0200 Subject: [PATCH 07/15] fix(BotsForDiscord): change internal name to DiscordsCom, add endpoint requirements --- src/Interface/ListIndex.ts | 9 ++--- .../{BotsForDiscord.ts => DiscordsCom.ts} | 33 ++++++++++++------- 2 files changed, 26 insertions(+), 16 deletions(-) rename src/Interface/Lists/{BotsForDiscord.ts => DiscordsCom.ts} (72%) diff --git a/src/Interface/ListIndex.ts b/src/Interface/ListIndex.ts index 353d7a98..664ae073 100644 --- a/src/Interface/ListIndex.ts +++ b/src/Interface/ListIndex.ts @@ -4,7 +4,6 @@ import BladeBotList from './Lists/BladeBotList' import Blist from './Lists/Blist' -import BotsForDiscord from './Lists/BotsForDiscord' import BotsOnDiscord from './Lists/BotsOnDiscord' import Carbon from './Lists/Carbon' import DBots from './Lists/DBots' @@ -17,6 +16,7 @@ import DiscordExtremeList from './Lists/DiscordExtremeList' import DiscordLabs from './Lists/DiscordLabs' import DiscordListology from './Lists/DiscordListology' import DiscordListSpace from './Lists/DiscordListSpace' +import DiscordsCom from './Lists/DiscordsCom' import DiscordServices from './Lists/DiscordServices' import Disforge from './Lists/Disforge' import FatesList from './Lists/FatesList' @@ -35,9 +35,6 @@ export const serviceList = { 'bladebotlist.xyz': BladeBotList, 'blist': Blist, 'blist.xyz': Blist, - 'botsfordiscord': BotsForDiscord, - 'botsfordiscord.com': BotsForDiscord, - 'discords': BotsForDiscord, 'botsondiscord': BotsOnDiscord, 'bots.ondiscord.xyz': BotsOnDiscord, 'carbonitex': Carbon, @@ -65,6 +62,10 @@ export const serviceList = { 'discordlist.space': DiscordListSpace, 'botlistspace': DiscordListSpace, 'botlist.space': DiscordListSpace, + 'botsfordiscord': DiscordsCom, + 'botsfordiscord.com': DiscordsCom, + 'discords': DiscordsCom, + 'discords.com': DiscordsCom, 'discordservices': DiscordServices, 'discordservices.net': DiscordServices, 'disforge': Disforge, diff --git a/src/Interface/Lists/BotsForDiscord.ts b/src/Interface/Lists/DiscordsCom.ts similarity index 72% rename from src/Interface/Lists/BotsForDiscord.ts rename to src/Interface/Lists/DiscordsCom.ts index d66baf13..95c5c98e 100644 --- a/src/Interface/Lists/BotsForDiscord.ts +++ b/src/Interface/Lists/DiscordsCom.ts @@ -3,13 +3,13 @@ import { Util, IDResolvable } from '../../Utils/Util' import { Query } from '../../Utils/Constants' /** - * Represents the Bots For Discord service. + * Represents the Discords.com service (formerly Bots For Discord). * @see https://docs.botsfordiscord.com/ */ -export default class BotsForDiscord extends Service { +export default class DiscordsCom extends Service { /** The values that can be used to select the service. */ static get aliases() { - return ['botsfordiscord', 'botsfordiscord.com', 'discords'] + return ['botsfordiscord', 'botsfordiscord.com', 'discords', 'discords.com'] } /** The logo URL. */ @@ -19,7 +19,7 @@ export default class BotsForDiscord extends Service { /** Service's name. */ static get serviceName() { - return 'Bots For Discord' + return 'Discords.com' } /** The website URL. */ @@ -35,7 +35,7 @@ export default class BotsForDiscord extends Service { /** * Posts statistics to this service. * Shard data posting is not supported for this service. - * @param options The options of the request + * @param options The options of the request. */ static post(options: ServicePostOptions) { const { token, clientID, serverCount } = options @@ -49,7 +49,7 @@ export default class BotsForDiscord extends Service { /** * Gets the bot listed on this service. - * @param id The bot's ID + * @param id The bot's ID. */ getBot(id: IDResolvable) { return this._request({ url: `/bot/${Util.resolveID(id)}` }) @@ -57,15 +57,24 @@ export default class BotsForDiscord extends Service { /** * Gets the list of people who voted this bot on this service. - * @param id The bot's ID + * @param id The bot's ID. */ getBotVotes(id: IDResolvable) { - return this._request({ url: `/bot/${Util.resolveID(id)}/votes` }) + return this._request( + { + url: `/bot/${Util.resolveID(id)}/votes`, + headers: { + Authorization: this.token, + 'Content-Type': 'application/json' + } + }, + { requiresToken: true } + ) } /** * Gets the user listed on this service. - * @param id The user's ID + * @param id The user's ID. */ getUser(id: IDResolvable) { return this._request({ url: `/user/${Util.resolveID(id)}` }) @@ -73,7 +82,7 @@ export default class BotsForDiscord extends Service { /** * Gets the user's bots listed for this service. - * @param id The user's ID + * @param id The user's ID. */ getUserBots(id: IDResolvable) { return this._request({ url: `/user/${Util.resolveID(id)}/bots` }) @@ -81,8 +90,8 @@ export default class BotsForDiscord extends Service { /** * Gets the widget URL for this bot. - * @param id The bot's ID - * @param query The query string that will be used in the request + * @param id The bot's ID. + * @param query The query that will be used in the request. */ getWidgetURL(id: IDResolvable, query?: Query) { return this._appendQuery(`/bot/${Util.resolveID(id)}/widget`, query || {}) From ede0dae902a6afc81ddfadfe525b40530a2a6ffe Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Wed, 6 Oct 2021 22:38:26 +0200 Subject: [PATCH 08/15] feat: add Listcord --- src/Interface/ListIndex.ts | 3 + src/Interface/Lists/Listcord.ts | 117 ++++++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 src/Interface/Lists/Listcord.ts diff --git a/src/Interface/ListIndex.ts b/src/Interface/ListIndex.ts index 664ae073..874170d9 100644 --- a/src/Interface/ListIndex.ts +++ b/src/Interface/ListIndex.ts @@ -22,6 +22,7 @@ import Disforge from './Lists/Disforge' import FatesList from './Lists/FatesList' import GlennBotList from './Lists/GlennBotList' import InfinityBotList from './Lists/InfinityBotList' +import Listcord from './Lists/Listcord' import SpaceBotsList from './Lists/SpaceBotsList' import TopCord from './Lists/TopCord' import TopGG from './Lists/TopGG' @@ -76,6 +77,8 @@ export const serviceList = { 'glennbotlist.xyz': GlennBotList, 'infinitybotlist': InfinityBotList, 'infinitybotlist.com': InfinityBotList, + 'listcord': Listcord, + 'listcord.gg': Listcord, 'spacebotslist': SpaceBotsList, 'space-bot-list.xyz': SpaceBotsList, 'topcord': TopCord, diff --git a/src/Interface/Lists/Listcord.ts b/src/Interface/Lists/Listcord.ts new file mode 100644 index 00000000..3bf86358 --- /dev/null +++ b/src/Interface/Lists/Listcord.ts @@ -0,0 +1,117 @@ +import { Service, ServicePostOptions } from '../Service' +import { Util, IDResolvable } from '../../Utils/Util' + +/** + * Represents the Listcord service. + * @see https://listcord.gg/docs + */ +export default class Listcord extends Service { + /** The values that can be used to select the service. */ + static get aliases() { + return ['listcord', 'listcord.gg'] + } + + /** The logo URL. */ + static get logoURL() { + return 'https://cdn.discordapp.com/avatars/803339251940196383/50e92bb535cf88641ec22756937e6950.webp' + } + + /** Service's name. */ + static get serviceName() { + return 'Listcord' + } + + /** The website URL. */ + static get websiteURL() { + return 'https://listcord.gg/' + } + + /** The base URL of the service's API. */ + static get baseURL() { + return 'https://listcord.gg/api/' + } + + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request. + */ + static post(options: ServicePostOptions) { + const { token, clientID, serverCount } = options + return super._post({ + method: 'post', + url: `/bots/${Util.resolveID(clientID)}/stats/`, + headers: { Authorization: token }, + data: { server_count: Util.resolveCount(serverCount) } + }) + } + + /** + * Gets a bot. + * @param id The bot's ID. + */ + getBot(id: IDResolvable) { + return this._request( + { + url: `/bots/${Util.resolveID(id)}`, + headers: { Authorization: this.token } + }, + { requiresToken: true } + ) + } + + /** + * Gets a bot's reviews. + * @param id The bot's ID. + */ + getBotReviews(id: IDResolvable) { + return this._request( + { + url: `/bot/${Util.resolveID(id)}/reviews`, + headers: { Authorization: this.token } + }, + { requiresToken: true } + ) + } + + /** + * Gets whether a user has voted for a bot. + * @param botID The bot's ID. + * @param userID The user's ID. + */ + userVoted(botID: IDResolvable, userID: IDResolvable) { + return this._request( + { + url: `/bot/${Util.resolveID(botID)}/voted`, + headers: { Authorization: this.token }, + params: { user_id: Util.resolveID(userID) } + }, + { requiresToken: true } + ) + } + + /** + * Gets a bot pack. + * @param id The pack's id. + */ + getBotPack(id: string) { + return this._request( + { + url: `/pack/${id}`, + headers: { Authorization: this.token } + }, + { requiresToken: true } + ) + } + + /** Gets all botpacks. */ + getBotPacks() { + return this._request( + { + url: '/packs', + headers: { Authorization: this.token } + }, + { requiresToken: true } + ) + } +} From e3217435148885a0b4278893971f82152ebb0d19 Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Wed, 6 Oct 2021 22:43:43 +0200 Subject: [PATCH 09/15] feat(DiscordsCom): add new endpoint Only documented in Discord message Refs: - https://discord.com/channels/374071874222686211/872248802302640148/873264334095134771 - https://github.com/BotsForDiscord/bfddocs/issues/2 --- src/Interface/Lists/DiscordsCom.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Interface/Lists/DiscordsCom.ts b/src/Interface/Lists/DiscordsCom.ts index 95c5c98e..d5dcef04 100644 --- a/src/Interface/Lists/DiscordsCom.ts +++ b/src/Interface/Lists/DiscordsCom.ts @@ -56,7 +56,7 @@ export default class DiscordsCom extends Service { } /** - * Gets the list of people who voted this bot on this service. + * Gets the list of people who voted a bot. * @param id The bot's ID. */ getBotVotes(id: IDResolvable) { @@ -72,6 +72,22 @@ export default class DiscordsCom extends Service { ) } + /** + * Gets the list of people who voted a bot in the last 12 hours. + * @param id The bot's ID. + */ + getBotVotes12h(id: IDResolvable) { + return this._request( + { + url: `/bot/${Util.resolveID(id)}/votes12h`, + headers: { + Authorization: this.token + } + }, + { requiresToken: true } + ) + } + /** * Gets the user listed on this service. * @param id The user's ID. From efb5215b5315c6d313f1b6a95caf46a732df73d3 Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Wed, 6 Oct 2021 22:58:56 +0200 Subject: [PATCH 10/15] feat(BladeBotList): update name & endpoints --- src/Interface/ListIndex.ts | 8 ++-- src/Interface/Lists/BladeBotList.ts | 71 ----------------------------- src/Interface/Lists/BladeList.ts | 67 +++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 74 deletions(-) delete mode 100644 src/Interface/Lists/BladeBotList.ts create mode 100644 src/Interface/Lists/BladeList.ts diff --git a/src/Interface/ListIndex.ts b/src/Interface/ListIndex.ts index 874170d9..ab84a185 100644 --- a/src/Interface/ListIndex.ts +++ b/src/Interface/ListIndex.ts @@ -2,7 +2,7 @@ // // This section is automatically generated by the 'build:source' script, any change will be overwritten -import BladeBotList from './Lists/BladeBotList' +import BladeList from './Lists/BladeList' import Blist from './Lists/Blist' import BotsOnDiscord from './Lists/BotsOnDiscord' import Carbon from './Lists/Carbon' @@ -32,8 +32,10 @@ import YABL from './Lists/YABL' // prettier-ignore export const serviceList = { - 'bladebotlist': BladeBotList, - 'bladebotlist.xyz': BladeBotList, + 'bladebotlist': BladeList, + 'bladebotlist.xyz': BladeList, + 'bladelist': BladeList, + 'bladelist.gg': BladeList, 'blist': Blist, 'blist.xyz': Blist, 'botsondiscord': BotsOnDiscord, diff --git a/src/Interface/Lists/BladeBotList.ts b/src/Interface/Lists/BladeBotList.ts deleted file mode 100644 index dade0beb..00000000 --- a/src/Interface/Lists/BladeBotList.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { Service, ServicePostOptions } from '../Service' -import { Util, IDResolvable } from '../../Utils/Util' - -/** - * Represents the BladeBotList service. - * @see https://docs.bladebotlist.xyz/api/introduction.html - */ -export default class BladeBotList extends Service { - /** The values that can be used to select the service. */ - static get aliases() { - return ['bladebotlist', 'bladebotlist.xyz'] - } - - /** The logo URL. */ - static get logoURL() { - return 'https://bladebotlist.xyz/img/logo.svg' - } - - /** Service's name. */ - static get serviceName() { - return 'BladeBotList' - } - - /** The website URL. */ - static get websiteURL() { - return 'https://bladebotlist.xyz' - } - - /** The base URL of the service's API. */ - static get baseURL() { - return 'https://bladebotlist.xyz/api/' - } - - /** - * Posts statistics to this service. - * @param options The options of the request. - */ - static post(options: ServicePostOptions) { - const { token, clientID, serverCount, shard } = options - return super._post({ - method: 'post', - url: `/bots/${Util.resolveID(clientID)}/stats/`, - headers: { Authorization: token }, - data: shard - ? { - server_count: Util.resolveCount(serverCount), - shard_count: shard.count - } - : { server_count: Util.resolveCount(serverCount) } - }) - } - - /** - * Gets the bot listed on this service. - * @param id The bot's ID. - */ - getBot(id: IDResolvable) { - return this._request({ url: `/bots/${Util.resolveID(id)}` }) - } - - /** - * Checks whether a user has given a vote to the bot. - * @param botID The bot's ID. - * @param userID The user's ID. - */ - userVoted(botID: IDResolvable, userID: IDResolvable) { - return this._request({ - url: `/bots/${Util.resolveID(botID)}/votes/${Util.resolveID(userID)}` - }) - } -} diff --git a/src/Interface/Lists/BladeList.ts b/src/Interface/Lists/BladeList.ts new file mode 100644 index 00000000..24fe8383 --- /dev/null +++ b/src/Interface/Lists/BladeList.ts @@ -0,0 +1,67 @@ +import { Service, ServicePostOptions } from '../Service' +import { Util, IDResolvable } from '../../Utils/Util' + +/** + * Represents the BladeList service. + * @see https://docs.bladelist.gg/en/latest/api/index.html + */ +export default class BladeList extends Service { + /** The values that can be used to select the service. */ + static get aliases() { + return ['bladebotlist', 'bladebotlist.xyz', 'bladelist', 'bladelist.gg'] + } + + /** The logo URL. */ + static get logoURL() { + return 'https://bladelist.gg/static/img/logo.png' + } + + /** Service's name. */ + static get serviceName() { + return 'BladeList' + } + + /** The website URL. */ + static get websiteURL() { + return 'https://bladelist.gg' + } + + /** The base URL of the service's API. */ + static get baseURL() { + return 'https://api.bladelist.gg' + } + + /** + * Posts statistics to this service. + * @param options The options of the request. + */ + static post(options: ServicePostOptions) { + const { token, clientID, serverCount, shard } = options + return super._post({ + method: 'put', + url: `/bots/${Util.resolveID(clientID)}/`, + headers: { + Authorization: token, + 'Content-Type': 'application/json' + }, + data: { + server_count: Util.resolveCount(serverCount), + ...(shard ? { shard_count: shard.count } : {}) + } + }) + } + + /** + * Gets a bot listed on this service. + * @param id The bot's ID. + */ + getBot(id: IDResolvable) { + return this._request( + { + url: `/bots/${Util.resolveID(id)}`, + headers: { Authorization: this.token } + }, + { requiresToken: true } + ) + } +} From bfdcc1671efb137cf3b1d0747163f79b71d630d0 Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Wed, 6 Oct 2021 23:04:03 +0200 Subject: [PATCH 11/15] fix!: remove DiscordBotsCo (service is dead) --- src/Interface/ListIndex.ts | 3 -- src/Interface/Lists/DiscordBotsCo.ts | 71 ---------------------------- 2 files changed, 74 deletions(-) delete mode 100644 src/Interface/Lists/DiscordBotsCo.ts diff --git a/src/Interface/ListIndex.ts b/src/Interface/ListIndex.ts index ab84a185..6541b411 100644 --- a/src/Interface/ListIndex.ts +++ b/src/Interface/ListIndex.ts @@ -10,7 +10,6 @@ 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' import DiscordLabs from './Lists/DiscordLabs' @@ -51,8 +50,6 @@ export const serviceList = { 'discordbotlist.com': DiscordBotList, 'dbleu': DiscordBotlistEU, 'discordbotlisteu': DiscordBotlistEU, - 'discordbotsco': DiscordBotsCo, - 'discordbots.co': DiscordBotsCo, 'discordbotsgg': DiscordBotsGG, 'discord.bots.gg': DiscordBotsGG, 'discordextremelist': DiscordExtremeList, diff --git a/src/Interface/Lists/DiscordBotsCo.ts b/src/Interface/Lists/DiscordBotsCo.ts deleted file mode 100644 index 52a0cb4d..00000000 --- a/src/Interface/Lists/DiscordBotsCo.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { Service, ServicePostOptions } from '../Service' -import { Util, IDResolvable } from '../../Utils/Util' - -/** - * Represents the DiscordBots.co service. - * @see https://discordbots.co/api-information - */ -export default class DiscordBotsCo extends Service { - /** The values that can be used to select the service. */ - static get aliases() { - return ['discordbotsco', 'discordbots.co'] - } - - /** The logo URL. */ - static get logoURL() { - return 'https://cdn.discordapp.com/avatars/688927563409522694/17cfd572fd3e2d3285534c12e0f58422.png' - } - - /** Service's name. */ - static get serviceName() { - return 'DiscordBots.co' - } - - /** The website URL. */ - static get websiteURL() { - return 'https://discordbots.co' - } - - /** The base URL of the service's API. */ - static get baseURL() { - return 'https://api.discordbots.co/v1/public' - } - - /** - * Posts statistics to this service. - * @param options The options of the request - */ - static post(options: ServicePostOptions) { - const { token, clientID, serverCount, shard } = options - return super._post({ - method: 'post', - url: `/bot/${Util.resolveID(clientID)}/stats`, - headers: { - Authorization: token, - 'Content-Type': 'application/json' - }, - data: shard - ? { - serverCount: Util.resolveCount(serverCount), - shardCount: shard.count - } - : { serverCount: Util.resolveCount(serverCount) } - }) - } - - /** - * Gets the bot listed on this service. - * @param id The bot's ID - */ - getBot(id: IDResolvable) { - return this._request( - { - url: `/bot/${Util.resolveID(id)}`, - headers: { Authorization: this.token } - }, - { - requiresToken: true - } - ) - } -} From dafe4e2f369e38c4ec1378682e3593a53e8a4b94 Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Wed, 6 Oct 2021 23:45:10 +0200 Subject: [PATCH 12/15] feat: add MotionBotList --- src/Interface/ListIndex.ts | 5 ++ src/Interface/Lists/MotionBotList.ts | 90 ++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 src/Interface/Lists/MotionBotList.ts diff --git a/src/Interface/ListIndex.ts b/src/Interface/ListIndex.ts index 6541b411..90091c17 100644 --- a/src/Interface/ListIndex.ts +++ b/src/Interface/ListIndex.ts @@ -22,6 +22,7 @@ import FatesList from './Lists/FatesList' import GlennBotList from './Lists/GlennBotList' import InfinityBotList from './Lists/InfinityBotList' import Listcord from './Lists/Listcord' +import MotionBotList from './Lists/MotionBotList' import SpaceBotsList from './Lists/SpaceBotsList' import TopCord from './Lists/TopCord' import TopGG from './Lists/TopGG' @@ -78,6 +79,10 @@ export const serviceList = { 'infinitybotlist.com': InfinityBotList, 'listcord': Listcord, 'listcord.gg': Listcord, + 'motion': MotionBotList, + 'motiondevelopment': MotionBotList, + 'motionbotlist': MotionBotList, + 'motiondevelopment.top': MotionBotList, 'spacebotslist': SpaceBotsList, 'space-bot-list.xyz': SpaceBotsList, 'topcord': TopCord, diff --git a/src/Interface/Lists/MotionBotList.ts b/src/Interface/Lists/MotionBotList.ts new file mode 100644 index 00000000..5e601158 --- /dev/null +++ b/src/Interface/Lists/MotionBotList.ts @@ -0,0 +1,90 @@ +import { Service, ServicePostOptions } from '../Service' +import { Util, IDResolvable } from '../../Utils/Util' + +/** + * Represents the MotionBotlist service. + * @see https://www.motiondevelopment.top/docs/api/intro + */ +export default class MotionBotlist extends Service { + /** The values that can be used to select the service. */ + static get aliases() { + return [ + 'motion', + 'motiondevelopment', + 'motionbotlist', + 'motiondevelopment.top' + ] + } + + /** The logo URL. */ + static get logoURL() { + return 'https://www.motiondevelopment.top/favicon.ico' + } + + /** Service's name. */ + static get serviceName() { + return 'Motion Botlist' + } + + /** The website URL. */ + static get websiteURL() { + return 'https://www.motiondevelopment.top/bot' + } + + /** The base URL of the service's API. */ + static get baseURL() { + return 'https://www.motiondevelopment.top/api/v1.2' + } + + /** + * Posts statistics to this service. + * Shard data posting is not supported for this service. + * @param options The options of the request. + */ + static post(options: ServicePostOptions) { + const { token, clientID, serverCount } = options + return super._post({ + method: 'put', + url: `/bots/${Util.resolveID(clientID)}/stats`, + headers: { + key: token, + 'Content-Type': 'application/json' + }, + data: { guilds: Util.resolveCount(serverCount) } + }) + } + + /** + * Gets a bot. + * @param id The bot's ID. + */ + getBot(id: IDResolvable) { + return this._request( + { + url: `/bots/${Util.resolveID(id)}`, + headers: { + key: this.token, + 'Content-Type': 'application/json' + } + }, + { requiresToken: true } + ) + } + + /** + * Gets a bot's votes. + * @param id The bot's ID. + */ + getBotVotes(id: IDResolvable) { + return this._request( + { + url: `/bots/${Util.resolveID(id)}/votes`, + headers: { + key: this.token, + 'Content-Type': 'application/json' + } + }, + { requiresToken: true } + ) + } +} From 0d07244049f91d261fb02d12afe16530b8140fa6 Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Wed, 6 Oct 2021 21:46:56 +0000 Subject: [PATCH 13/15] [auto] docs: update docs --- docs/general/services.md | 84 ++++++++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 33 deletions(-) diff --git a/docs/general/services.md b/docs/general/services.md index 3e1ad769..c6997d4d 100644 --- a/docs/general/services.md +++ b/docs/general/services.md @@ -1,16 +1,18 @@ -# Supported Services (26) +# Supported Services (27)

- bladebotlist logo + bladebotlist logo

-

BladeBotList

+ + +

BladeList

-Keys: `bladebotlist`, `bladebotlist.xyz` -Class: [BladeBotList](/#/docs/main/$$$ref/class/BladeBotList) -Website: https://bladebotlist.xyz +Keys: `bladebotlist`, `bladebotlist.xyz`, `bladelist`, `bladelist.gg` +Class: [BladeList](/#/docs/main/$$$ref/class/BladeList) +Website: https://bladelist.gg
@@ -26,20 +28,6 @@ Class: [Blist](/#/docs/main/$$$ref/class/Blist) Website: https://blist.xyz
-
-

- botsfordiscord logo -

- - - -

Bots For Discord

- -Keys: `botsfordiscord`, `botsfordiscord.com`, `discords` -Class: [BotsForDiscord](/#/docs/main/$$$ref/class/BotsForDiscord) -Website: https://discords.com/bots -
-

botsondiscord logo @@ -119,19 +107,6 @@ Class: [DiscordBotlistEU](/#/docs/main/$$$ref/class/DiscordBotlistEU) Website: https://discord-botlist.eu/

-
-

- discordbotsco logo -

- - -

DiscordBots.co

- -Keys: `discordbotsco`, `discordbots.co` -Class: [DiscordBotsCo](/#/docs/main/$$$ref/class/DiscordBotsCo) -Website: https://discordbots.co -
-

discordbotsgg logo @@ -212,6 +187,21 @@ Class: [DiscordServices](/#/docs/main/$$$ref/class/DiscordServices) Website: https://discordservices.net

+
+

+ botsfordiscord logo +

+ + + + +

Discords.com

+ +Keys: `botsfordiscord`, `botsfordiscord.com`, `discords`, `discords.com` +Class: [DiscordsCom](/#/docs/main/$$$ref/class/DiscordsCom) +Website: https://discords.com/bots +
+

disforge logo @@ -264,6 +254,34 @@ Class: [InfinityBotList](/#/docs/main/$$$ref/class/InfinityBotList) Website: https://infinitybotlist.com/

+
+

+ listcord logo +

+ + +

Listcord

+ +Keys: `listcord`, `listcord.gg` +Class: [Listcord](/#/docs/main/$$$ref/class/Listcord) +Website: https://listcord.gg/ +
+ +
+

+ motion logo +

+ + + + +

Motion Botlist

+ +Keys: `motion`, `motiondevelopment`, `motionbotlist`, `motiondevelopment.top` +Class: [MotionBotList](/#/docs/main/$$$ref/class/MotionBotList) +Website: https://www.motiondevelopment.top/bot +
+

spacebotslist logo From b6a45294de35d721cd5bbf00eef8eb6f70a74564 Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Wed, 6 Oct 2021 23:54:41 +0200 Subject: [PATCH 14/15] docs(DiscordListology): use fixed version of logo --- src/Interface/Lists/DiscordListology.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Interface/Lists/DiscordListology.ts b/src/Interface/Lists/DiscordListology.ts index f68148fa..167d24ff 100644 --- a/src/Interface/Lists/DiscordListology.ts +++ b/src/Interface/Lists/DiscordListology.ts @@ -13,7 +13,7 @@ export default class DiscordListology extends Service { /** The logo URL. */ static get logoURL() { - return 'https://discordlistology.com/idiscord.png' + return 'https://i.imgur.com/DmSCuSk.png' } /** Service's name. */ From 351b5c0c19701becd09c249d90e99d7f81aef05d Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Wed, 6 Oct 2021 21:56:34 +0000 Subject: [PATCH 15/15] [auto] docs: update docs --- docs/general/services.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/general/services.md b/docs/general/services.md index c6997d4d..88c50aab 100644 --- a/docs/general/services.md +++ b/docs/general/services.md @@ -163,7 +163,7 @@ Website: https://discordlist.space

- discordlistology logo + discordlistology logo