modlog.py 文件源码

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

项目:dogbot 作者: slice 项目源码 文件源码
def on_message_edit(self, before: discord.Message, after: discord.Message):
        # if message author was a bot, or the embeds were added by discord, bail
        if before.author.bot or before.content == after.content:
            return

        # if this channel isn't publicly visible or we aren't tracking edits, bail
        if (not await is_publicly_visible(self.bot, before.channel) or
                await self.bot.config_is_set(before.guild, 'modlog_notrack_edits')):
            return

        # truncate :blobsweats:
        m_before = utils.prevent_codeblock_breakout(utils.truncate(before.content, 900))
        m_after = utils.prevent_codeblock_breakout(utils.truncate(after.content, 900))

        # format
        fmt = (f'\N{MEMO} Message by {describe(before.author)} in {describe(before.channel, mention=True)} edited: '
               f'```\n{m_before}\n``` to ```\n{m_after}\n```')
        await self.log(before.guild, fmt)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号