aboutsummaryrefslogtreecommitdiff
path: root/examples/edits.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2016-01-06 11:34:49 -0500
committerRapptz <[email protected]>2016-01-06 11:34:49 -0500
commit2ebfbbe471ce32a3cd29ee2099a3c9de77fa311c (patch)
tree8a332c941434a695a4f7ca39e0e1aba8ee7f994e /examples/edits.py
parent[commands] Add CommandNotFound error. (diff)
downloaddiscord.py-2ebfbbe471ce32a3cd29ee2099a3c9de77fa311c.tar.xz
discord.py-2ebfbbe471ce32a3cd29ee2099a3c9de77fa311c.zip
Examples now use Python 3.5. Remove echo.py example.
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 3767b933..a10393a0 100644
--- a/examples/edits.py
+++ b/examples/edits.py
@@ -3,22 +3,22 @@ import asyncio
client = discord.Client()
-def on_ready():
+async def on_ready():
print('Connected!')
print('Username: ' + client.user.name)
print('ID: ' + client.user.id)
-def on_message(message):
+async def on_message(message):
if message.content.startswith('!editme'):
- msg = yield from client.send_message(message.author, '10')
- yield from asyncio.sleep(3)
- yield from client.edit_message(msg, '40')
+ msg = await client.send_message(message.author, '10')
+ await asyncio.sleep(3)
+ await client.edit_message(msg, '40')
-def on_message_edit(before, after):
+async def on_message_edit(before, after):
fmt = '**{0.author}** edited their message:\n{1.content}'
- yield from client.send_message(after.channel, fmt.format(after, before))
+ await client.send_message(after.channel, fmt.format(after, before))
client.run('email', 'password')