all repos — telegram-bot-api @ 5869b2f7f9f140da846f76e85fe7a14fb3e8f0c2

Golang bindings for the Telegram Bot API

Merge pull request #94 from mamal72/add-language-code-to-user

Add language code to user struct
Syfaro syfaro@foxpaw.in
Tue, 23 May 2017 02:53:20 -0500
commit

5869b2f7f9f140da846f76e85fe7a14fb3e8f0c2

parent

afe64e63be7f4c259261f3fb38dfe8b41f218e38

2 files changed, 9 insertions(+), 7 deletions(-)

jump to
M types.gotypes.go

@@ -49,10 +49,11 @@ }

// User is a user on Telegram. type User struct { - ID int `json:"id"` - FirstName string `json:"first_name"` - LastName string `json:"last_name"` // optional - UserName string `json:"username"` // optional + ID int `json:"id"` + FirstName string `json:"first_name"` + LastName string `json:"last_name"` // optional + UserName string `json:"username"` // optional + LanguageCode string `json:"language_code"` // optional } // String displays a simple text version of a user.
M types_test.gotypes_test.go

@@ -1,13 +1,14 @@

package tgbotapi_test import ( - "github.com/go-telegram-bot-api/telegram-bot-api" "testing" "time" + + "github.com/go-telegram-bot-api/telegram-bot-api" ) func TestUserStringWith(t *testing.T) { - user := tgbotapi.User{0, "Test", "Test", ""} + user := tgbotapi.User{0, "Test", "Test", "", "en"} if user.String() != "Test Test" { t.Fail()

@@ -15,7 +16,7 @@ }

} func TestUserStringWithUserName(t *testing.T) { - user := tgbotapi.User{0, "Test", "Test", "@test"} + user := tgbotapi.User{0, "Test", "Test", "@test", "en"} if user.String() != "@test" { t.Fail()