Discord Bot Python Delete User Message After Executed

0

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!".

Oliver J

Posted 2018-05-10T01:51:38.823

Reputation: 19

Question was closed 2018-05-11T05:30:36.717

Answers

1

Okay, so what you got to do is at the end of your code block, add the following:

await client.delete_message(message)

This should delete the 'authors' message after the bot has executed the command.

Oliver J

Posted 2018-05-10T01:51:38.823

Reputation: 19