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.")
评论列表
文章目录