From f1ed87c281bce26d44a3143f9bff10f3ddc8b19c Mon Sep 17 00:00:00 2001 From: mamal Date: Mon, 22 May 2017 12:40:04 +0430 Subject: [PATCH] feat(types): add language code to user struct --- types.go | 9 +++++---- types_test.go | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/types.go b/types.go index 31f70e0..e3908de 100644 --- a/types.go +++ b/types.go @@ -49,10 +49,11 @@ func (ch UpdatesChannel) Clear() { // 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. diff --git a/types_test.go b/types_test.go index 5ef21a9..d2c24d4 100644 --- a/types_test.go +++ b/types_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 TestUserStringWith(t *testing.T) { } 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()