feat(types): add language code to user struct
parent
afe64e63be
commit
f1ed87c281
1
types.go
1
types.go
|
@ -53,6 +53,7 @@ type User struct {
|
||||||
FirstName string `json:"first_name"`
|
FirstName string `json:"first_name"`
|
||||||
LastName string `json:"last_name"` // optional
|
LastName string `json:"last_name"` // optional
|
||||||
UserName string `json:"username"` // optional
|
UserName string `json:"username"` // optional
|
||||||
|
LanguageCode string `json:"language_code"` // optional
|
||||||
}
|
}
|
||||||
|
|
||||||
// String displays a simple text version of a user.
|
// String displays a simple text version of a user.
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package tgbotapi_test
|
package tgbotapi_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/go-telegram-bot-api/telegram-bot-api"
|
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/go-telegram-bot-api/telegram-bot-api"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestUserStringWith(t *testing.T) {
|
func TestUserStringWith(t *testing.T) {
|
||||||
user := tgbotapi.User{0, "Test", "Test", ""}
|
user := tgbotapi.User{0, "Test", "Test", "", "en"}
|
||||||
|
|
||||||
if user.String() != "Test Test" {
|
if user.String() != "Test Test" {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
|
@ -15,7 +16,7 @@ func TestUserStringWith(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUserStringWithUserName(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" {
|
if user.String() != "@test" {
|
||||||
t.Fail()
|
t.Fail()
|
||||||
|
|
Loading…
Reference in New Issue