mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-09 13:29:47 +00:00
Add examples to all events
This commit is contained in:
@@ -20,6 +20,25 @@ class Album(EventBuilder):
|
||||
Occurs whenever you receive an album. This event only exists
|
||||
to ease dealing with an unknown amount of messages that belong
|
||||
to the same album.
|
||||
|
||||
Example
|
||||
.. code-block:: python
|
||||
|
||||
from telethon import events
|
||||
|
||||
@client.on(events.Album)
|
||||
async def handler(event):
|
||||
# Counting how many photos or videos the album has
|
||||
print('Got an album with', len(event), 'items')
|
||||
|
||||
# Forwarding the album as a whole to some chat
|
||||
event.forward_to(chat)
|
||||
|
||||
# Printing the caption
|
||||
print(event.text)
|
||||
|
||||
# Replying to the fifth item in the album
|
||||
await event.messages[4].reply('Cool!')
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
Reference in New Issue
Block a user