2017-06-13 105 views
0

有没有办法自定义键盘上的按键位置?电报机器人:定制键盘上的按钮位置

例子:我们有

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) 

因为我们有键盘3个按键,在其自己的行每个按钮的结果。

我想第一行有2个按钮,第二行有1个按钮。可能吗?

回答

1

是的,当然!

[[button1, button2], 
[button3]] 

在整个列表中的每个行对应于一个行的KB

+0

的感谢!有用。 –