Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
one button per line (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
PKuebler authored Aug 6, 2020
1 parent 0f2a155 commit 16b4910
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cmd/bot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 16b4910

Please sign in to comment.