1

Telethon event handler waits 1 minute before sending out a burst of messages at the same time.

I tried removing functions from other souces as I thought that could be it and it did not work. code: `

from telethon import TelegramClient, events
import logging
import time
#from main import add
logging.basicConfig(format='[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s', level=logging.WARNING)


api_id = 
api_hash = 

client = TelegramClient('anon', api_id, api_hash)

@client.on(events.NewMessage)
async def my_event_handler(event):
    print(event.raw_text)
    #add(event.raw_text)

client.start()
client.run_until_disconnected()

`

makors
  • 29
  • 2
  • Please provide enough code so others can better understand or reproduce the problem. – Community Oct 31 '22 at 02:53
  • Events are sent by Telegram, Telethon can't do much to speed it or slow it. It fully depends on your account whether a User or Bot one. it's hard to judge the reason without background on that. see if it happens to other accounts of yours and test it. – MustA Oct 31 '22 at 06:49
  • https://github.com/LonamiWebs/Telethon/issues/3965 may be relevant. – Lonami Oct 31 '22 at 07:18

1 Answers1

0

form me work ok and i have testet python need to run all time

#exit()
import sys
from telethon import TelegramClient, events
import logging
import time
import telethon.tl.functions as _fn 


logging.basicConfig(format='[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s', level=logging.WARNING)

api_id = row[2]
api_hash = row[3]  
client = TelegramClient(path+str(api_id), api_id, api_hash)

@client.on(events.NewMessage)

async def my_event_handler(event):
    print(event.raw_text)
    print(event)
    #add(event.raw_text)

client.start()
client.run_until_disconnected()


print('Finish...')