goldbot.py 文件源码

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

项目:goldmine 作者: Armored-Dragon 项目源码 文件源码
def on_guild_join(self, guild):
        """Send the bot introduction message when invited."""
        self.logger.info('New guild: ' + guild.name)
        if self.selfbot: return
        try:
            await self.send_message(guild.default_channel, join_msg)
        except discord.Forbidden:
            satisfied = False
            c_count = 0
            try_channels = list(guild.channels)
            channel_count = len(try_channels) - 1
            while not satisfied:
                with suppress(discord.Forbidden, discord.HTTPException):
                    await self.send_message(try_channels[c_count], join_msg)
                    satisfied = True
                if c_count > channel_count:
                    self.logger.warning('Couldn\'t announce join to guild ' + guild.name)
                    satisfied = True
                c_count += 1
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号