I have a scripts which responsible for forwarding messages from one channel to other channels. Scripts looks something like below: How can I achieve to run different client on every channel. I am using Telethon.
client = TelegramClient('bot', api_id, api_hash).start(bot_token=bot_token)
client.start()
@client.on(events.NewMessage(chats=[channel_id]))
async def handler(event):
channels = get_channels()
replacements = get_replacements()
msg_first = copy.copy(event.message.text)
for channel in channels:
replacements_api = get_replacement(channel['channel_id'], replacements)
for rep_api in replacements_api:
# do some stuff here
await client.send_message(channel['channel_id'], message=event.message)
client.run_until_disconnected()
from how to convert this script to run multiple bots
No comments:
Post a Comment