From 44c38faa86055e94e3ac6a1f950ed1837f6e52f9 Mon Sep 17 00:00:00 2001 From: Scorprian <43557305+ScorprianDev@users.noreply.github.com> Date: Thu, 30 Jun 2022 09:24:28 +1200 Subject: [PATCH 1/3] Add files via upload --- src/Interface/Lists/RadarBotDirectory.ts | 82 ++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 src/Interface/Lists/RadarBotDirectory.ts diff --git a/src/Interface/Lists/RadarBotDirectory.ts b/src/Interface/Lists/RadarBotDirectory.ts new file mode 100644 index 00000000..56421a0b --- /dev/null +++ b/src/Interface/Lists/RadarBotDirectory.ts @@ -0,0 +1,82 @@ +import { Service, ServicePostOptions } from '../Service' +import { Util, IDResolvable } from '../../Utils/Util' +import { Query } from '../../Utils/Constants' + +/** + * Represents the Radar Bot Directory service. + * @see https://radarbotdirectory.xyz/docs/ + */ +export default class RadarBotDirectory extends Service { + /** The values that can be used to select the service. */ + static get aliases() { + return ['radar', 'radarbots', 'radarbotdirectory.xyz'] + } + + /** The logo URL. */ + static get logoURL() { + return 'https://radarbotdirectory.xyz/static/logo.png' + } + + /** Service's name. */ + static get serviceName() { + return 'Radar Bot Directory' + } + + /** The website URL. */ + static get websiteURL() { + return 'https://radarbotdirectory.xyz' + } + + /** The base URL of the service's API. */ + static get baseURL() { + return 'https://radarbotdirectory.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: 'patch', + url: `/bot/${Util.resolveID(clientID)}/stats/`, + headers: { Authorization: token }, + data: shard + ? { + guilds: Util.resolveCount(serverCount), + shards: 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: `/bot/${Util.resolveID(id)}` }) + } + + /** + * Gets the Unix Epoch Timestamp of the last vote on this bot from this user on this service. + * @param id The bot's ID + * @param user The user's ID + */ + getBotVotes(id: IDResolvable, user: IDResolvable) { + return this._request( + { + url: `/lastvoted/${Util.resolveID(user)}/${Util.resolveID(id)}`, + headers: { Authorization: this.token } + }, + { + requiresToken: true + } + ) + } + + +} \ No newline at end of file From f94908b2bbe36745f50bf2810ccb3df8c8337f62 Mon Sep 17 00:00:00 2001 From: Scorprian <43557305+ScorprianDev@users.noreply.github.com> Date: Thu, 30 Jun 2022 09:35:10 +1200 Subject: [PATCH 2/3] Update RadarBotDirectory.ts --- src/Interface/Lists/RadarBotDirectory.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Interface/Lists/RadarBotDirectory.ts b/src/Interface/Lists/RadarBotDirectory.ts index 56421a0b..bcc857e9 100644 --- a/src/Interface/Lists/RadarBotDirectory.ts +++ b/src/Interface/Lists/RadarBotDirectory.ts @@ -1,6 +1,5 @@ import { Service, ServicePostOptions } from '../Service' import { Util, IDResolvable } from '../../Utils/Util' -import { Query } from '../../Utils/Constants' /** * Represents the Radar Bot Directory service. @@ -47,7 +46,7 @@ export default class RadarBotDirectory extends Service { guilds: Util.resolveCount(serverCount), shards: shard.count } - : { server_count: Util.resolveCount(serverCount) } + : { guilds: Util.resolveCount(serverCount) } }) } @@ -63,13 +62,13 @@ export default class RadarBotDirectory extends Service { /** * Gets the Unix Epoch Timestamp of the last vote on this bot from this user on this service. - * @param id The bot's ID - * @param user The user's ID + * @param botID The bot's ID + * @param userID The user's ID */ - getBotVotes(id: IDResolvable, user: IDResolvable) { + getBotVotes(botID: IDResolvable, userID: IDResolvable) { return this._request( { - url: `/lastvoted/${Util.resolveID(user)}/${Util.resolveID(id)}`, + url: `/lastvoted/${Util.resolveID(userID)}/${Util.resolveID(botID)}`, headers: { Authorization: this.token } }, { @@ -79,4 +78,4 @@ export default class RadarBotDirectory extends Service { } -} \ No newline at end of file +} From c4ad5d654c0a686c50cec130f95433651dacf89a Mon Sep 17 00:00:00 2001 From: Scorprian <43557305+ScorprianDev@users.noreply.github.com> Date: Thu, 30 Jun 2022 09:37:23 +1200 Subject: [PATCH 3/3] Update RadarBotDirectory.ts --- src/Interface/Lists/RadarBotDirectory.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Interface/Lists/RadarBotDirectory.ts b/src/Interface/Lists/RadarBotDirectory.ts index bcc857e9..bad375ee 100644 --- a/src/Interface/Lists/RadarBotDirectory.ts +++ b/src/Interface/Lists/RadarBotDirectory.ts @@ -3,7 +3,7 @@ import { Util, IDResolvable } from '../../Utils/Util' /** * Represents the Radar Bot Directory service. - * @see https://radarbotdirectory.xyz/docs/ + * @see https://docs.radarbotdirectory.xyz/ */ export default class RadarBotDirectory extends Service { /** The values that can be used to select the service. */