mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 03:08:55 -05:00
Hackban fixes (#2128)
If the member is in the guild, delegates to existing ban logic. Additionally, check that we have ban perms prior to attempting to fetch the existing ban list. Fixes #2127.
This commit is contained in:
parent
415385b747
commit
404800c556
@ -436,7 +436,8 @@ class Mod:
|
||||
using this command"""
|
||||
author = ctx.author
|
||||
guild = ctx.guild
|
||||
|
||||
if not guild.me.guild_permissions.ban_members:
|
||||
return await ctx.send(_("I lack the permissions to do this."))
|
||||
is_banned = False
|
||||
ban_list = await guild.bans()
|
||||
for entry in ban_list:
|
||||
@ -449,8 +450,10 @@ class Mod:
|
||||
return
|
||||
|
||||
user = guild.get_member(user_id)
|
||||
if user is None:
|
||||
user = discord.Object(id=user_id) # User not in the guild, but
|
||||
if user is not None:
|
||||
# Instead of replicating all that handling... gets attr from decorator
|
||||
return await ctx.invoke(self.ban, user, None, reason=reason)
|
||||
user = discord.Object(id=user_id) # User not in the guild, but
|
||||
|
||||
audit_reason = get_audit_reason(author, reason)
|
||||
queue_entry = (guild.id, user_id)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user