Maddox
Maddox

Reputation: 1

How to solve this error its a telegram bot using pyrogram library

pyrogram.dispatcher - dispatcher - ERROR - 'Message' object has no attribute 'message_id'

Traceback (most recent call last):

File "/usr/local/lib/python3.10/site-packages/pyrogram/dispatcher.py", line 240, in handler_worker

await handler.callback(self.client, *args)

File "/app/plugins/pm_filter.py", line 53, in give_filter

await client.delete_messages(message.chat.id, st_msg.message_id)

AttributeError: 'Message' object has no attribute 'message_id'

enter image description here

Why showing this? How to fix this

Upvotes: 0

Views: 240

Answers (2)

Silent Wraith
Silent Wraith

Reputation: 49

message_id attribute is only supported in Pyrogram versions below 2.0

Consider using the latest version or try to downgrade

Upvotes: 0

0stone0
0stone0

Reputation: 44029

tl;dr;

Use st_msg.id instead off st_msg.message_id


If you look at the reply_sticker source code it mentions:

Returns:

On success, the sent :obj:~pyrogram.types.Message is returned.
...

So if we look at those Message parameters, for example, again in the source code we'll see:

id (int):
Unique message identifier inside this chat.

Upvotes: 0

Related Questions