mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-03 00:25:14 +00:00
Add the ability to delete messages
This commit is contained in:
@ -9,6 +9,12 @@ def on_ready():
|
||||
print('Username: ' + client.user.name)
|
||||
print('ID: ' + client.user.id)
|
||||
|
||||
@client.event
|
||||
def on_message(message):
|
||||
if message.content.startswith('!deleteme'):
|
||||
msg = client.send_message(message.channel, 'I will delete myself now...')
|
||||
client.delete_message(msg)
|
||||
|
||||
@client.event
|
||||
def on_message_delete(message):
|
||||
client.send_message(message.channel, '{} has deleted the message:\n{}'.format(message.author.name, message.content))
|
||||
|
Reference in New Issue
Block a user