Forum Archive

Deleting Bot messages after the command message has been deleted in discord.py

xinitrc

The idea is simple: we have a bot in discord, which, say, sends "Cats are cool!" message after someone types ".cats". Now, If the person deletes that message, I want bot to also delete his message but only the one that was a response to this command.

I couldn't find a way to implement is. I know there is a function on_message_delete but how do I check if that message is an active command and how do I link it with bot's message?

P.S.: In the given example checking if it is a command is simple but what if I have multiple prefixes? Say ".cats" and "?cats" would do the same thing? Also what about command groups, such as ".catpics list", ".catpics print"?

dgelessus

I'm afraid you probably won't get many helpful responses here, because discord.py has nothing to do with Pythonista, and because Pythonista isn't the best platform to run a Discord bot on. You'll probably get more help if you ask on a site like Stack Overflow, or on a discussion site for discord.py. Maybe there is a Discord server for discord.py. :)