aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorRapptz <[email protected]>2015-08-21 20:56:40 -0400
committerRapptz <[email protected]>2015-08-21 20:58:51 -0400
commit794991adb6bfa6d66b2b977b1d2a6dcb639398d0 (patch)
treecc317ab012a3a9949be759f7042387c043c93d4f /examples
parentReturn the message created when calling send_message (diff)
downloaddiscord.py-794991adb6bfa6d66b2b977b1d2a6dcb639398d0.tar.xz
discord.py-794991adb6bfa6d66b2b977b1d2a6dcb639398d0.zip
Add the ability to delete messages
Diffstat (limited to 'examples')
-rw-r--r--examples/deleted.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/deleted.py b/examples/deleted.py
index 61161013..7f77e9c3 100644
--- a/examples/deleted.py
+++ b/examples/deleted.py
@@ -10,6 +10,12 @@ def on_ready():
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)
+
def on_message_delete(message):
client.send_message(message.channel, '{} has deleted the message:\n{}'.format(message.author.name, message.content))