all repos — telegram-bot-api @ b728fa78fc94abdd39b0f24bf71dc1d245385059

Golang bindings for the Telegram Bot API

More various small code quality improvements.
Syfaro syfaro@huefox.com
Mon, 26 Mar 2018 12:39:07 -0500
commit

b728fa78fc94abdd39b0f24bf71dc1d245385059

parent

1aef8c8c45f5d2ab2c7b556d5b2445ac35daf48f

3 files changed, 17 insertions(+), 14 deletions(-)

jump to
M bot_test.gobot_test.go

@@ -682,14 +682,17 @@ ChatID: message.Chat.ID,

MessageID: message.MessageID, DisableNotification: false, } - _, err := bot.Request(pinChatMessageConfig) + + if _, err := bot.Request(pinChatMessageConfig); err != nil { + t.Error(err) + t.Fail() + } unpinChatMessageConfig := tgbotapi.UnpinChatMessageConfig{ ChatID: message.Chat.ID, } - _, err = bot.Request(unpinChatMessageConfig) - if err != nil { + if _, err := bot.Request(unpinChatMessageConfig); err != nil { t.Error(err) t.Fail() }
M configs.goconfigs.go

@@ -1269,19 +1269,19 @@ }

if config.PhotoHeight != 0 { v.Add("photo_height", strconv.Itoa(config.PhotoHeight)) } - if config.NeedName != false { + if config.NeedName { v.Add("need_name", strconv.FormatBool(config.NeedName)) } - if config.NeedPhoneNumber != false { + if config.NeedPhoneNumber { v.Add("need_phone_number", strconv.FormatBool(config.NeedPhoneNumber)) } - if config.NeedEmail != false { + if config.NeedEmail { v.Add("need_email", strconv.FormatBool(config.NeedEmail)) } - if config.NeedShippingAddress != false { + if config.NeedShippingAddress { v.Add("need_shipping_address", strconv.FormatBool(config.NeedShippingAddress)) } - if config.IsFlexible != false { + if config.IsFlexible { v.Add("is_flexible", strconv.FormatBool(config.IsFlexible)) }
M types_test.gotypes_test.go

@@ -49,7 +49,7 @@ func TestMessageIsCommandWithCommand(t *testing.T) {

message := tgbotapi.Message{Text: "/command"} message.Entities = &[]tgbotapi.MessageEntity{{Type: "bot_command", Offset: 0, Length: 8}} - if message.IsCommand() != true { + if !message.IsCommand() { t.Fail() } }

@@ -57,7 +57,7 @@

func TestIsCommandWithText(t *testing.T) { message := tgbotapi.Message{Text: "some text"} - if message.IsCommand() != false { + if message.IsCommand() { t.Fail() } }

@@ -65,7 +65,7 @@

func TestIsCommandWithEmptyText(t *testing.T) { message := tgbotapi.Message{Text: ""} - if message.IsCommand() != false { + if message.IsCommand() { t.Fail() } }

@@ -162,7 +162,7 @@

func TestChatIsPrivate(t *testing.T) { chat := tgbotapi.Chat{ID: 10, Type: "private"} - if chat.IsPrivate() != true { + if !chat.IsPrivate() { t.Fail() } }

@@ -170,7 +170,7 @@

func TestChatIsGroup(t *testing.T) { chat := tgbotapi.Chat{ID: 10, Type: "group"} - if chat.IsGroup() != true { + if !chat.IsGroup() { t.Fail() } }

@@ -178,7 +178,7 @@

func TestChatIsChannel(t *testing.T) { chat := tgbotapi.Chat{ID: 10, Type: "channel"} - if chat.IsChannel() != true { + if !chat.IsChannel() { t.Fail() } }