mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-29 04:43:45 +03:00
Add missing async/await to events' documentation
This commit is contained in:
parent
d02cb84abe
commit
3a9cce8720
|
@ -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()
|
||||
|
||||
|
|
|
@ -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
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user