Skip to content

Commit

Permalink
update made to the warn command for users who have left the server be…
Browse files Browse the repository at this point in the history
…fore they can be warned
  • Loading branch information
Ascensionn committed Nov 30, 2024
1 parent a970ecd commit eef6a42
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions redbot/cogs/warnings/warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,17 +416,18 @@ async def warn(
return

if member == ctx.author:
return await ctx.send("You cannot warn yourself.")
return await ctx.send(_("You cannot warn yourself."))
if member.bot:
return await ctx.send("You cannot warn other bots.")
return await ctx.send(_("You cannot warn other bots."))
if member == ctx.guild.owner:
return await ctx.send("You cannot warn the server owner.")
return await ctx.send(_("You cannot warn the server owner."))
if member.top_role >= ctx.author.top_role and ctx.author != ctx.guild.owner:
return await ctx.send(
"The person you're trying to warn is equal or higher than you in the Discord hierarchy, you cannot warn them."
_(
"The person you're trying to warn is equal or higher than you in the discord hierarchy, you cannot warn them."
)
)

await ctx.send(f"User `{member}` has been warned for: {reason}")
guild_settings = await self.config.guild(ctx.guild).all()
custom_allowed = guild_settings["allow_custom_reasons"]
reason_type = None
Expand Down

0 comments on commit eef6a42

Please sign in to comment.