More various small code quality improvements.
parent
1aef8c8c45
commit
b728fa78fc
|
@ -682,14 +682,17 @@ func TestUnpinChatMessage(t *testing.T) {
|
||||||
MessageID: message.MessageID,
|
MessageID: message.MessageID,
|
||||||
DisableNotification: false,
|
DisableNotification: false,
|
||||||
}
|
}
|
||||||
_, err := bot.Request(pinChatMessageConfig)
|
|
||||||
|
if _, err := bot.Request(pinChatMessageConfig); err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
t.Fail()
|
||||||
|
}
|
||||||
|
|
||||||
unpinChatMessageConfig := tgbotapi.UnpinChatMessageConfig{
|
unpinChatMessageConfig := tgbotapi.UnpinChatMessageConfig{
|
||||||
ChatID: message.Chat.ID,
|
ChatID: message.Chat.ID,
|
||||||
}
|
}
|
||||||
_, err = bot.Request(unpinChatMessageConfig)
|
|
||||||
|
|
||||||
if err != nil {
|
if _, err := bot.Request(unpinChatMessageConfig); err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
|
|
10
configs.go
10
configs.go
|
@ -1269,19 +1269,19 @@ func (config InvoiceConfig) values() (url.Values, error) {
|
||||||
if config.PhotoHeight != 0 {
|
if config.PhotoHeight != 0 {
|
||||||
v.Add("photo_height", strconv.Itoa(config.PhotoHeight))
|
v.Add("photo_height", strconv.Itoa(config.PhotoHeight))
|
||||||
}
|
}
|
||||||
if config.NeedName != false {
|
if config.NeedName {
|
||||||
v.Add("need_name", strconv.FormatBool(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))
|
v.Add("need_phone_number", strconv.FormatBool(config.NeedPhoneNumber))
|
||||||
}
|
}
|
||||||
if config.NeedEmail != false {
|
if config.NeedEmail {
|
||||||
v.Add("need_email", strconv.FormatBool(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))
|
v.Add("need_shipping_address", strconv.FormatBool(config.NeedShippingAddress))
|
||||||
}
|
}
|
||||||
if config.IsFlexible != false {
|
if config.IsFlexible {
|
||||||
v.Add("is_flexible", strconv.FormatBool(config.IsFlexible))
|
v.Add("is_flexible", strconv.FormatBool(config.IsFlexible))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ func TestMessageIsCommandWithCommand(t *testing.T) {
|
||||||
message := tgbotapi.Message{Text: "/command"}
|
message := tgbotapi.Message{Text: "/command"}
|
||||||
message.Entities = &[]tgbotapi.MessageEntity{{Type: "bot_command", Offset: 0, Length: 8}}
|
message.Entities = &[]tgbotapi.MessageEntity{{Type: "bot_command", Offset: 0, Length: 8}}
|
||||||
|
|
||||||
if message.IsCommand() != true {
|
if !message.IsCommand() {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ func TestMessageIsCommandWithCommand(t *testing.T) {
|
||||||
func TestIsCommandWithText(t *testing.T) {
|
func TestIsCommandWithText(t *testing.T) {
|
||||||
message := tgbotapi.Message{Text: "some text"}
|
message := tgbotapi.Message{Text: "some text"}
|
||||||
|
|
||||||
if message.IsCommand() != false {
|
if message.IsCommand() {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ func TestIsCommandWithText(t *testing.T) {
|
||||||
func TestIsCommandWithEmptyText(t *testing.T) {
|
func TestIsCommandWithEmptyText(t *testing.T) {
|
||||||
message := tgbotapi.Message{Text: ""}
|
message := tgbotapi.Message{Text: ""}
|
||||||
|
|
||||||
if message.IsCommand() != false {
|
if message.IsCommand() {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ func TestMessageEntityParseURLBad(t *testing.T) {
|
||||||
func TestChatIsPrivate(t *testing.T) {
|
func TestChatIsPrivate(t *testing.T) {
|
||||||
chat := tgbotapi.Chat{ID: 10, Type: "private"}
|
chat := tgbotapi.Chat{ID: 10, Type: "private"}
|
||||||
|
|
||||||
if chat.IsPrivate() != true {
|
if !chat.IsPrivate() {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ func TestChatIsPrivate(t *testing.T) {
|
||||||
func TestChatIsGroup(t *testing.T) {
|
func TestChatIsGroup(t *testing.T) {
|
||||||
chat := tgbotapi.Chat{ID: 10, Type: "group"}
|
chat := tgbotapi.Chat{ID: 10, Type: "group"}
|
||||||
|
|
||||||
if chat.IsGroup() != true {
|
if !chat.IsGroup() {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ func TestChatIsGroup(t *testing.T) {
|
||||||
func TestChatIsChannel(t *testing.T) {
|
func TestChatIsChannel(t *testing.T) {
|
||||||
chat := tgbotapi.Chat{ID: 10, Type: "channel"}
|
chat := tgbotapi.Chat{ID: 10, Type: "channel"}
|
||||||
|
|
||||||
if chat.IsChannel() != true {
|
if !chat.IsChannel() {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue