Python 电报bot开关\u内联\u查询
我正在尝试制作一个电报机器人,它将具有一些内联查询功能,想法是你点击一个按钮,它会要求你选择聊天来写消息,在你写了消息后,它会把你带回机器人聊天。问题是,我知道有一个选项可以这样做,但我找不到任何示例或文档。据我所知,它可以通过使用Python 电报bot开关\u内联\u查询,python,bots,telegram,telegram-bot,Python,Bots,Telegram,Telegram Bot,我正在尝试制作一个电报机器人,它将具有一些内联查询功能,想法是你点击一个按钮,它会要求你选择聊天来写消息,在你写了消息后,它会把你带回机器人聊天。问题是,我知道有一个选项可以这样做,但我找不到任何示例或文档。据我所知,它可以通过使用switch\u pm实现,但我知道如何使用它,我没有找到任何关于它的信息。。。我的代码现在看起来像这样 def inlineKeyboard(update, context): keyboard = [[InlineKeyboardButton("
switch\u pm
实现,但我知道如何使用它,我没有找到任何关于它的信息。。。我的代码现在看起来像这样
def inlineKeyboard(update, context):
keyboard = [[InlineKeyboardButton("1", switch_inline_query='')]]
reply_markup = InlineKeyboardMarkup(keyboard)
update.message.reply_text('Please choose: ', reply_markup=reply_markup)
def button(update, context):
query = update.callback_query
# CallbackQueries need to be answered, even if no notification to the user is needed
# Some clients may have trouble otherwise. See https://core.telegram.org/bots/api#callbackquery
query.answer()
query.edit_message_text(text="Selected option: {}".format(query.data))
updater.dispatcher.add_handler(CommandHandler('test', inlineKeyboard))
updater.dispatcher.add_handler(CallbackQueryHandler(button))