how to send albums as new messages in telethon

Viewed 378

I want to send every new message from one channel to another. But when there are albums in the message, they are sent separately to the destination channel. How can I send them as an album (as one message)?

@client.on(events.NewMessage('your_channel'))
async def my_event_handler(event):
    await client.send_message('my_channel', event.message)

And I used events.album instead of events.NewMessage, but it didn't work!

1 Answers

I find a simple way, maybe someone will use it

@client.on(events.Album(chats="your_channel"))
   async def handler(event):
       await client.send_message(
           "my_channel", #output channel
           file=event.messages, #list of messages
           message=event.original_update.message.message, #caption
       )
Related