bot.py 文件源码

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

项目:ModTools 作者: MattBSG 项目源码 文件源码
def _write_to_modlog(self, autoaction, offender, server, reason, channel=None):
        self.action_dict['actions_taken'] += 1
        await self.user_index_check(offender)
        self.user_dict[offender.id]['actions_taken_against'] += 1
        if server.id in self.server_index:
            config = self.server_index[server.id]
        else:
            return
        if not config[8] or not config[10][0]:
            return
        if not reason:
            reason = "*No reason was specified*"
        if not channel:
            await self.safe_send_message(discord.Object(id=config[8]), 'At `{}` UTC, I automatically took action against **{}** due to {}.\n**Action:** __{}__.'
                                                                       ''.format(
                    datetime.utcnow().strftime("%H:%M:%S on %a %b %d"), clean_string(offender.name), autoaction,
                    reason))
        else:
            await self.safe_send_message(discord.Object(id=config[8]),
                                         'At `{}` UTC, I automatically took action against **{}** in <#{}> due to {}. \n**Action:** __{}__'
                                         ''.format(datetime.utcnow().strftime("%H:%M:%S on %a %b %d"),
                                                   clean_string(offender.name), channel.id, reason, autoaction), server=server)

    # TODO: Make this code that is mine, not stuff taken from code written by @Sharpwaves
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号