Delay between new telegram channel messages and their stored datetime metadata

79 Views Asked by At

I'm currently looking for the fastest way to read new messages from telegram channels I'm subscribed to. I wondered if I could use webhook, but it seems it's only possible for channels I'm the owner. First I used Telethon and now I tried Pyrogram, hoping to improve the delay. Here's my code:

 @telegram_client.on_message(filters.chat(channels_id))
        async def new_message_listener(_, message):
            print(datetime.now() - message.date) # 2-3 seconds of delay in average

I started to make a research about the location of the Telegram servers maybe it can improve my latency if my code runs from closer data centers. Maybe python is too slow ? Thank you very much for your help.

0

There are 0 best solutions below