Created a command named redeemcode, to ask the user for redeem code as input and storing it as a variable 'code'
heres the code:
@bot.on_message(filters.command('redeemcode'))
def redeemcode(bot, message):
message.reply_text("Send the code to redeem")
code = bot.get_messages(chatid, message_ids=message.message_id)
and I am getting this error
(c) Microsoft Corporation. All rights reserved.
D:\Genshin Bot>C:/Python310/python.exe "d:/Genshin Bot/bot.py"
ERROR:pyrogram.dispatcher:'Message' object has no attribute 'message_id'
Traceback (most recent call last):
File "C:\Python310\lib\site-packages\pyrogram\dispatcher.py", line 242, in handler_worker
await self.loop.run_in_executor(
File "C:\Python310\lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "d:\Genshin Bot\bot.py", line 67, in redeemcode
code = bot.get_messages(chatid, message_ids=message.message_id)
AttributeError: 'Message' object has no attribute 'message_id'
The problem is with getting the message id , can anyone help me with this?
Besides the fact that you cannot get replies to a message from the message you as the bot sent, message.message_id
has been deprecated in favor of message.id
, to be more consistent with other types, like chat.id
, photo.id
, or video.id
.
See Pyrogram's v2 Release Notes for this:
Message.message_id becomes Message.id: For consistency reasons,
Message.message_id
has been renamed toMessage.id
. This makes it a less redundant name and will reflect with all other types that have the.id
attribute.