aboutsummaryrefslogtreecommitdiff
path: root/examples/edits.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2015-12-06 03:05:50 -0500
committerRapptz <[email protected]>2015-12-06 03:10:18 -0500
commite87d54dd12c2a655e6e075abd8e2d03ce3b6d059 (patch)
treeabb8657ecc8f57b64159dc17a282f0a8c1cdb9b1 /examples/edits.py
parentForced keyword argument for allow/deny in edit_channel_permissions (diff)
downloaddiscord.py-e87d54dd12c2a655e6e075abd8e2d03ce3b6d059.tar.xz
discord.py-e87d54dd12c2a655e6e075abd8e2d03ce3b6d059.zip
Update example code.
Diffstat (limited to 'examples/edits.py')
-rw-r--r--examples/edits.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/examples/edits.py b/examples/edits.py
index e8233bbb..3767b933 100644
--- a/examples/edits.py
+++ b/examples/edits.py
@@ -1,24 +1,24 @@
import discord
-import time
+import asyncio
client = discord.Client()
-client.login('email', 'password')
def on_ready():
print('Connected!')
print('Username: ' + client.user.name)
print('ID: ' + client.user.id)
def on_message(message):
if message.content.startswith('!editme'):
- msg = client.send_message(message.author, '10')
- time.sleep(3)
- client.edit_message(msg, '40')
+ msg = yield from client.send_message(message.author, '10')
+ yield from asyncio.sleep(3)
+ yield from client.edit_message(msg, '40')
def on_message_edit(before, after):
- client.send_message(after.channel, '**{}** edited their message:\n{}'.format(after.author.name, before.content))
+ fmt = '**{0.author}** edited their message:\n{1.content}'
+ yield from client.send_message(after.channel, fmt.format(after, before))
-client.run()
+client.run('email', 'password')