Resolve some linter issues.

bot-api-6.1
Syfaro 2017-12-28 23:17:32 -06:00
parent 2022d04b94
commit e97c2417c9
2 changed files with 15 additions and 6 deletions

View File

@ -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)

View File

@ -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.