Erisa / Cliptok

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

Automatically delete automatic warning messages #193

Closed FloatingMilkshake closed 4 months ago

FloatingMilkshake commented 4 months ago

This PR closes #192.

Adds the ability to have Cliptok automatically delete the public chat messages for automatic warnings after a set number of days (autoWarnMsgAutoDeleteDays in config.json). Currently set to 3 and can be set to 0 to disable.

Only the public chat message for the warning is deleted—private logs, and the warning itself, aren't touched.

With this change, in addition to how they are typically stored, automatic warnings are stored in the db under a new automaticWarnings hash so that the entire list of warnings doesn't have to be enumerated during each check.