@@ -350,20 +350,20 @@ def get_bots(self) -> HTTPResponse:
350
350
)
351
351
352
352
353
- class DiscordBotsGG (Service ):
353
+ class DiscordBoats (Service ):
354
354
"""
355
- Represents the Discord Bots service.
355
+ Represents the Discord Boats service.
356
356
357
357
.. seealso::
358
- - `Discord Bots Website <https://discord.bots.gg />`_
359
- - `Discord Bots API Documentation <https://discord.bots.gg/ docs>`_
358
+ - `Discord Boats Website <https://discord.boats />`_
359
+ - `Discord Boats API Documentation <https://discord.boats/api/ docs/ >`_
360
360
"""
361
361
362
- BASE_URL = 'https://discord.bots.gg /api/v1 '
362
+ BASE_URL = 'https://discord.boats /api/v2 '
363
363
364
364
@staticmethod
365
365
def aliases () -> list :
366
- return ['discordbotsgg ' , 'discord.bots.gg ' ]
366
+ return ['discordboats ' , 'discord.boats ' ]
367
367
368
368
@staticmethod
369
369
def _post (
@@ -372,53 +372,71 @@ def _post(
372
372
voice_connections : int = 0 , shard_count : int = None ,
373
373
shard_id : int = None
374
374
) -> HTTPResponse :
375
- payload = {'guildCount' : server_count }
376
- if shard_id and shard_count :
377
- payload ['shardId' ] = shard_id
378
- payload ['shardCount' ] = shard_count
379
375
return http_client .request (
380
376
method = 'POST' ,
381
- path = f'{ DiscordBotsGG .BASE_URL } /bots /{ bot_id } /stats ' ,
377
+ path = f'{ DiscordBoats .BASE_URL } /bot /{ bot_id } ' ,
382
378
headers = {'Authorization' : token },
383
- json = payload
379
+ json = { 'server_count' : server_count }
384
380
)
385
381
386
- def get_bots (self , ** query ) -> HTTPResponse :
382
+ def get_bot (self , bot_id : str ) -> HTTPResponse :
387
383
"""|httpres|\n
388
- Gets a list of bots on this service.
384
+ Gets the bot listed on this service.
389
385
390
386
Parameters
391
387
-----------
392
- **query
393
- The query string to append to the URL .
388
+ bot_id: :class:`str`
389
+ The bot's ID .
394
390
"""
395
391
return self ._request (
396
392
method = 'GET' ,
397
- path = '/bots' ,
398
- query = query ,
399
- headers = {'Authorization' : self .token },
400
- requires_token = True
393
+ path = f'/bot/{ bot_id } '
401
394
)
402
395
403
- def get_bot (self , bot_id : str , ** query ) -> HTTPResponse :
396
+ def get_user (self , user_id : str ) -> HTTPResponse :
404
397
"""|httpres|\n
405
- Gets the bot listed on this service.
398
+ Gets the user listed on this service.
399
+
400
+ Parameters
401
+ -----------
402
+ user_id: :class:`str`
403
+ The user's ID.
404
+ """
405
+ return self ._request (
406
+ method = 'GET' ,
407
+ path = f'/user/{ user_id } '
408
+ )
409
+
410
+ def user_voted (self , bot_id : str , user_id : str ) -> HTTPResponse :
411
+ """|httpres|\n
412
+ Checks whether or not a user has reviewed a bot.
406
413
407
414
Parameters
408
415
-----------
409
416
bot_id: :class:`str`
410
417
The bot's ID.
411
- **query
412
- The query string to append to the URL .
418
+ user_id: :class:`str`
419
+ The user's ID .
413
420
"""
414
421
return self ._request (
415
422
method = 'GET' ,
416
- path = f'/bots/{ bot_id } ' ,
417
- query = query ,
418
- headers = {'Authorization' : self .token },
419
- requires_token = True
423
+ path = f'/bot/{ bot_id } /voted' ,
424
+ query = {'id' : user_id }
420
425
)
421
426
427
+ def get_widget_url (self , bot_id : str , ** query ) -> str :
428
+ """
429
+ Gets the widget URL for this bot.
430
+
431
+ Parameters
432
+ -----------
433
+ bot_id: :class:`str`
434
+ The bot's ID.
435
+ **query
436
+ The query string to append to the URL.
437
+ """
438
+ return f'{ DiscordBoats .BASE_URL } /widget/{ bot_id } .svg?{ _encode_query (query )} '
439
+
422
440
423
441
class DiscordBotList (Service ):
424
442
"""
@@ -457,20 +475,20 @@ def _post(
457
475
)
458
476
459
477
460
- class DiscordBoats (Service ):
478
+ class DiscordBotsGG (Service ):
461
479
"""
462
- Represents the Discord Boats service.
480
+ Represents the Discord Bots service.
463
481
464
482
.. seealso::
465
- - `Discord Boats Website <https://discord.boats />`_
466
- - `Discord Boats API Documentation <https://discord.boats/api/ docs/ >`_
483
+ - `Discord Bots Website <https://discord.bots.gg />`_
484
+ - `Discord Bots API Documentation <https://discord.bots.gg/ docs>`_
467
485
"""
468
486
469
- BASE_URL = 'https://discord.boats /api/v2 '
487
+ BASE_URL = 'https://discord.bots.gg /api/v1 '
470
488
471
489
@staticmethod
472
490
def aliases () -> list :
473
- return ['discordboats ' , 'discord.boats ' ]
491
+ return ['discordbotsgg ' , 'discord.bots.gg ' ]
474
492
475
493
@staticmethod
476
494
def _post (
@@ -479,71 +497,53 @@ def _post(
479
497
voice_connections : int = 0 , shard_count : int = None ,
480
498
shard_id : int = None
481
499
) -> HTTPResponse :
500
+ payload = {'guildCount' : server_count }
501
+ if shard_id and shard_count :
502
+ payload ['shardId' ] = shard_id
503
+ payload ['shardCount' ] = shard_count
482
504
return http_client .request (
483
505
method = 'POST' ,
484
- path = f'{ DiscordBoats .BASE_URL } /bot /{ bot_id } ' ,
506
+ path = f'{ DiscordBotsGG .BASE_URL } /bots /{ bot_id } /stats ' ,
485
507
headers = {'Authorization' : token },
486
- json = {'server_count' : server_count }
487
- )
488
-
489
- def get_bot (self , bot_id : str ) -> HTTPResponse :
490
- """|httpres|\n
491
- Gets the bot listed on this service.
492
-
493
- Parameters
494
- -----------
495
- bot_id: :class:`str`
496
- The bot's ID.
497
- """
498
- return self ._request (
499
- method = 'GET' ,
500
- path = f'/bot/{ bot_id } '
508
+ json = payload
501
509
)
502
510
503
- def get_user (self , user_id : str ) -> HTTPResponse :
511
+ def get_bots (self , ** query ) -> HTTPResponse :
504
512
"""|httpres|\n
505
- Gets the user listed on this service.
513
+ Gets a list of bots on this service.
506
514
507
515
Parameters
508
516
-----------
509
- user_id: :class:`str`
510
- The user's ID .
517
+ **query
518
+ The query string to append to the URL .
511
519
"""
512
520
return self ._request (
513
521
method = 'GET' ,
514
- path = f'/user/{ user_id } '
522
+ path = '/bots' ,
523
+ query = query ,
524
+ headers = {'Authorization' : self .token },
525
+ requires_token = True
515
526
)
516
527
517
- def user_voted (self , bot_id : str , user_id : str ) -> HTTPResponse :
528
+ def get_bot (self , bot_id : str , ** query ) -> HTTPResponse :
518
529
"""|httpres|\n
519
- Checks whether or not a user has reviewed a bot .
530
+ Gets the bot listed on this service .
520
531
521
532
Parameters
522
533
-----------
523
534
bot_id: :class:`str`
524
535
The bot's ID.
525
- user_id: :class:`str`
526
- The user's ID .
536
+ **query
537
+ The query string to append to the URL .
527
538
"""
528
539
return self ._request (
529
540
method = 'GET' ,
530
- path = f'/bot/{ bot_id } /voted' ,
531
- query = {'id' : user_id }
541
+ path = f'/bots/{ bot_id } ' ,
542
+ query = query ,
543
+ headers = {'Authorization' : self .token },
544
+ requires_token = True
532
545
)
533
546
534
- def get_widget_url (self , bot_id : str , ** query ) -> str :
535
- """
536
- Gets the widget URL for this bot.
537
-
538
- Parameters
539
- -----------
540
- bot_id: :class:`str`
541
- The bot's ID.
542
- **query
543
- The query string to append to the URL.
544
- """
545
- return f'{ DiscordBoats .BASE_URL } /widget/{ bot_id } .svg?{ _encode_query (query )} '
546
-
547
547
548
548
class DiscordExtremeList (Service ):
549
549
"""
0 commit comments