mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-22 10:47:58 -05:00
[Core] Prevent users from locking out themselves or guild owner with localblacklist (#3221)
* Update core_commands.py * Update core_commands.py * Create 3207.bugfix.rst * Update core_commands.py * Create 3221.bugfix.rst * Update redbot/core/core_commands.py Co-Authored-By: Michael H <michael@michaelhall.tech> * Update bot.py * Rename 3221.bugfix.rst to 3221.bugfix.1.rst * Create 3221.bugfix.2.rst * Update bot.py Co-authored-by: Michael H <michael@michaelhall.tech>
This commit is contained in:
@@ -1915,9 +1915,16 @@ class Core(commands.Cog, CoreLogic):
|
||||
user_or_role = discord.Object(id=user_or_role)
|
||||
user = True
|
||||
|
||||
if user and await ctx.bot.is_owner(user_or_role):
|
||||
await ctx.send(_("You cannot blacklist an owner!"))
|
||||
return
|
||||
if user:
|
||||
if user_or_role.id == ctx.author.id:
|
||||
await ctx.send(_("You cannot blacklist yourself!"))
|
||||
return
|
||||
if user_or_role.id == ctx.guild.owner_id and not await ctx.bot.is_owner(ctx.author):
|
||||
await ctx.send(_("You cannot blacklist the guild owner!"))
|
||||
return
|
||||
if await ctx.bot.is_owner(user_or_role):
|
||||
await ctx.send(_("You cannot blacklist a bot owner!"))
|
||||
return
|
||||
|
||||
async with ctx.bot._config.guild(ctx.guild).blacklist() as curr_list:
|
||||
if user_or_role.id not in curr_list:
|
||||
|
||||
Reference in New Issue
Block a user