Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message not received from a certain telegram channel #1426

Open
3 tasks done
kannanjgithub opened this issue May 18, 2024 · 7 comments
Open
3 tasks done

Message not received from a certain telegram channel #1426

kannanjgithub opened this issue May 18, 2024 · 7 comments

Comments

@kannanjgithub
Copy link

Checklist

  • I am sure the error is coming from Pyrogram's code and not elsewhere
  • I have searched in the issue tracker for similar bug reports, including closed ones
  • I ran pip3 install -U https://github.com/pyrogram/pyrogram/archive/master.zip and reproduced the issue using the latest development version

Description

I have the below code that listens for messages from two different sessions (two different phone numbers). Both accounts are subscribed to a certain telegram channel. When a message arrives on this telegram channel, only the session titled india_number receives the message but not the other session titled uk_number. When I try with my own test channel, the issue does not always reproduce although sometimes it does.

I also tried modifying my code to handle only 1 session and ran two instances of the script from different terminals, one for each telegram account, but even now only one of them is receiving the message, so this is not an issue with any incorrect usage of async in the combined program.

Steps to reproduce

Write a message handler for a session. Repeat for another session. When a message is received, notice that only one of the two sessions ever receives messages, and never on the other session.

Code example

#!/usr/bin/python3

from pyrogram import Client, filters, idle
from pyrogram.handlers import MessageHandler
import config
from pytz import timezone
from datetime import datetime
import requests
import asyncio

CHANNEL_ID = -1000123456789

def india_number_handler(client, message):
    message_handler('india_number', message)
    
def uk_number_handler(client, message):
    message_handler('uk_number', message) 
    
def message_handler(session_name, message):
    if message.sender_chat is not None and message.sender_chat.id == CHANNEL_ID and message.text is not None:
        print(datetime.now().strftime('%d-%m-%Y-%H:%M:%S-%f') + ': ' + session_name + ' received channel message: ' + message.text, flush = True
    
async def main():
    app_india = Client("india_number", api_id=config.getEnv("api_id"), api_hash=config.getEnv("api_hash"))
    app_uk = Client("uk_number", api_id=config.getEnv("api_id"), api_hash=config.getEnv("api_hash"))
    app_india.add_handler(MessageHandler(india_number_handler))
    app_uk.add_handler(MessageHandler(uk_number_handler))    
    await app_india.start()
    await app_uk.start()
    await idle()
    await app.stop()
    await app_uk.stop()
         
asyncio.run(main())

Logs

No response

@fireinrain
Copy link

this repo seem dead...

@Kanakagawa
Copy link

I confirm, since last night the client stopped receiving updates from many channels and chats, I still could not solve the problem with my own hands, are there those who can help me ?

@fireinrain
Copy link

I confirm, since last night the client stopped receiving updates from many channels and chats, I still could not solve the problem with my own hands, are there those who can help me ?

use telethon to replace the pyrogram

@ndkwa
Copy link

ndkwa commented May 29, 2024

same thing, my project stopped processing messages yesterday...

@gremur
Copy link

gremur commented May 29, 2024

same story, my project stopped processing messages yesterday

@swallowcc
Copy link

same thing. I've temporarily substituted it with Telethon for now, but I still hope this issue can be fixed.

@pahar6
Copy link

pahar6 commented Jun 1, 2024

The same problem. In the created user bot group, all messages are shown, but if you monitor other people's groups and channels, the pyrogram does not see new posts (or very rarely sees 0 or 1 message out of 10). The problem appeared 4 days ago. Please fix the bug - thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

7 participants