Skip to content

feat: add RadarBotList #466

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 2 commits into from
Jun 30, 2022
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
16 changes: 15 additions & 1 deletion docs/general/services.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Supported Services (26)
# Supported Services (27)

<div align=center>
<p>
Expand Down Expand Up @@ -269,6 +269,20 @@ Class: [MotionBotList](/#/docs/main/$$$ref/class/MotionBotList)
Website: https://www.motiondevelopment.top/bot
</div>

<div align=center>
<p>
<img src="https://theoverlook.xyz/Images/RBD/botlistlogo.png" alt="radar logo" width="100" align="left" />
</p>
<i id="radar"></i>
<i id="radarbots"></i>
<i id="radarbotdirectory.xyz"></i>
<a href="https://radarbotdirectory.xyz"><h1>Radar Bot Directory</h1></a>

Keys: `radar`, `radarbots`, `radarbotdirectory.xyz`
Class: [RadarBotList](/#/docs/main/$$$ref/class/RadarBotList)
Website: https://radarbotdirectory.xyz
</div>

<div align=center>
<p>
<img src="https://cdn.discordapp.com/avatars/546742409409593354/123b9b0a54b45d99627215c7154580af.webp?size=256" alt="spacebotslist logo" width="100" align="left" />
Expand Down
16 changes: 10 additions & 6 deletions src/Interface/ListIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ import DiscordBotlistEU from './Lists/DiscordBotlistEU'
import DiscordBotsGG from './Lists/DiscordBotsGG'
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 DiscordListology from './Lists/DiscordListology'
import DiscordServices from './Lists/DiscordServices'
import DiscordsCom from './Lists/DiscordsCom'
import Disforge from './Lists/Disforge'
import FatesList from './Lists/FatesList'
import InfinityBotList from './Lists/InfinityBotList'
import Listcord from './Lists/Listcord'
import MotionBotList from './Lists/MotionBotList'
import RadarBotList from './Lists/RadarBotList'
import SpaceBotsList from './Lists/SpaceBotsList'
import TopCord from './Lists/TopCord'
import TopGG from './Lists/TopGG'
Expand Down Expand Up @@ -56,18 +57,18 @@ export const serviceList = {
'discordextremelist.xyz': DiscordExtremeList,
'discordlabs': DiscordLabs,
'discordlabs.org': DiscordLabs,
'discordlistology': DiscordListology,
'discordlistology.com': DiscordListology,
'discordlistspace': DiscordListSpace,
'discordlist.space': DiscordListSpace,
'botlistspace': DiscordListSpace,
'botlist.space': DiscordListSpace,
'discordlistology': DiscordListology,
'discordlistology.com': DiscordListology,
'discordservices': DiscordServices,
'discordservices.net': DiscordServices,
'botsfordiscord': DiscordsCom,
'botsfordiscord.com': DiscordsCom,
'discords': DiscordsCom,
'discords.com': DiscordsCom,
'discordservices': DiscordServices,
'discordservices.net': DiscordServices,
'disforge': Disforge,
'disforge.com': Disforge,
'fateslist': FatesList,
Expand All @@ -80,6 +81,9 @@ export const serviceList = {
'motiondevelopment': MotionBotList,
'motionbotlist': MotionBotList,
'motiondevelopment.top': MotionBotList,
'radar': RadarBotList,
'radarbots': RadarBotList,
'radarbotdirectory.xyz': RadarBotList,
'spacebotslist': SpaceBotsList,
'space-bot-list.xyz': SpaceBotsList,
'topcord': TopCord,
Expand Down
77 changes: 77 additions & 0 deletions src/Interface/Lists/RadarBotList.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { Service, ServicePostOptions } from '../Service'
import { Util, IDResolvable } from '../../Utils/Util'

/**
* Represents the Radar Bot Directory service.
* @see https://docs.radarbotdirectory.xyz/
*/
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://theoverlook.xyz/Images/RBD/botlistlogo.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
}
: { guilds: 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 time this user voted for this bot on this service.
* @param botID The bot's ID
* @param userID The user's ID
*/
getBotVotes(botID: IDResolvable, userID: IDResolvable) {
return this._request(
{
url: `/lastvoted/${Util.resolveID(userID)}/${Util.resolveID(botID)}`,
headers: { Authorization: this.token }
},
{
requiresToken: true
}
)
}
}