From 16b491065c4940b77faaef13695de8c1708c6669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20K=C3=BCbler?= Date: Thu, 6 Aug 2020 16:37:49 +0200 Subject: [PATCH] one button per line (#12) --- cmd/bot.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cmd/bot.go b/cmd/bot.go index 89b47a8..e67ca70 100644 --- a/cmd/bot.go +++ b/cmd/bot.go @@ -170,11 +170,17 @@ func BotCommand(ctx context.Context, cmd *cobra.Command, args []string) { } if tctx.IsKeyboard() { - buttons := []tgbotapi.InlineKeyboardButton{} + buttons := [][]tgbotapi.InlineKeyboardButton{} for _, button := range tctx.Keyboard() { - buttons = append(buttons, tgbotapi.NewInlineKeyboardButtonData(button.Label, button.Data)) + buttons = append( + buttons, + tgbotapi.NewInlineKeyboardRow( + tgbotapi.NewInlineKeyboardButtonData(button.Label, button.Data), + ), + ) + // buttons = append(buttons, tgbotapi.NewInlineKeyboardButtonData(button.Label, button.Data)) } - keyboard := tgbotapi.NewInlineKeyboardMarkup(buttons) + keyboard := tgbotapi.NewInlineKeyboardMarkup(buttons...) reply.ReplyMarkup = keyboard }