discord_bots.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:goldmine 作者: Armored-Dragon 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号