Erisa / Cliptok

Moderation Discord bot for Microsoft Community.
https://msft.chat/about/bots.html#cliptok
MIT License
63 stars 26 forks source link

Fix conflict between automatic empty thread delete & auto-warn #230

Closed FloatingMilkshake closed 2 months ago

FloatingMilkshake commented 2 months ago

This PR closes #223.

If a user opens a forum thread and their original message contains content that Cliptok would issue an automatic warning for, it will delete the thread and send the warning to the configured fallback channel*. This bypasses the existing empty thread auto-delete logic, because we do not delete the message before deleting the thread—therefore we no longer have a conflict between the auto-warn and thread auto-delete logic. The infringing message is logged to the typical mod log channels when the warning is issued, so it's not a concern that the individual message isn't logged to message log channels like it would typically be when deleted.

Since this does not target any specific forum channels and instead only compares types (DiscordChannelType.GuildForum), it applies to any forum channel—#tech-support-forum, #feedback-hub-forum, etc!

*If no fallback channel is configured, Cliptok will still attempt to send into the thread, but will probably fail. It will also log a warning suggesting that you configure a fallback channel.

FloatingMilkshake commented 2 months ago

I considered using something like minMessages—not sure why I decided against it. So there it is :P