diff options
| author | Rapptz <[email protected]> | 2015-12-06 03:05:50 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2015-12-06 03:10:18 -0500 |
| commit | e87d54dd12c2a655e6e075abd8e2d03ce3b6d059 (patch) | |
| tree | abb8657ecc8f57b64159dc17a282f0a8c1cdb9b1 /examples/edits.py | |
| parent | Forced keyword argument for allow/deny in edit_channel_permissions (diff) | |
| download | discord.py-e87d54dd12c2a655e6e075abd8e2d03ce3b6d059.tar.xz discord.py-e87d54dd12c2a655e6e075abd8e2d03ce3b6d059.zip | |
Update example code.
Diffstat (limited to 'examples/edits.py')
| -rw-r--r-- | examples/edits.py | 20 |
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') [email protected]_event def on_ready(): print('Connected!') print('Username: ' + client.user.name) print('ID: ' + client.user.id) [email protected]_event 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') [email protected]_event 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') |