Telegram Bot InlineKeyboardButton全文

问题描述 投票:0回答:1

我正在使用InlineKeyboardButton在电报机器人中创建按钮,如下所示。

keyboard = [[InlineKeyboardButton("Option 1", callback_data='1'),
             InlineKeyboardButton("Option 2. Long text here. Long text here. Long text here.", callback_data='2'), 
             InlineKeyboardButton("Option 3", callback_data='3')]]

reply_markup = InlineKeyboardMarkup(keyboard)
update.message.reply_text('Please choose:', reply_markup=reply_markup)

在此示例中,Button 2文本将被截断为“Option 2. Long text here ...”之类的内容。我想知道是否可以显示全文。

谢谢!

bots telegram-bot chatbot python-telegram-bot
1个回答
1
投票

在桌面上将光标悬停在这样的按钮上将在工具提示中显示它的全文,在移动时按下并按住这样的按钮也应该这样做。

您还可以使用answerCallbackQuery方法回复用户关于此特定回调数据,其中text设置为您的全文(尽管最多允许200个字符),show_alert设置为true,这将向用户显示弹出消息。

© www.soinside.com 2019 - 2024. All rights reserved.