def update_discordlist(self):
if not discordlist_token:
self.logger.warning('Tried to contact DiscordList, but no token set!')
return False
data = {
'token': discordlist_token,
'guilds': len(self.bot.guilds)
}
dest = 'https://bots.discordlist.net/api'
headers = {'Content-Type': 'application/json'}
with async_timeout.timeout(6):
async with self.bot.cog_http.post(dest, data=json.dumps(data), headers=headers) as r:
resp_key = f'(got {r.status} {r.reason})'
if r.status == 200:
self.logger.info('Successfully sent DiscordList our guild count! (got 200 OK)')
else:
self.logger.warning('Failed sending our guild count to DiscordList! ' + resp_key)
评论列表
文章目录