Skip to content
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

Create BotlistMe.ts #740

Merged
merged 4 commits into from
Feb 26, 2025
Merged
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
15 changes: 14 additions & 1 deletion docs/general/services.md
Original file line number Diff line number Diff line change
@@ -28,6 +28,19 @@ Class: [Blist](/#/docs/main/$$$ref/class/Blist)
Website: https://blist.xyz
</div>

<div align=center>
<p>
<img src="https://botlist.me/icon.png" alt="botlistme logo" width="100" align="left" />
</p>
<i id="botlistme"></i>
<i id="botlist.me"></i>
<a href="https://botlist.me"><h1>BotlistMe</h1></a>

Keys: `botlistme`, `botlist.me`
Class: [BotlistMe](/#/docs/main/$$$ref/class/BotlistMe)
Website: https://botlist.me
</div>

<div align=center>
<p>
<img src="https://bots.ondiscord.xyz/favicon/android-chrome-256x256.png" alt="botsondiscord logo" width="100" align="left" />
@@ -374,4 +387,4 @@ Website: https://wonderbotlist.com/en
Keys: `yabl`, `yabl.xyz`
Class: [YABL](/#/docs/main/$$$ref/class/YABL)
Website: https://yabl.xyz/
</div>
</div>
3 changes: 3 additions & 0 deletions src/Interface/ListIndex.ts
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@

import BladeList from './Lists/BladeList'
import Blist from './Lists/Blist'
import BotlistMe from './Lists/BotlistMe'
import BotsOnDiscord from './Lists/BotsOnDiscord'
import Carbon from './Lists/Carbon'
import DBots from './Lists/DBots'
@@ -39,6 +40,8 @@ export const serviceList = {
'bladelist.gg': BladeList,
'blist': Blist,
'blist.xyz': Blist,
'botlistme': BotlistMe,
'botlist.me': BotlistMe,
'botsondiscord': BotsOnDiscord,
'bots.ondiscord.xyz': BotsOnDiscord,
'carbonitex': Carbon,
64 changes: 64 additions & 0 deletions src/Interface/Lists/BotlistMe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { Service, ServicePostOptions } from '../Service'
import { Util, IDResolvable } from '../../Utils/Util'

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

/** The logo URL. */
static get logoURL() {
return 'https://botlist.me/icon.png'
}

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

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

/** The base URL of the service's API. */
static get baseURL() {
return 'https://api.botlist.me/api/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, clientID, serverCount } = options
return super._post({
method: 'post',
url: `/bots/${Util.resolveID(clientID)}/stats/`,
headers: { Authorization: token },
data: { server_count: Util.resolveCount(serverCount) }
})
}

/**
* 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: `/bots/${Util.resolveID(botID)}/voted`,
headers: { Authorization: this.token },
params: { user_id: Util.resolveID(userID) }
},
{ requiresToken: true }
)
}
}