discord_bots.py 文件源码

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

项目:goldmine 作者: Armored-Dragon 项目源码 文件源码
def update_dbots(self):
        if not discord_bots_token:
            self.logger.warning('Tried to contact Discord Bots, but no token set!')
            return False
        data = dict(guild_count=len(self.bot.guilds))
        dest = 'https://bots.discord.pw/api/bots/' + str(self.bot.user.id) + '/stats'
        headers = {
            'Authorization': discord_bots_token,
            '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 Discord Bots our guild count (got 200 OK)')
                else:
                    self.logger.warning('Failed sending our guild count to Discord Bots! ' + resp_key)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号