SquidDev-CC / FAQBot-CC

A Discord bot for answering frequently asked questions regarding CC.
MIT License
7 stars 11 forks source link

Allow deletion of bot messages by reacting with :wastebasket: #35

Closed SkyTheCodeMaster closed 3 years ago

SkyTheCodeMaster commented 3 years ago

This adds an on_raw_reaction_add event that:

SkyTheCodeMaster commented 3 years ago

If someone wants this limited to only %eval output, you could add if message.attachments: to the check for deletion. Empty lists (no attachments) are falsey in Python, so it would not let the message be deleted.

Wojbie commented 3 years ago

It probably should only be limited to only if original %eval caller or moderator reacts with 🗑️

EDIT: Or if like 5 unique people reacted with 🗑️ too. So other people could trigger it via mini-agreement.

SkyTheCodeMaster commented 3 years ago

The bot replies to the original message, so it should be possible to have it only be with the original caller, check something like payload.user == message.reference.resolved.author? Then also do a check if a person reacting has a role named "Moderator", or a specific permission, like Manage Messages?

SkyTheCodeMaster commented 3 years ago

The reason I originally had it as on_raw_reaction_add is because when programming my own bot, I found that without the raw event, it only retrieved reactions on messages that were sent after the bot started, whereas the raw event received reactions from messages before the bot started.