2

I have a code that can copy a message from one channel to another channel, but this code works only for "NewMessages", how to make this code to send all messages from the channel to another channel?

from telethon import TelegramClient, events
import asyncio

api_id = 
api_hash = ''

my_channel_id = -1001247324182
channels = [-100129537617]

client = TelegramClient('myGrab', api_id, api_hash)
print("GRAB - Started")

@client.on(events.NewMessage(chats=channels))
async def my_event_handler(event):
    if event.message:
        await client.send_message(my_channel_id, event.message)
 
 
client.start()
client.run_until_disconnected()

So, it is possible to do this code to send all messages from the channel? Maybe, another library?

SkruDJ
  • 157
  • 8

1 Answers1

0

You can iter_messages and forward it to new channel

Simon Yong
  • 26
  • 4
  • 3
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 22 '22 at 19:20
  • yes, thanks! But answer is unclear for another users :D – SkruDJ Nov 06 '22 at 01:36