Untitled
unknown
plain_text
a year ago
1.1 kB
2
Indexable
Never
import aiogram import asyncio from aiogram import Bot, Dispatcher, types from aiogram.utils import executor import telethon.sync from telethon import TelegramClient, events, sync import logging logging.basicConfig(format='[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s', level=logging.WARNING) api_id = '' api_hash = '' PHONE_NUMBER = '' BOT_TOKEN = ':' # Загрузка источников из txt файла with open('source_channels.txt', 'r') as f: source_channels = [line.strip() for line in f] destination_channel = 'https://t.me/tsurSystems' client = TelegramClient('anon', api_id, api_hash) async def main(): async with client: me = await client.get_me() @client.on(events.NewMessage(chats=source_channels)) async def new_message_handler(event): await client.forward_messages(destination_channel, event.message) await asyncio.sleep(5) # Задержка в 5 секунд await client.run_until_disconnected() client.start() client.run_until_disconnected(main())