我有一个使用Ruby Wrapper构建的电报机器人,它打印出一个内联键盘消息,要求用户输入。
但是,一旦用户点击某个选项,我想用新邮件替换该邮件。
bot.api.edit_message_text(chat_id: message.from.id,
message_id: message.message_id,
text: "What would you like Athena to do?",
reply_markup: tasks_keyboard()
)
我使用上面的代码遇到以下错误:
C:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/telegram-bot-ruby-0.8.6.1/lib/telegram/bot/api.rb:76:in `call': Telegram API has returned the error. (ok: "false", error_code: "400", description: "Bad Request: message to edit not found") (Telegram::Bot::Exceptions::ResponseError)
这是完整的代码。
Telegram::Bot::Client.run(token) do |bot|
bot.listen do |message|
case message
when Telegram::Bot::Types::CallbackQuery
case message.data
bot.api.edit_message_text(chat_id: message.from.id,
message_id: message.id,
text: "What would you like Athena to do?",
reply_markup: tasks_keyboard()
)
如何引用(获取ID)上一条要编辑的消息?