Skip to content

Commit

Permalink
implemented warning by UserID
Browse files Browse the repository at this point in the history
  • Loading branch information
Ascensionn committed Nov 20, 2024
1 parent 30058c0 commit b4cfaa2
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion redbot/cogs/warnings/warnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ async def actionlist(self, ctx: commands.Context):
async def warn(
self,
ctx: commands.Context,
member: discord.Member,
identifier: str,
points: UserInputOptional[int] = 1,
*,
reason: str,
Expand All @@ -386,6 +386,19 @@ async def warn(
or a custom reason if ``[p]warningset allowcustomreasons`` is set.
"""
guild = ctx.guild

"""User can be warned by ID or warned by their name."""
if identifier.isdigit():
member = ctx.guild.get_member(int(identifier))
# await ctx.send("Got member by ID")
else:
member = ctx.guild.get_member_named(identifier)
# await ctx.send("Got member by name")

if not member:
await ctx.send(f"User `{identifier}` not found.")
return

if member == ctx.author:
return await ctx.send(_("You cannot warn yourself."))
if member.bot:
Expand Down

0 comments on commit b4cfaa2

Please sign in to comment.