Open Iamirup opened 2 months ago
I am also facing this same error when I ran code locally(it was one file code), it ran perfectly with no error. But when i splitted my file into different files and tried hosting on Koyeb, it threw same error..
AttributeError: 'Client' object has no attribute 'listeners'
[ERROR/2024-08-16 06:13:39,511] pyrogram.dispatcher: 'Client' object has no attribute 'listeners'
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/message_handler.py", line 58, in check
await self.check_if_has_matching_listener(client, message)
File "/app/.heroku/python/lib/python3.11/site-packages/pyromod/listen/message_handler.py", line 37, in check_if_has_matching_listener
listener = client.get_listener_matching_with_data(data, ListenerTypes.MESSAGE)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.heroku/python/lib/python3.11/site-packages/pyrogram/sync.py", line 53, in async_to_sync_wrap
coroutine = function(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.heroku/python/lib/python3.11/site-packages/pyromod/listen/client.py", line 123, in get_listener_matching_with_data
for listener in self.listeners[listener_type]:
^^^^^^^^^^^^^^
AttributeError: 'Client' object has no attribute 'listeners'
I am also facing this same error when I ran code locally(it was one file code), it ran perfectly with no error. But when i splitted my file into different files and tried hosting on Koyeb, it threw same error..
AttributeError: 'Client' object has no attribute 'listeners' [ERROR/2024-08-16 06:13:39,511] pyrogram.dispatcher: 'Client' object has no attribute 'listeners' 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/message_handler.py", line 58, in check await self.check_if_has_matching_listener(client, message) File "/app/.heroku/python/lib/python3.11/site-packages/pyromod/listen/message_handler.py", line 37, in check_if_has_matching_listener listener = client.get_listener_matching_with_data(data, ListenerTypes.MESSAGE) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.heroku/python/lib/python3.11/site-packages/pyrogram/sync.py", line 53, in async_to_sync_wrap coroutine = function(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.heroku/python/lib/python3.11/site-packages/pyromod/listen/client.py", line 123, in get_listener_matching_with_data for listener in self.listeners[listener_type]: ^^^^^^^^^^^^^^ AttributeError: 'Client' object has no attribute 'listeners'
Their was a silly mistake😅 While splitting of code, i used everywhere pyromod but didn't use Client from pyromod and initiated bot with pyrogram.. When i changed the Client import from pyrogram to pyromod just, its working fine now
'Client' object has no attribute 'listeners' Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/pyrogram/dispatcher.py", line 226, in handler_worker if await handler.check(self.client, parsed_update): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyromod/listen/message_handler.py", line 58, in check await self.check_if_has_matching_listener(client, message) File "/usr/local/lib/python3.12/site-packages/pyromod/listen/message_handler.py", line 37, in check_if_has_matching_listener listener = client.get_listener_matching_with_data(data, ListenerTypes.MESSAGE) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyrogram/sync.py", line 53, in async_to_sync_wrap coroutine = function(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pyromod/listen/client.py", line 123, in get_listener_matching_with_data for listener in self.listeners[listener_type]: ^^^^^^^^^^^^^^ AttributeError: 'Client' object has no attribute 'listeners'. Did you mean: 'listen'?