Answer the question
In order to leave comments, you need to log in
How to start Forwarder Telegram correctly?
I'm using phyton 3.9.6 . I'll
attach the code here so that you can get acquainted in more detail, in order to get an answer / help from you on this topic.
Help me figure it out, the reason is that ... when I launch more than 10 resenders, the telegram stops sending, or sends with delays.
Maybe you have some simpler code written that will make this job easier. GOD GIVE YOU HEALTH. YOUR HELP IS REALLY NEEDED. (P.S. If I'm not a proger, I'm trying to learn and understand what is necessary for work.)
I'm sure you understand this better and I hope for your help. (My telegram is for every firefighter @Mr.Nike , I’m ready to pay some kind of cape for human help)
Config (text.doc)
[Telegram]
api_id = ........ (go to your telegram account)
api_hash = ........... (Api hash of telegram account)
username = .............. (Nick/Subject)
dst_channel = https://t.me/ ...................... (message delivery.Where)
src_channel0 = https://t.me/ ............ .....(Getting message.From)
src_channel1 = https://t.me/ .................(Getting message.From)
Phyton
import pandas as pd
import configparser
import sqlite3
import logging
import time
import json
import re
import os
from telethon.sync import TelegramClient
from telethon import connection, events
# for correct transfer of message time to json
from datetime import date, datetime
# classes for working with channels
from telethon.tl.functions.channels import GetParticipantsRequest
from telethon.tl.types import ChannelParticipantsSearch
from telethon.tl.types import PeerChat, PeerChannel
# class to work with messages
from telethon.tl.functions.messages import GetHistoryRequest
# Read credentials
config = configparser.ConfigParser()
config.read("config.ini")
# Assign values to internal variables
api_id = config['Telegram'][' api_id']
api_hash = config['Telegram']['api_hash']
username = config['Telegram']['username']
dst_channel = config['Telegram']['dst_channel']
src_channel0 = config['Telegram']['src_channel0']
client = TelegramClient(username, api_id, api_hash)
@client.on(events.NewMessage(chats=[PeerChannel( channel ID from where info is taken from)]))
@client.on(events.NewMessage(chats=[channel ID from where info is taken from]))
@client.on(events.NewMessage(chats=[PeerChannel(channel ID from where info is taken from ) infa)]))
@client.on(events.NewMessage(chats=[ channel id where infa is taken from ]))
async def normal_handler(event):
print(event.raw_text)
#await client.send_message(dst_channel, event.message .to_dict()['message'])
print('Message')
message = await client.send_message(dst_channel,event.message)
if message.photo:
path = await message.download_media()
print('File saved to', path)
#@client.on(events.NewMessage(chats=[Channel ID to send to]))
async def my_event_handler(event):
print(event.raw_text)
client.start()
client.run_until_disconnected()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question