aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar vivekashok1221 <[email protected]>2023-03-10 23:28:13 +0530
committerGravatar vivekashok1221 <[email protected]>2023-03-10 23:28:13 +0530
commit0cc7fa30ca30c756c64c05d081ddb927dcbe19c2 (patch)
tree5d68c708312f01710124a16095d250d267296d09
parentFormat jump url bot-side (diff)
Display "N/A" for infractions in ModMail
Previously displayed "Infraction issued in modmail" for infractions in ModMail.
-rw-r--r--bot/exts/moderation/infraction/_scheduler.py6
-rw-r--r--bot/exts/moderation/infraction/_utils.py2
-rw-r--r--bot/exts/moderation/infraction/management.py8
3 files changed, 9 insertions, 7 deletions
diff --git a/bot/exts/moderation/infraction/_scheduler.py b/bot/exts/moderation/infraction/_scheduler.py
index de1ec398e..63aac6340 100644
--- a/bot/exts/moderation/infraction/_scheduler.py
+++ b/bot/exts/moderation/infraction/_scheduler.py
@@ -262,9 +262,11 @@ class InfractionScheduler:
mentions = discord.AllowedMentions(users=[user], roles=False)
await ctx.send(f"{dm_result}{confirm_msg}{infr_message}.", allowed_mentions=mentions)
- if "discord.com" in jump_url:
+ if jump_url is None:
+ # Infraction issued in ModMail category.
+ jump_url = "N/A"
+ else:
jump_url = f"[Click here.]({jump_url})"
- # Else, infraction was issued in ModMail category.
# Send a log message to the mod log.
# Don't use ctx.message.author for the actor; antispam only patches ctx.author.
diff --git a/bot/exts/moderation/infraction/_utils.py b/bot/exts/moderation/infraction/_utils.py
index 12c8f0614..edd875921 100644
--- a/bot/exts/moderation/infraction/_utils.py
+++ b/bot/exts/moderation/infraction/_utils.py
@@ -99,7 +99,7 @@ async def post_infraction(
is_in_category(ctx.channel, category)
for category in (Categories.modmail, Categories.appeals, Categories.appeals2)
):
- jump_url = "Infraction issued in a ModMail channel."
+ jump_url = None
else:
jump_url = ctx.message.jump_url
diff --git a/bot/exts/moderation/infraction/management.py b/bot/exts/moderation/infraction/management.py
index 78778048e..aafa6d9b0 100644
--- a/bot/exts/moderation/infraction/management.py
+++ b/bot/exts/moderation/infraction/management.py
@@ -421,12 +421,12 @@ class ModManagement(commands.Cog):
else:
dm_sent_text = "Yes" if dm_sent else "No"
- if jump_url == "":
- # Infraction was issued prior to jump urls being stored in the database.
+ if jump_url is None:
+ # Infraction was issued prior to jump urls being stored in the database
+ # or infraction was issued in ModMail category.
jump_url = "N/A"
- elif "discord.com" in jump_url:
+ else:
jump_url = f"[Click here.]({jump_url})"
- # Else, infraction was issued in ModMail category.
lines = textwrap.dedent(f"""
{"**===============**" if active else "==============="}