Add missing async/await to events' documentation

This commit is contained in:
Lonami Exo 2018-07-08 15:11:10 +02:00
parent d02cb84abe
commit 3a9cce8720
2 changed files with 5 additions and 5 deletions

View File

@ -79,8 +79,8 @@ Handling Updates
from telethon import events
@client.on(events.NewMessage(incoming=True, pattern='(?i)hi'))
def handler(event):
event.reply('Hello!')
async def handler(event):
await event.reply('Hello!')
client.run_until_disconnected()

View File

@ -18,13 +18,13 @@ class StopPropagation(Exception):
>>> client = TelegramClient(...)
>>>
>>> @client.on(events.NewMessage)
... def delete(event):
... event.delete()
... async def delete(event):
... await event.delete()
... # No other event handler will have a chance to handle this event
... raise StopPropagation
...
>>> @client.on(events.NewMessage)
... def _(event):
... async def _(event):
... # Will never be reached, because it is the second handler
... pass
"""