all repos — telegram-bot-api @ 369364b8c6c2bc563d8c3cef8fa47b40249f204b

Golang bindings for the Telegram Bot API

Merge pull request #44 from jqs7/master

simplify append loop
Syfaro syfaro@foxpaw.in
Thu, 21 Apr 2016 06:37:46 -0500
commit

369364b8c6c2bc563d8c3cef8fa47b40249f204b

parent

ab63d49cc925dfd42088efb03c558b99263c248c

1 files changed, 6 insertions(+), 14 deletions(-)

jump to
M helpers.gohelpers.go

@@ -421,8 +421,8 @@ // keyboard markup.

func NewEditMessageReplyMarkup(chatID int64, messageID int, replyMarkup InlineKeyboardMarkup) EditMessageReplyMarkupConfig { return EditMessageReplyMarkupConfig{ BaseEdit: BaseEdit{ - ChatID: chatID, - MessageID: messageID, + ChatID: chatID, + MessageID: messageID, ReplyMarkup: &replyMarkup, }, }

@@ -466,9 +466,7 @@ // NewKeyboardButtonRow creates a row of keyboard buttons.

func NewKeyboardButtonRow(buttons ...KeyboardButton) []KeyboardButton { var row []KeyboardButton - for _, button := range buttons { - row = append(row, button) - } + row = append(row, buttons...) return row }

@@ -477,9 +475,7 @@ // NewReplyKeyboard creates a new regular keyboard with sane defaults.

func NewReplyKeyboard(rows ...[]KeyboardButton) ReplyKeyboardMarkup { var keyboard [][]KeyboardButton - for _, row := range rows { - keyboard = append(keyboard, row) - } + keyboard = append(keyboard, rows...) return ReplyKeyboardMarkup{ ResizeKeyboard: true,

@@ -518,9 +514,7 @@ // NewInlineKeyboardRow creates an inline keyboard row with buttons.

func NewInlineKeyboardRow(buttons ...InlineKeyboardButton) []InlineKeyboardButton { var row []InlineKeyboardButton - for _, button := range buttons { - row = append(row, button) - } + row = append(row, buttons...) return row }

@@ -529,9 +523,7 @@ // NewInlineKeyboardMarkup creates a new inline keyboard.

func NewInlineKeyboardMarkup(rows ...[]InlineKeyboardButton) InlineKeyboardMarkup { var keyboard [][]InlineKeyboardButton - for _, row := range rows { - keyboard = append(keyboard, row) - } + keyboard = append(keyboard, rows...) return InlineKeyboardMarkup{ InlineKeyboard: keyboard,