@@ -801,6 +801,54 @@ def search(self, query: str) -> HTTPResponse:
801
801
path = f'/bots/search/{ uri } '
802
802
)
803
803
804
+ class DiscordBotsCo (Service ):
805
+ """
806
+ Represents the DiscordBots.co service.
807
+
808
+ .. seealso::
809
+ - `DiscordBots.co Website <https://discordbots.co/>`_
810
+ - `DiscordBots.co API Documentation <https://discordbots.co/api/>`_
811
+ """
812
+
813
+ BASE_URL = 'https://api.discordbots.co/v1/public'
814
+
815
+ @staticmethod
816
+ def aliases () -> list :
817
+ return ['discordbotsco' ]
818
+
819
+ @staticmethod
820
+ def _post (
821
+ http_client : HTTPClient , bot_id : str , token : str ,
822
+ server_count = 0 , user_count = 0 ,
823
+ voice_connections = 0 , shard_count : int = None ,
824
+ shard_id : int = None
825
+ ) -> HTTPResponse :
826
+ payload = { 'serverCount' : server_count }
827
+ if shard_id and shard_count :
828
+ payload ['shardCount' ] = shard_count
829
+ return http_client .request (
830
+ method = 'POST' ,
831
+ path = f'{ DiscordBotsCo .BASE_URL } /bot/{ bot_id } ' ,
832
+ headers = { 'Authorization' : token },
833
+ json = payload
834
+ )
835
+
836
+ def get_bot (self , bot_id : str ) -> HTTPResponse :
837
+ """|httpres|\n
838
+ Gets the bot listed on this service.
839
+
840
+ Parameters
841
+ -----------
842
+ bot_id: :class:`str`
843
+ The bot's ID.
844
+ """
845
+ return self ._request (
846
+ method = 'GET' ,
847
+ path = f'/bot/{ bot_id } ' ,
848
+ headers = { 'Authorization' : self .token },
849
+ requires_token = True
850
+ )
851
+
804
852
class DiscordBotsGG (Service ):
805
853
"""
806
854
Represents the Discord Bots service.
@@ -2038,7 +2086,7 @@ def get_unverified_bots(self) -> HTTPResponse:
2038
2086
2039
2087
Service .SERVICES = [
2040
2088
Arcane , Blist , BotListSpace , BotsDataBase , BotsForDiscord , BotsOnDiscord , Carbon ,
2041
- DBLista , DiscordBotsGG , DiscordAppsDev , DiscordBoats ,
2089
+ DBLista , DiscordBotsCo , DiscordBotsGG , DiscordAppsDev , DiscordBoats ,
2042
2090
DiscordBotList , DiscordBotWorld , DiscordExtremeList , GlennBotList ,
2043
2091
LBots , ListMyBots , MythicalBots , SpaceBotsList , TopGG , WonderBotList , YABL
2044
2092
]
0 commit comments