attributeError:'消息'对象没有属性' message_id' (Proragram)
创建了一个名为edeemcode的命令,要求用户提供兑换代码作为输入,并将其存储为变量“代码”
,
@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)
而我遇到了此错误
(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'
,问题是获得消息ID的问题,有人可以帮助我吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
除了您无法在发送的消息中从消息中回复消息的事实,
message.message_id
已对message.id
demecement overeme 与其他类型一致,例如chat.id
,photo.id
,或video.id.id
。参见 pyrogram的v2发行笔记为此:
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 ofmessage.id
, to be more consistent with other types, likechat.id
,photo.id
, orvideo.id
.See Pyrogram's v2 Release Notes for this: