How can I use the disnake library to write code (Discord bot) that deletes a message when a user with a special role (e.g. admin) reacts to the message?
Asked
Active
Viewed 82 times
-1
-
Please provide enough code so others can better understand or reproduce the problem. – Community May 17 '23 at 06:21
1 Answers
1
You'll want the bot to use the event on_reaction_add
to listen for reactions.
Then check if str(Reaction.emoji) == wrench
and if Reaction.user.roles.contains(<ADMIN ROLE>)
.
The admin role can be found with get_role(<ROLE ID>)
and the role ID can be found by sending the message \@role_name
(usually \@Admin
)in the discord server.
If both of those conditions are met, you'll want to run await Reaction.message.delete()
.
While I didn't post a working example, I hope this is helpful in giving you an idea of how such a task would be accomplished.

SanguineL
- 1,189
- 1
- 7
- 18