From e97c2417c99a9e301612ef45d9a549b628e062b5 Mon Sep 17 00:00:00 2001 From: Syfaro Date: Thu, 28 Dec 2017 23:17:32 -0600 Subject: [PATCH] Resolve some linter issues. --- bot_test.go | 14 +++++++++++--- types.go | 7 ++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/bot_test.go b/bot_test.go index 0fb0855..374773f 100644 --- a/bot_test.go +++ b/bot_test.go @@ -373,7 +373,10 @@ func TestSendWithNewStickerAndKeyboardHide(t *testing.T) { bot, _ := getBot(t) msg := tgbotapi.NewStickerUpload(ChatID, "tests/image.jpg") - msg.ReplyMarkup = tgbotapi.ReplyKeyboardRemove{true, false} + msg.ReplyMarkup = tgbotapi.ReplyKeyboardRemove{ + RemoveKeyboard: true, + Selective: false, + } _, err := bot.Send(msg) if err != nil { @@ -386,7 +389,10 @@ func TestSendWithExistingStickerAndKeyboardHide(t *testing.T) { bot, _ := getBot(t) msg := tgbotapi.NewStickerShare(ChatID, ExistingStickerFileID) - msg.ReplyMarkup = tgbotapi.ReplyKeyboardRemove{true, false} + msg.ReplyMarkup = tgbotapi.ReplyKeyboardRemove{ + RemoveKeyboard: true, + Selective: false, + } _, err := bot.Send(msg) @@ -399,7 +405,9 @@ func TestSendWithExistingStickerAndKeyboardHide(t *testing.T) { func TestGetFile(t *testing.T) { bot, _ := getBot(t) - file := tgbotapi.FileConfig{ExistingPhotoFileID} + file := tgbotapi.FileConfig{ + FileID: ExistingPhotoFileID, + } _, err := bot.GetFile(file) diff --git a/types.go b/types.go index bef68b8..bc0fd00 100644 --- a/types.go +++ b/types.go @@ -230,11 +230,12 @@ func (m *Message) CommandArguments() string { // IsCommand() checks that the message begins with a bot_command entity entity := (*m.Entities)[0] + if len(m.Text) == entity.Length { return "" // The command makes up the whole message - } else { - return m.Text[entity.Length+1:] } + + return m.Text[entity.Length+1:] } // MessageEntity contains information about data in a Message. @@ -410,7 +411,7 @@ type InlineKeyboardButton struct { SwitchInlineQuery *string `json:"switch_inline_query,omitempty"` // optional SwitchInlineQueryCurrentChat *string `json:"switch_inline_query_current_chat,omitempty"` // optional CallbackGame *CallbackGame `json:"callback_game,omitempty"` // optional - Pay bool `json:"pay,omitempty"` // optional + Pay bool `json:"pay,omitempty"` // optional } // CallbackQuery is data sent when a keyboard button with callback data