2017-06-13 107 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

的感謝!有用。 –