Skip to content

Commit f066b32

Browse files
LunaNiermannfourjr
authored andcommitted
Added Moderator to blocking reason (#349)
Co-Authored-By: Jia Rong Yee <[email protected]>
1 parent 91c7418 commit f066b32

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cogs/modmail.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,8 @@ async def block(
10121012

10131013
mention = getattr(user, "mention", f"`{user.id}`")
10141014

1015+
moderator = ctx.author.name
1016+
10151017
if str(user.id) in self.bot.blocked_whitelisted_users:
10161018
embed = discord.Embed(
10171019
title="Error",
@@ -1021,18 +1023,18 @@ async def block(
10211023
return await ctx.send(embed=embed)
10221024

10231025
if after is not None:
1024-
reason = after.arg
1026+
reason = f"{after.arg} by {moderator}"
10251027
if reason.startswith("System Message: "):
10261028
raise commands.BadArgument(
10271029
"The reason cannot start with `System Message:`."
10281030
)
10291031
if "%" in reason:
10301032
raise commands.BadArgument('The reason contains illegal character "%".')
10311033
if after.dt > after.now:
1032-
reason = f"{reason} %{after.dt.isoformat()}%"
1034+
reason = f"{reason} %{after.dt.isoformat()}% by {moderator}"
10331035

10341036
if not reason:
1035-
reason = None
1037+
reason = f"Blocked by {moderator}"
10361038

10371039
extend = f" for `{reason}`" if reason is not None else ""
10381040
msg = self.bot.blocked_users.get(str(user.id))
@@ -1046,7 +1048,7 @@ async def block(
10461048
):
10471049
if str(user.id) in self.bot.blocked_users:
10481050

1049-
old_reason = msg.strip().rstrip(".") or "no reason"
1051+
old_reason = msg.strip().rstrip(".") or f"Blocked by {moderator}"
10501052
embed = discord.Embed(
10511053
title="Success",
10521054
description=f"{mention} was previously blocked for "

0 commit comments

Comments
 (0)