Discord Bot Python Delete User Message After Executed [closed]
How would I set up my commands so it would delete the author's message after the Discord Bot executed the command? For example:
#This is for the 'Ping' command.
if message.content.upper().startswith('!PING'):
userID = message.author.id
await client.send_message(message.channel, "<@%s> Pong!" % (userID))This command is simple, you type !ping and the bot returned with "@mention Pong!". I want to delete the !ping sent by the user right after the bot sends out "@mention Pong!".
1 Answer
Okay, so all you have to do is add the following to the end of your code block:
await client.delete_message(message)This should delete the 'authors' message after the bot has executed the command.