aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/moderation/modlog.py
diff options
context:
space:
mode:
Diffstat (limited to 'bot/exts/moderation/modlog.py')
-rw-r--r--bot/exts/moderation/modlog.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/bot/exts/moderation/modlog.py b/bot/exts/moderation/modlog.py
index 2dae9d268..be65ade6e 100644
--- a/bot/exts/moderation/modlog.py
+++ b/bot/exts/moderation/modlog.py
@@ -12,9 +12,10 @@ from deepdiff import DeepDiff
from discord import Colour
from discord.abc import GuildChannel
from discord.ext.commands import Cog, Context
+from discord.utils import escape_markdown
from bot.bot import Bot
-from bot.constants import Categories, Channels, Colours, Emojis, Event, Guild as GuildConstant, Icons, URLs
+from bot.constants import Categories, Channels, Colours, Emojis, Event, Guild as GuildConstant, Icons, Roles, URLs
from bot.utils.messages import format_user
from bot.utils.time import humanize_delta
@@ -115,9 +116,9 @@ class ModLog(Cog, name="ModLog"):
if ping_everyone:
if content:
- content = f"@everyone\n{content}"
+ content = f"<@&{Roles.moderators}>\n{content}"
else:
- content = "@everyone"
+ content = f"<@&{Roles.moderators}>"
# Truncate content to 2000 characters and append an ellipsis.
if content and len(content) > 2000:
@@ -127,8 +128,7 @@ class ModLog(Cog, name="ModLog"):
log_message = await channel.send(
content=content,
embed=embed,
- files=files,
- allowed_mentions=discord.AllowedMentions(everyone=True)
+ files=files
)
if additional_embeds:
@@ -641,9 +641,10 @@ class ModLog(Cog, name="ModLog"):
channel = msg_before.channel
channel_name = f"{channel.category}/#{channel.name}" if channel.category else f"#{channel.name}"
+ cleaned_contents = (escape_markdown(msg.clean_content).split() for msg in (msg_before, msg_after))
# Getting the difference per words and group them by type - add, remove, same
# Note that this is intended grouping without sorting
- diff = difflib.ndiff(msg_before.clean_content.split(), msg_after.clean_content.split())
+ diff = difflib.ndiff(*cleaned_contents)
diff_groups = tuple(
(diff_type, tuple(s[2:] for s in diff_words))
for diff_type, diff_words in itertools.groupby(diff, key=lambda s: s[0])