diff options
author | 2023-04-06 13:29:21 +0530 | |
---|---|---|
committer | 2023-04-06 13:32:42 +0530 | |
commit | 9f894831e33bb12eae2675484d40272ee85fee0c (patch) | |
tree | d3b2dcd97e8934f0c6d406fa239dd3994a7641c3 | |
parent | Bump sentry-sdk from 1.17.0 to 1.18.0 (#2497) (diff) |
Include jump URL in mod log embed for infraction edits
-rw-r--r-- | bot/exts/moderation/infraction/_scheduler.py | 3 | ||||
-rw-r--r-- | bot/exts/moderation/infraction/management.py | 12 |
2 files changed, 12 insertions, 3 deletions
diff --git a/bot/exts/moderation/infraction/_scheduler.py b/bot/exts/moderation/infraction/_scheduler.py index a8af33dee..78f140e28 100644 --- a/bot/exts/moderation/infraction/_scheduler.py +++ b/bot/exts/moderation/infraction/_scheduler.py @@ -263,8 +263,7 @@ class InfractionScheduler: await ctx.send(f"{dm_result}{confirm_msg}{infr_message}.", allowed_mentions=mentions) if jump_url is None: - # Infraction issued in ModMail category. - jump_url = "N/A" + jump_url = "(Infraction issued in a ModMail channel.)" else: jump_url = f"[Click here.]({jump_url})" diff --git a/bot/exts/moderation/infraction/management.py b/bot/exts/moderation/infraction/management.py index aafa6d9b0..83390d76c 100644 --- a/bot/exts/moderation/infraction/management.py +++ b/bot/exts/moderation/infraction/management.py @@ -10,6 +10,7 @@ from discord.utils import escape_markdown from bot import constants from bot.bot import Bot +from bot.constants import Categories from bot.converters import DurationOrExpiry, Infraction, MemberOrUser, Snowflake, UnambiguousUser from bot.decorators import ensure_future_timestamp from bot.errors import InvalidInfraction @@ -19,7 +20,7 @@ from bot.exts.moderation.modlog import ModLog from bot.log import get_logger from bot.pagination import LinePaginator from bot.utils import messages, time -from bot.utils.channel import is_mod_channel +from bot.utils.channel import is_in_category, is_mod_channel from bot.utils.members import get_or_fetch_member from bot.utils.time import unpack_duration @@ -228,6 +229,14 @@ class ModManagement(commands.Cog): user_text = f"<@{user_id}>" thumbnail = None + if any( + is_in_category(ctx.channel, category) + for category in (Categories.modmail, Categories.appeals, Categories.appeals_2) + ): + jump_url = "(Infraction edited in a ModMail channel.)" + else: + jump_url = f"[Click here.]({ctx.message.jump_url})" + await self.mod_log.send_log_message( icon_url=constants.Icons.pencil, colour=discord.Colour.og_blurple(), @@ -237,6 +246,7 @@ class ModManagement(commands.Cog): Member: {user_text} Actor: <@{new_infraction['actor']}> Edited by: {ctx.message.author.mention}{log_text} + Jump URL: {jump_url} """), footer=f"ID: {infraction_id}" ) |