-
Notifications
You must be signed in to change notification settings - Fork 29
/
openapi.yml
744 lines (709 loc) · 27.3 KB
/
openapi.yml
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
openapi: 3.0.0
info:
title: BotBlock API
version: 1.0.0
servers:
- url: https://botblock.org
description: Production
paths:
/api/count:
post:
summary: Update guild count
description: |
The `POST /api/count` endpoint of the BotBlock API is the core endpoint that bots and libraries integrate with, allowing a bot to make a single POST call to send their guild count to all supported lists, based on the API keys passed for lists.
_Note: This ratelimit has a 1 / 120s ratelimit for successful requests. Requests that return a 400 or 429 status code are not ratelimited._
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
server_count:
description: |
The server/guild count for the bot.
_Note: Value is required but will not be sent to a list if 'shards' is provided and the list accepts a 'shards' value._
type: integer
bot_id:
description: The ID of the bot.
type: string
format: snowflake
shard_id:
description: |
The shard ID for the current count being posted.
_Note: This information is only sent to bot lists that support it._
type: integer
nullable: true
shard_count:
description: |
The total number of shards for the bot.
_Note: This information is only sent to bot lists that support it._
type: integer
nullable: true
shards:
description: |
The server/guild count for each shard.
_Note: This information is only sent to bot lists that support it._
type: array
nullable: true
items:
type: integer
additionalProperties:
description: Provide keys for each list ID to post to, with the value being the API key for the list.
type: string
required:
- server_count
- bot_id
examples:
bot:
value:
server_count: 10000
bot_id: "123456789123456789"
thelist.org: abcDEFghi.JKLmnoPQR.stuVWXyz1
listofbots.com: abcDEFghi.JKLmnoPQR.stuVWXyz1
otherlist.xyz: abcDEFghi.JKLmnoPQR.stuVWXyz1
shard:
value:
server_count: 1000
bot_id: "123456789123456789"
shard_id: 1
shard_count: 10
thelist.org: abcDEFghi.JKLmnoPQR.stuVWXyz1
listofbots.com: abcDEFghi.JKLmnoPQR.stuVWXyz1
otherlist.xyz: abcDEFghi.JKLmnoPQR.stuVWXyz1
shards:
value:
server_count: 10000
bot_id: "123456789123456789"
shards: [ 800, 1100, 1200, 900, 1000, 1100, 900, 800, 1200, 1000 ]
thelist.org: abcDEFghi.JKLmnoPQR.stuVWXyz1
listofbots.com: abcDEFghi.JKLmnoPQR.stuVWXyz1
otherlist.xyz: abcDEFghi.JKLmnoPQR.stuVWXyz1
responses:
"200":
description: Guild count forwarded to provided lists.
content:
application/json:
schema:
type: object
properties:
success:
description: Properties for each list that returned a successful response.
type: object
additionalProperties:
type: array
minItems: 3
maxItems: 3
items:
description: Integer response status code from list, followed by string response from list, followed by JSON stringified data sent to list.
oneOf:
- type: string
- type: integer
failure:
description: Properties for each list that returned a failure response.
type: object
additionalProperties:
type: array
minItems: 3
maxItems: 3
items:
description: Integer response status code from list, followed by string response from list, followed by JSON stringified data sent to list.
oneOf:
- type: string
- type: integer
examples:
bot:
value:
success:
thelist.org:
- 200
- "{\"message\":\"OK\"}"
- "{\"server_count\":10000}"
listofbots.com:
- 200
- ""
- "{\"count\":10000}"
failure:
otherlist.xyz:
- 404
- "Bot not found"
- "{\"guilds\":10000}"
"400":
description: Request validation failed.
content:
application/json:
schema:
type: object
properties:
error:
type: boolean
enum:
- true
status:
type: integer
enum:
- 400
message:
description: An error message explaining why request validation failed.
type: string
examples:
error:
value:
error: true
status: 400
message: "'bot_id' must be a snowflake"
"429":
$ref: "#/components/responses/Ratelimit"
/api/bots/{id}:
get:
summary: Get bot information
description: |
Fetch aggregated information about a Discord bot based on data returned by bot lists that BotBlock tracks that support getting bot information.
_Note: This ratelimit has a 1 / 30s ratelimit for successful requests. Requests that return a 400 or 429 status code are not ratelimited._
parameters:
- in: path
name: id
schema:
type: string
format: snowflake
required: true
description: Discord bot ID to fetch
responses:
"200":
description: Guild count forwarded to provided lists.
content:
application/json:
schema:
type: object
properties:
id:
description: The ID of the bot being fetched.
type: string
format: snowflake
username:
description: |
The username of the bot fetched.
_Note: Based on the most common value returned from list data, defaults to `Unknown`._
type: string
discriminator:
description: |
The discriminator of the bot fetched.
_Note: Based on the most common value returned from list data, defaults to `0000`._
type: string
owners:
description: The IDs of all known owners of the bot.
type: array
items:
type: string
format: snowflake
server_count:
description: |
The server/guild count for the bot.
_Note: Based on the maximum value returned from list data, defaults to `0`._
type: integer
invite:
description: |
The invite URL for the bot (Discord or custom), if known.
_Note: Based on the most common value returned from list data, defaults to an empty string._
type: string
prefix:
description: |
The command prefix for the bot, if known.
_Note: Based on the most common value returned from list data, defaults to an empty string._
type: string
website:
description: |
The website link for the bot, if known.
_Note: Based on the most common value returned from list data, defaults to an empty string._
type: string
github:
description: |
The open-source GitHub URL for the bot, if known.
_Note: Based on the most common value returned from list data, defaults to an empty string._
type: string
support:
description: |
The support link for the bot (Discord or custom), if known.
_Note: Based on the most common value returned from list data, defaults to an empty string._
type: string
library:
description: |
The library/language the bot was developed in, if known.
_Note: Based on the most common value returned from list data, defaults to an empty string._
type: string
list_data:
description: Response from each BotBlock-tracked list that has a endpoint for fetching bot information.
type: object
additionalProperties:
type: array
minItems: 2
maxItems: 2
items:
description: Data response from the list (parsed JSON, or raw text respose), followed by the integer response status code.
oneOf:
- $ref: '#/components/schemas/AnyJSON'
- type: integer
examples:
bot:
value:
id: "123456789123456789"
username: My Bot
discriminator: "1234"
owners:
- "123456789123456789"
server_count: 10000
invite: https://discord.com/oauth2/authorize?client_id=123456789123456789&scope=bot
prefix: "!"
website: https://my-bot.com/
github: https://github.com/hello/my-bot
support: https://discord.gg/discord-developers
library: discord.js
list_data:
thelist.org:
- bot_id: "123456789123456789"
...: ...
- 200
listofbots.com:
- bot:
id: "123456789123456789"
guilds: 10000
...: ...
- 200
otherlist.xyz:
- Bot not found
- 404
"400":
description: Request validation failed.
content:
application/json:
schema:
type: object
properties:
error:
type: boolean
enum:
- true
status:
type: integer
enum:
- 400
message:
description: An error message explaining why request validation failed.
type: string
examples:
error:
value:
error: true
status: 400
message: "'id' must be a snowflake"
"429":
$ref: "#/components/responses/Ratelimit"
/api/lists:
get:
summary: Get all known bot lists
description: Fetch information about all bot lists that BotBlock tracks, including core information as well as API details and known features.
parameters:
- in: query
name: filter
schema:
type: boolean
description: Set to true to only return API information for each lists. Lists with no API data will be excluded from the response.
responses:
"200":
description: Lists tracked by BotBlock.
content:
application/json:
schema:
description: Properties for each list.
type: object
additionalProperties:
$ref: "#/components/schemas/List"
examples:
all:
value:
thelist.org:
id: thelist.org
added: 1609459200
name: The List
url: https://thelist.org/
icon: https://thelist.org/favicon.png
language: English
display: 1
defunct: 0
discord_only: 1
description: The List
api_docs: https://thelist.org/api/docs
api_post: https://thelist.org/api/bot/:id
api_post_method: null
api_field: server_count
api_shard_id: shard_id
api_shard_count: shard_count
api_shards: null
api_get: https://thelist.org/api/bot/:id
api_all: null
view_bot: https://thelist.org/bot/:id
bot_widget: https://thelist.org/bot/:id/widget
content: null
owners: "123456789123456789"
discord: https://discord.gg/discord-developers
features:
- name: Guild count API
id: guild-count-api
display: 5
type: 0
description: Has an API endpoint for guild count
value: 1
listofbots.com:
id: listofbots.com
added: 1609459200
name: List of Bots
url: https://listofbots.com/
icon: https://listofbots.com/assets/icon.png
language: English
display: 1
defunct: 0
discord_only: 0
description: List of Bots for chat platforms
api_docs: null
api_post: null
api_field: null
api_shard_id: null
api_shard_count: null
api_shards: null
api_get: null
api_all: null
view_bot: https://listofbots.com/bots/:id
bot_widget: null
content: null
owners: "123456789123456789"
discord: https://discord.gg/discord-developers
features:
- name: Guild count API
id: guild-count-api
display: 5
type: 0
description: Has an API endpoint for guild count
value: 0
filtered:
value:
thelist.org:
api_docs: https://thelist.org/api/docs
api_post: https://thelist.org/api/bot/:id
api_field: server_count
api_shard_id: shard_id
api_shard_count: shard_count
api_shards: null
api_get: https://thelist.org/api/bot/:id
api_all: null
/api/lists/{id}:
get:
summary: Get a specific bot list
description: Fetch information about a given bot lists that BotBlock tracks, including core information as well as API details and known features.
parameters:
- in: path
name: id
schema:
type: string
required: true
description: ID of the list on BotBlock to fetch.
responses:
"200":
description: Requested list on BotBlock.
content:
application/json:
schema:
$ref: "#/components/schemas/List"
examples:
list:
value:
id: thelist.org
added: 1609459200
name: The List
url: https://thelist.org/
icon: https://thelist.org/favicon.png
language: English
display: 1
defunct: 0
discord_only: 1
description: The List
api_docs: https://thelist.org/api/docs
api_post: https://thelist.org/api/bot/:id
api_post_method: null
api_field: server_count
api_shard_id: shard_id
api_shard_count: shard_count
api_shards: null
api_get: https://thelist.org/api/bot/:id
api_all: null
view_bot: https://thelist.org/bot/:id
bot_widget: https://thelist.org/bot/:id/widget
content: null
owners: "123456789123456789"
discord: https://discord.gg/discord-developers
features:
- name: Guild count API
id: guild-count-api
display: 5
type: 0
description: Has an API endpoint for guild count
value: 1
"404":
description: Requested list not found.
content:
application/json:
schema:
type: object
properties:
error:
type: boolean
enum:
- true
status:
type: integer
enum:
- 404
message:
description: An error message explaining the list wasn't found.
type: string
examples:
error:
value:
error: true
status: 404
message: "List not found"
/api/legacy-ids:
get:
summary: Get legacy list IDs
description: Fetch the map of legacy bot list IDs to the current list IDs.
responses:
"200":
description: Map of old IDs to new IDs.
content:
application/json:
schema:
description: Object mapping legacy IDs as keys to current list IDs as values.
type: object
additionalProperties:
type: string
examples:
map:
value:
oldlist.com: thelist.org
botlist.xyz: botlist.com
components:
schemas:
AnyJSON:
description: Can be any JSON-able value - string, number, boolean, array or object.
Feature:
type: object
properties:
name:
description: The displayed name of the feature.
type: string
id:
description: The sluggified name of the feature.
type: string
display:
description: A value used to rank features. Sorted in descending order.
type: integer
type:
description: The type the feature is, with 0 = positive, 1 = neutral, 2 = negative.
type: integer
enum:
- 0
- 1
- 2
description:
description: The displayed description of the feature.
type: string
List:
type: object
properties:
id:
description: The ID of the list on BotBlock.
type: string
added:
description: The unix timestamp for when the list was added to BotBlock.
type: integer
name:
description: The displayed name of the list.
type: string
url:
description: The main URL to access the bot list.
type: string
format: uri
icon:
description: A URL for an icon for the list.
type: string
format: uri
language:
description: The languages the list has support for.
type: string
display:
description: A flag for if the list is displayed on BotBlock, with 0 = hidden, 1 = displayed.
type: integer
enum:
- 0
- 1
defunct:
description: A flag for if the list is known to be defunct, with 0 = active, 1 = defunct.
type: integer
enum:
- 0
- 1
discord_only:
description: A flag for if the list holds Discord bots only, with 0 = includes non-Discord, 1 = Discord-only.
type: integer
enum:
- 0
- 1
description:
description: The displayed description of the list.
type: string
api_docs:
description: The URL to the API docs for the list, if known.
type: string
format: uri
nullable: true
api_post:
description: The endpoint URL for posting a bot's guild count to the list, if known, with `:id` as placeholder for bot Id.
type: string
format: uri
nullable: true
api_post_method:
description: The HTTP method to use for submitting a bot's guild count to the list via `api_post`. Defaults to `POST` if null.
type: string
nullable: true
api_field:
description: The field name for guild count when posting a bot's guild count to the list, if known.
type: string
nullable: true
api_shard_id:
description: The field name for shard Id when posting a bot's guild count to the list, if known.
type: string
nullable: true
api_shard_count:
description: The field name for shard count when posting a bot's guild count to the list, if known.
type: string
nullable: true
api_shards:
description: The field name for shards when posting a bot's guild count to the list, if known.
type: string
nullable: true
api_get:
description: The endpoint URL for getting a bot from the list, if known, with `:id` as placeholder for bot Id.
type: string
format: uri
nullable: true
api_all:
description: The endpoint URL for getting all bots from the list, if known.
type: string
format: uri
nullable: true
view_bot:
description: The URL to the view a bot on the list, if known, with `:id` as placeholder for bot Id.
type: string
format: uri
nullable: true
bot_widget:
description: The URL to get a bot widget from the list, if known, with `:id` as placeholder for bot Id.
type: string
format: uri
nullable: true
content:
description: The displayed notice content for the list, if any.
type: string
nullable: true
owners:
description: Names of the list owners, if known.
type: string
nullable: true
discord:
description: The URL invite for the list's Discord server, if known.
type: string
format: uri
nullable: true
features:
description: A list of features that the list has
type: array
items:
allOf:
- $ref: "#/components/schemas/Feature"
- type: object
properties:
value:
description: A flag for if the list is known to have this feature or not, with 0 = does not have feature, 1 = has feature.
type: integer
enum:
- 0
- 1
responses:
Ratelimit:
description: Request ratelimited.
content:
application/json:
schema:
type: object
properties:
error:
type: boolean
enum:
- true
status:
type: integer
enum:
- 429
retry_after:
description: How many seconds until the API can be used again.
type: integer
ratelimit_reset:
description: The unix timestamp when the API can be used again.
type: integer
ratelimit_method:
description: Ratelimit scope - the HTTP method.
type: string
ratelimit_route:
description: Ratelimit scope - the API route.
type: string
ratelimit_ip:
description: Ratelimit scope - the requesting IP address.
type: string
ratelimit_bot_id:
description: Ratelimit scope - the provided bot ID.
type: string
examples:
error:
value:
error: true
status: 429
retry_after: 80
ratelimit_reset: 1609459320
ratelimit_method: GET
ratelimit_route: /api/path/name
ratelimit_ip: 12.45.67.89
ratelimit_bot_id: "123456789123456789"
headers:
Retry-After:
description: How many seconds until the API can be used again.
schema:
type: integer
X-Rate-Limit-Reset:
description: The unix timestamp when the API can be used again.
schema:
type: integer
X-Rate-Limit-Method:
description: Ratelimit scope - the HTTP method.
schema:
type: string
X-Rate-Limit-Route:
description: Ratelimit scope - the API route.
schema:
type: string
X-Rate-Limit-IP:
description: Ratelimit scope - the requesting IP address.
schema:
type: string
X-Rate-Limit-Bot-ID:
description: Ratelimit scope - the provided bot ID.
schema:
type: string