InlineKeyboardButton和CallbackData

问题描述

我想问一下InlineKeyboardMarkup是什么,当用户用InlineKeyboardButton单击callback_data按钮时如何捕获事件,如何调用和处理它?

下面是我的代码的一部分。

from telegram import InlineKeyboardMarkup,InlineKeyboardButton
from telegram.ext import Updater,CommandHandler

API        = "1234567890:API_Example"
Bot        = Updater(API,use_context = True)
Dispatcher = Bot.dispatcher

def start_command(update,context):
  RM       = InlineKeyboardMarkup(
    [[InlineKeyboardButton(
      text = "example button text",callback_data = "example data")
    ]])
  message  = "example message"
  context.bot.send_message(update.effective_chat.id,message,reply_markup = RM)

Dispatcher.add_handler(CommandHandler("start",start_command))
Bot.start_polling()

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)