def hackban(self, ctx, user_id: int):
"""Bans a user outside of the server."""
author = ctx.message.author
guild = author.guild
user = guild.get_member(user_id)
if user is not None:
return await ctx.invoke(self.ban, user=user)
try:
await self.bot.http.ban(user_id, guild.id, 0)
await ctx.message.edit(content=self.bot.bot_prefix + 'Banned user: %s' % user_id)
except discord.NotFound:
await ctx.message.edit(content=self.bot.bot_prefix + 'Could not find user. '
'Invalid user ID was provided.')
except discord.errors.Forbidden:
await ctx.message.edit(content=self.bot.bot_prefix + 'Could not ban user. Not enough permissions.')
评论列表
文章目录