Closed SkyTheCodeMaster closed 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.
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.
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
?
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.
This adds an
on_raw_reaction_add
event that:await message.delete()
on the message, leading to it's deletion. This is a good change because it will allow people to delete the output of things like%eval
without requiring staff assistance, which will declutter chats like #computercraft.