我已经尝试了很长一段时间,阅读了 python-telegram-bot 包装器 APIpython-telegram-bot 包装器、telegram bot API、代码片段等,但我缺乏理解(我的编程知识是选择性的谷歌复制- Pastes) 不允许我成功实现 ForceReply 选项。 (强制回复
基本上我正在尝试的是,当用户输入 /sett 时,机器人会说“输入否”。并强制用户回复该消息。
抱歉,如果我遗漏了一些明显的东西。
bot.send_message(chat_id, 'Enter No.', reply_markup=ForceReply())
@bot.message_handler(content_types=['text'])
def but(message):
markup = types.ForceReply(selective=False)
bot.send_message(message.chat.id, "Send me another word:", reply_markup=markup)
对于遇到此问题的人来说,这将解决它。
markup = telebot.types.ForceReply()
bot.send_message(call.message.chat.id, "Enter No", reply_markup=markup)