Dmi*_*sky 2 python telegram python-telegram-bot telegram-bot
有没有办法自定义键盘上的按钮位置?
例子:我们有
import telegram
def start(bot, update):
kb = [[telegram.KeyboardButton('/command1')],
[telegram.KeyboardButton('/command2')],
[telegram.KeyboardButton('/command3')]]
kb_markup = telegram.ReplyKeyboardMarkup(kb, resize_keyboard=True)
bot.send_message(chat_id=update.message.chat_id,
text="Welcome!",
reply_markup=kb_markup)
Run Code Online (Sandbox Code Playgroud)
结果,我们有带 3 个按钮的键盘,每个按钮都在自己的行上。
我想在第一行有 2 个按钮,在第二行有 1 个按钮。是否可以?