Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show preview of offending message in automod logs #71

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

wigglyworm91
Copy link

This would let us more easily look for false positive detections instead of having to search each user individually

Message content is protected with a spoiler tag and hopefully defanged using !i (seems to enclose in backticks)

image

@@ -273,7 +273,7 @@ async def process_messages(msgs: Iterable[Message]) -> None:
if any(role.id in exempt_roles for role in msg.author.roles):
continue
if (rule := active_rules.get(index)) is not None:
reason = "Automatic action: message matches pattern {}".format(index)
reason = format("Automatic action: message matches pattern {}\n||{!i}||", index, msg.content)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include some safeguard against the reason becoming too long to fit in various places. E.g. use match information in match to select a substring around the match.

@wigglyworm91
Copy link
Author

I didn't notice this comment 💀

I've added a length limit of 128, with ellipses app/prepended if it needed to take a subset of the message. It seems to work properly:

Screenshot 2024-09-29 at 10 49 56 AM Screenshot 2024-09-29 at 10 45 12 AM Screenshot 2024-09-29 at 10 45 07 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants