@@ -135,6 +135,98 @@ def _post(
135
135
json = payload
136
136
)
137
137
138
+ class Blist (Service ):
139
+ """
140
+ Represents the Blist service.
141
+
142
+ .. seealso::
143
+ - `Blist Website <https://blist.xyz/>`_
144
+ - `Blist API Documentation <https://blist.xyz/docs/>`_
145
+ """
146
+
147
+ BASE_URL = 'https://blist.xyz/api'
148
+
149
+ @staticmethod
150
+ def aliases () -> list :
151
+ return ['blist' , 'blist.xyz' ]
152
+
153
+ @staticmethod
154
+ def _post (
155
+ http_client : HTTPClient , bot_id : str , token : str ,
156
+ server_count = 0 , user_count = 0 ,
157
+ voice_connections = 0 , shard_count : int = None ,
158
+ shard_id : int = None
159
+ ) -> HTTPResponse :
160
+ payload = { 'server_count' : server_count }
161
+ if shard_id and shard_count :
162
+ payload ['shard_count' ] = shard_count
163
+ return http_client .request (
164
+ method = 'POST' ,
165
+ path = f'{ Blist .BASE_URL } /bot/{ bot_id } /stats' ,
166
+ headers = { 'Authorization' : token },
167
+ json = payload
168
+ )
169
+
170
+ def get_user (self , user_id : str ) -> HTTPResponse :
171
+ """|httpres|\n
172
+ Gets the user listed on this service.
173
+
174
+ Parameters
175
+ -----------
176
+ user_id: :class:`str`
177
+ The user's ID.
178
+ """
179
+ return self ._request (
180
+ method = 'GET' ,
181
+ path = f'/user/{ user_id } '
182
+ )
183
+
184
+ def get_bot (self , bot_id : str ) -> HTTPResponse :
185
+ """|httpres|\n
186
+ Gets the bot listed on this service.
187
+
188
+ Parameters
189
+ -----------
190
+ bot_id: :class:`str`
191
+ The bot's ID.
192
+ """
193
+ return self ._request (
194
+ method = 'GET' ,
195
+ path = f'/bot/{ bot_id } /stats'
196
+ )
197
+
198
+ def get_bot_votes (self , bot_id : str ) -> HTTPResponse :
199
+ """|httpres|\n
200
+ Gets the list of people who voted this bot on this service.
201
+
202
+ Parameters
203
+ -----------
204
+ bot_id: :class:`str`
205
+ The bot's ID.
206
+ """
207
+ return self ._request (
208
+ method = 'GET' ,
209
+ path = f'/bot/{ bot_id } /votes' ,
210
+ headers = { 'Authorization' : self .token },
211
+ requires_token = True
212
+ )
213
+
214
+ def get_widget_url (self , bot_id : str , widget_type : str = 'normal' , ** query ) -> str :
215
+ """
216
+ Gets the widget URL for this bot.
217
+
218
+ Parameters
219
+ -----------
220
+ bot_id: :class:`str`
221
+ The bot's ID.
222
+ widget_type: Optional[:class:`str`]
223
+ The type of widget to show.
224
+ **query
225
+ The query string to append to the URL.
226
+ """
227
+ query ['type' ] = widget_type
228
+ return f'{ Blist .BASE_URL } /widget/{ subpath } { bot_id } .svg?{ _encode_query (query )} '
229
+
138
230
class BotListSpace (Service ):
139
231
"""
140
232
Represents the botlist.space service.
@@ -1945,7 +2037,7 @@ def get_unverified_bots(self) -> HTTPResponse:
1945
2037
)
1946
2038
1947
2039
Service .SERVICES = [
1948
- Arcane , BotListSpace , BotsDataBase , BotsForDiscord , BotsOnDiscord , Carbon ,
2040
+ Arcane , Blist , BotListSpace , BotsDataBase , BotsForDiscord , BotsOnDiscord , Carbon ,
1949
2041
DBLista , DiscordBotsGG , DiscordAppsDev , DiscordBoats ,
1950
2042
DiscordBotList , DiscordBotWorld , DiscordExtremeList , GlennBotList ,
1951
2043
LBots , ListMyBots , MythicalBots , SpaceBotsList , TopGG , WonderBotList , YABL
0 commit comments