Forward message (album) telethon

Viewed 591

I'm trying to forward a message with a group of photos. But they are redirected by separate messages in destination channel. How can I redirect with one message?

@client.on(events.NewMessage(incoming=True, chats=FROM))
async def handler_frw(event):
    await client.forward_messages(CHANNEL_TO, event.message)

If I use "send_message" it send as one message. But TO_NAME - doesn't work with id Channel, only name :( And i need "Forward from" in destination channel.

@client.on(events.Album(chats=FROM))
async def handler_snd(event):
    print("Have album.")
    caps = []
    for item in event.messages:
        caps.append(item.message)
    await client.send_message(TO_NAME, file=event.messages, message=caps)
1 Answers

If you want to forward the whole album, utilize the corresponding Album event instead of the New Message event. Telethon supposedly does the necessary hacks to collect the single messages together.

See the docu

from telethon import events

@events.register(events.Album)
async def albumHandler(self, event):
    # Forwarding the album as a whole to some chat
    event.forward_to(chat)
Related