Erisa/Cliptok

Todo: Run autowarn filters on Automod-blocked messages

Closed this issue · 1 comments

So say for example you have two lists, one in Cliptok and one in Discord Automod, your Automod list is designed to be less of a big deal than the autowarn list because it does not warn and simply prevents the message from being sent. If a user then sends a message matching both of these filters, the message will be blocked and not evaluated by the autowarn system. This is not ideal. The most severe punishment should be enacted regardless of whether the message was blocked or whether it was auto-deleted.

One way to solve this would be to integrate Cliptok into the Automod system entirely, by having it manage the lists and hook into Automod events to deliver warnings. Then no bad messages are sent at all, rejoice!

But that's too complicated, so we only need to do half of it for now: have Cliptok trigger on Automod-blocked messages as if they were the original message.

You would, in theory:

  • Listen for Automod events.
    • Specifically message block events. Don't bother with message alerts (you will get the message event anyway) or username quarantines (these take care of themselves, no need for more punishment)
  • From the event data, identify the user, channel and message content.
  • Handle all the autowarn actions (i.e. ignore passive lists) in the Message Event that would normally trigger.
  • If a warning or response is warranted, respond in the channel where the blocked message was attempted to be sent, and contact the user whose message was blocked.

The reason to avoid passive lists is to prevent duplicate alerts between what automod is posting in #investigations and what the passive list would post in the suspicious msgs feed. If we're not adding value (warning the user) then there is no need to take any action on the event.

I suspect the event is AutoModerationRuleExecuted however I have not looked into how to use it. Amusingly even if that event did not work you could hack this together using the message event for the automod alert since it has a backwards-compatible Discord embed containing all the event data and a unique message type. I don't recommend it though.

The arguments for the event seem to have everything needed: https://dsharpplus.github.io/DSharpPlus/api/DSharpPlus.Entities.DiscordAutoModerationActionExecution.html

Since the message event takes a DiscordMessage we would either want to create a fake message and pass a param to ignore the passive filters, or pull the filters out into a separate function that doesn't rely on a message ID (requires a lot of refactoring).

Remember to include the built-in filters like invites, mass emoji, etc. anything that can give a warning.