İmport asyncio.
From telethon. Sync import telegramclient.
From telethon. TL. Types import ınputmessagesfilterdocument
From telethon. Errors import floodwaiterror.
Api_id = your_apı_ıd.
Api_hash = 'your_apı_hash'.
Source_entity = 'source_entıty'.
Target_entity = 'target_entıty'.
Async def forward_all_files():
 Async with telegramclient('session_name', api_id, api_hash) as Client:
 Messages = await Client. Get_messages(source_entity, filter = ınputmessagesfilterdocument)
 File_names = set()
 For message in messages:
 İf message. Document. File_name not in file_names:
 File_names. Add(message. Document. File_name)
 Try:
 Await Client. Forward_messages(target_entity, message)
 Except floodwaiterror as e:
 Await asyncio. Sleep(e. Seconds)
asyncio.get_event_loop().run_until_complete(forward_all_files())
Bu kod, aynı isimdeki dosyaları belirleyip sadece bir tanesini hedefe iletecektir. Dosyaların isimlerini bir küme (set) içinde saklayarak, daha önce iletilen bir dosya ile aynı isme sahip bir dosyanın tekrar iletilmesini engellemiş oluruz.