python - Telegram API 要求用户确认

标签 python telegram python-telegram-bot

我正在尝试在 python-telegram-bot 中创建一个基本的用户提示,要求用户确认Yes 将继续执行,No 将不执行任何操作。

我目前可以通过执行以下操作来发出提示

keyboard = [
    [InlineKeyboardButton(u"Yes", callback_data=???)],
    [InlineKeyboardButton(u"No", callback_data=???)]
]
reply_markup = InlineKeyboardMarkup(keyboard)

但是我应该将callback_data 设置为什么呢?有更好的方法吗?

最佳答案

您可以在那里设置任何您想要的内容,然后检查该值

看看这个例子 https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/inlinekeyboard.py

关于python - Telegram API 要求用户确认,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49201592/

相关文章:

python - (python) Telegram bot-如何定期发送消息?

python - 如何使用 scipy 编辑稀疏矩阵中的单元格?

c# - 我如何在 Telegram Bot 中不使用 "CallbackData"的情况下回答 "AnswerCallbackQueryAsync"(C#)

javascript - Telegram Bot 通过 node.js 发送照片

python - 如何从 Telegram Bot 的群组消息中获取 User 对象

python - Telegram 机器人在消息后发送错误 "Something went wrong, please try again"

python - 如何合并pandas中的两个数据框?

python - Flask-OAuthlib "TypeError: sequence index must be integer, not ' str'”

python - Pyspark 列在查找前几行和计算时生成

python - 如何使 Telegram 键盘按钮发出命令?