bot.py 文件源码

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

项目:ModTools 作者: MattBSG 项目源码 文件源码
def cmd_modlog(self, message, author, server, option, new_id=None, reason=None):
        """
        Usage: {command_prefix}modlog [set | + | - | true | false | yes | no | y | n] <new channel ID> ["reason"]
        If the first choice is set, it will change the mod log to the provided channel
        If the first choice is anything else, it'll toggle whether the modlog is used or not!
        "+, true, yes, y" will enable it and "-, false, no, n" will disable it
        """
        if await self.has_roles(message.channel, author, server, command='modlog'):
            if option not in ['set', '+', '-', 'true', 'false', 'yes', 'no', 'y', 'n']:
                raise CommandError(
                        'Invalid option "%s" specified, use +, -, true, false, yes, no, set, y or n' % option)
            if option in ['set']:
                try:
                    channel = discord.utils.get(server.channels, id=new_id)
                    if not channel:
                        int('this')
                except:
                    raise CommandError('Invalid Channel ID: {}'.format(new_id))
                self.server_index[server.id][8] = channel.id
            elif option in ['+', 'true', 'yes', 'y']:
                self.server_index[server.id][10][0] = True
            else:
                self.server_index[server.id][10][0] = False
            await self.write_to_modlog(message, author, server, reason)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号