cog_mod.py 文件源码

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

项目:Godavaru 作者: Godavaru 项目源码 文件源码
def unban(self, ctx):
        """Unban a user by their ID.

        **Usage:** `g_unban <user>`

        **Permission:** BAN_MEMBERS"""
        if ctx.message.guild.me.guild_permissions.ban_members == True:
            if ctx.message.author.guild_permissions.ban_members == True:
                try:
                    umsg = ctx.message.content
                    args = umsg.split(' ')
                    uid = int(args[1])
                    try:
                        member = await self.bot.get_user_info(uid)
                    except discord.NotFound:
                        await ctx.send("I didn't find that user.")
                    else:
                        await self.bot.unban(ctx.message.guild, member)
                        await ctx.send(":white_check_mark: unbanned "+str(member))
                except ValueError:
                    await ctx.send("That is not an ID.")
                except IndexError:
                    await ctx.send("Usage: `{}unban <user id>`".format(self.bot.command_prefix))
            else:
                await ctx.send("You can't manage bans.")
        else:
            await ctx.send("I can't manage bans.")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号