0
我試圖創建使用電報telepot API的包裝一個基於卡的遊戲機器人,但我無法弄清楚如何使其使用垂直佈局而非水平佈局的如何以編程方式使用電報bot api使用python創建垂直自定義鍵盤佈局?
示例代碼:
keyboard = []
for card in data['current_games'][userGame]['players'][messageLocationID]['cards']:
button = [KeyboardButton(text=card)]
keyboard += button
然後我用sendKeyEmail()方法和ReplyKeyboardMarkup()方法,但是它創建了一排高而薄的按鈕,這會影響文本的顯示。
有沒有我失蹤的一步?我是能夠用於創建密鑰的方:
keyboard = [[KeyboardButton(text='0'), KeyboardButton(text='1'), KeyboardButton(text='2'), KeyboardButton(text='3')],
[KeyboardButton(text='4'), KeyboardButton(text='5'), KeyboardButton(text='6'), KeyboardButton(text='7')],
[KeyboardButton(text='8'), KeyboardButton(text='9'), KeyboardButton(text='10'), KeyboardButton(text='11')],
[KeyboardButton(text='12'), KeyboardButton(text='13'), KeyboardButton(text='14'), KeyboardButton(text='15')]]
我只使用第二種方法,因爲我能夠創建手動而不是編程方式創建一個鍵盤,但是我沒有辦法處理因爲它是一個動態列表,每轉一圈就會改變,因此不需要依次訪問每張卡片。
我看着在API筆記,但我無法找到任何東西,我能夠使用
我基於第二鍵盤的結果,我將能夠通過使每個卡,以垂直行假設是一個數組,因此它會嵌套在原始數組中,但事實並非如此我的經驗
我是否錯過了一個步驟?