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"""
|
using this command"""
|
||||||
author = ctx.author
|
author = ctx.author
|
||||||
guild = ctx.guild
|
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
|
is_banned = False
|
||||||
ban_list = await guild.bans()
|
ban_list = await guild.bans()
|
||||||
for entry in ban_list:
|
for entry in ban_list:
|
||||||
@ -449,8 +450,10 @@ class Mod:
|
|||||||
return
|
return
|
||||||
|
|
||||||
user = guild.get_member(user_id)
|
user = guild.get_member(user_id)
|
||||||
if user is None:
|
if user is not None:
|
||||||
user = discord.Object(id=user_id) # User not in the guild, but
|
# 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)
|
audit_reason = get_audit_reason(author, reason)
|
||||||
queue_entry = (guild.id, user_id)
|
queue_entry = (guild.id, user_id)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user