admin.py 文件源码

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

项目:Asurix-bot 作者: Beafantles 项目源码 文件源码
def send_log(self, server: discord.Server, log: Log):
        """Sends a embed corresponding to the log in the log channel of the server"""
        if server.id in self.servers_config["servers"]:
            if "log channel" in self.servers_config["servers"][server.id]:
                embed = log.get_embed(self.bot)
                channel = self.servers_config["servers"][server.id]["log channel"]
                try:
                    await self.bot.send_message(destination=channel, embed=embed)
                except discord.Forbidden:
                    await self.bot.send_message(destination=server.owner, content=\
                        "I'm not allowed to send embeds in the log channel (#" + \
                        channel.name + "). Please change my permissions.")
                except discord.NotFound:
                    await self.bot.send_message(destination=server.owner, content=\
                        "I'm not allowed to send embeds in the log channel because " + \
                        "it doesn't exists anymore. Please set another log channel " + \
                        "using the `[p]set_log_channel` command.")
                except discord.HTTPException:
                    pass
                except discord.InvalidArgument:
                    pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号