bot.py 文件源码

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

项目:ModTools 作者: MattBSG 项目源码 文件源码
def cmd_unban(self, message, author, server, leftover_args):
        """
        Usage: {command_prefix}unban [id] ["reason"]
        Unbans the user(s) from the server, accepts a list of user ids with spaces between each
        """
        if await self.has_roles(message.channel, author, server, command='unban'):
            reason = None
            if not leftover_args:
                raise CommandError('Usage: {command_prefix}unban [id] ["reason"]\nForces the ID to be banned from a server')
            try:
                int(leftover_args[-1])
            except:
                try:
                    reason = leftover_args[-1]
                    del leftover_args[-1]
                except TypeError:
                    raise CommandError('Please use a **USER ID** when using this command and not a name')
            for id in leftover_args:
                await self.unban(server, discord.Object(id=id))
            await self.write_to_modlog(message, author, server, reason)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号