mod.py 文件源码

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

项目:jose 作者: lnmds 项目源码 文件源码
def edit_mod_entry(self, modcfg, data):
        """Edit a moderation entry."""
        modlog = data['guild'].get_channel(modcfg['mod_log_id'])
        if modlog is None:
            raise self.SayException('Moderation channel not found')

        try:
            action_data = self.cache[data['action_id']]
        except KeyError:
            raise self.SayException("Can't find action ID in cache, sorry :c")

        old_data = action_data['data']
        old_data['reason'] = data['reason']

        try:
            message = await modlog.get_message(action_data['message_id'])
        except discord.NotFound:
            raise self.SayException('Message to edit not found')
        except discord.Forbidden:
            raise self.SayException("Can't read messages")
        except discord.HTTPException as err:
            raise self.SayException(f'fug `{err!r}`')

        await message.edit(content=self.modlog_fmt(old_data))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号