-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDBots.ts
76 lines (68 loc) · 1.8 KB
/
DBots.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { Service, ServicePostOptions } from '../Service'
import { Util, IDResolvable } from '../../Utils/Util'
/**
* Represents the DBots service.
* @see https://docs.dbots.co/
*/
export default class DBots extends Service {
/** The values that can be used to select the service. */
static get aliases() {
return ['dbots', 'dbots.co']
}
/** The logo URL. */
static get logoURL() {
return 'https://gblobscdn.gitbook.com/spaces%2F-MO490c2KMEgwyXnbtbV%2Favatar-1607528014691.png'
}
/** Service's name. */
static get serviceName() {
return 'DBots.co'
}
/** The website URL. */
static get websiteURL() {
return 'https://dbots.co/'
}
/** The base URL of the service's API. */
static get baseURL() {
return 'https://dbots.co/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: { guildCount: Util.resolveCount(serverCount) }
})
}
/**
* Gets the bot's audit logs.
* @param id The bot's ID
*/
getAudit(id: IDResolvable) {
return this._request(
{
url: `/bots/${Util.resolveID(id)}/log`,
headers: { Authorization: this.token }
},
{ requiresToken: true }
)
}
/**
* Regenerates the bot API token.
* @param id The bot's ID
*/
regenToken(id: IDResolvable) {
return this._request(
{
url: `/bots/${Util.resolveID(id)}/keys/regen`,
headers: { Authorization: this.token }
},
{ requiresToken: true }
)
}
}