Closed Athirst1998 closed 1 year ago
@Athirst1998 The code and error are no where related tho
I got same error:
pyrogram.dispatcher - ERROR - 'NoneType' object has no attribute 'id'
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/pyrogram/dispatcher.py", line 226, in handler_worker
if await handler.check(self.client, parsed_update):
File "/usr/local/lib/python3.8/dist-packages/pyromod/listen/listen.py", line 196, in check
(message.chat.id, message.from_user.id, message.id),
AttributeError: 'NoneType' object has no attribute 'id'
it's latest version from pypi
@AbirHasan2005 try message.sender_chat.id
@AbirHasan2005 https://t.me/pyrogramchat/535246 look here..
Same error, in same file listen.py happen if a group/supergroup or channel start a live broadcast (video call, group call or whatever you want to call it)! Without pyromod no error raised during group call. To reproduce it, just include pyromod and start a group call in a group where your bot is (normal bot, not userbot)
Add: The pull request #22 fix the problem even for the group call error.
pyromod/listen/listen.py
@patchable
async def check(self, client, message):
if message.from_user is None:
_id = message.sender_chat.id
else:
_id = message.from_user.id
listener = client.match_listener(
(message.chat.id, _id, message.id),
ListenerTypes.MESSAGE,
)[0]
listener_does_match = handler_does_match = False
i got the same error in my code only when I import pyromod. With parogram alone it runs fine. Pls fix the bug
using v2.0.0, and constantly get the same error :
2023-08-29 12:15:22,881 - ERROR - pyrogram.dispatcher - MainThread - 'NoneType' object has no attribute 'id'
Traceback (most recent call last):
File "/venv/lib/python3.11/site-packages/pyrogram/dispatcher.py", line 226, in handler_worker
if await handler.check(self.client, parsed_update):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/venv/lib/python3.11/site-packages/pyromod/listen/listen.py", line 196, in check
(message.chat.id, message.from_user.id, message.id),
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'id'
@EDM115 Umm
using v2.0.0, and constantly get the same error :
2023-08-29 12:15:22,881 - ERROR - pyrogram.dispatcher - MainThread - 'NoneType' object has no attribute 'id' Traceback (most recent call last): File "/venv/lib/python3.11/site-packages/pyrogram/dispatcher.py", line 226, in handler_worker if await handler.check(self.client, parsed_update): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/venv/lib/python3.11/site-packages/pyromod/listen/listen.py", line 196, in check (message.chat.id, message.from_user.id, message.id), ^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'id'
I modified pyromod and fixed this error long time ago, this error happen because not all updates have chat.id or from_user.id or a message id, but pyromod use these on every request, for example if an update came from a channel or from live broadcast update of a group/channel etc message.from_user.id is not present at all! Not even as "None".
If you implement the code of the pull request #22 problem disappear and all work great even after many tests.
I hope that will be implemented asap!
I am also getting the same error:
'NoneType' object has no attribute 'id'
Traceback (most recent call last):
File "/app/.heroku/python/lib/python3.11/site-packages/pyrogram/dispatcher.py", line 226, in handler_worker
if await handler.check(self.client, parsed_update):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.heroku/python/lib/python3.11/site-packages/pyromod/listen/listen.py", line 196, in check
(message.chat.id, message.from_user.id, message.id),
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'id'
Using the latest version (i.e. 2.0.0) from pypi
Thank you for reporting and contributing!
when I send a message to channel , the bot raise this error:
'NoneType' object has no attribute 'id' Traceback (most recent call last): File ".....venv/lib/python3.10/site-packages/pyrogram/dispatcher.py", line 226, in handler_worker if await handler.check(self.client, parsed_update): File "......venv/lib/python3.10/site-packages/pyromod/listen/listen.py", line 196, in check (message.chat.id, message.from_user.id, message.id), AttributeError: 'NoneType' object has no attribute 'id'
how can I fix error?