change user id type to int64

pull/462/head v2.5.0
Demian 3 years ago
parent 3bc3f20eed
commit f1c5a5b197

@ -13,14 +13,14 @@ import (
)
const (
photoID = "AgACAgIAAxkDAAIBV16Ybpg7l2jPgMUiiLJ3WaQOUqTrAAJorjEbh2TBSPSOinaCHfydQO_pki4AAwEAAwIAA3kAA_NQAAIYBA"
photoURL = "https://telegra.ph/file/4e477a2abc5f53c0bb4aa.jpg"
)
var (
// required to test send and edit methods
token = os.Getenv("TELEBOT_SECRET")
chatID, _ = strconv.ParseInt(os.Getenv("CHAT_ID"), 10, 64)
userID, _ = strconv.Atoi(os.Getenv("USER_ID"))
userID, _ = strconv.ParseInt(os.Getenv("USER_ID"), 10, 64)
b, _ = newTestBot() // cached bot instance to avoid getMe method flooding
to = &Chat{ID: chatID} // to chat recipient for send and edit methods
@ -313,7 +313,7 @@ func TestBot(t *testing.T) {
assert.Equal(t, ErrBadRecipient, err)
photo := &Photo{
File: File{FileID: photoID},
File: File{FileURL: photoURL},
Caption: t.Name(),
}
var msg *Message

@ -4,7 +4,7 @@ import "strconv"
// User object represents a Telegram user, bot.
type User struct {
ID int `json:"id"`
ID int64 `json:"id"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
@ -20,7 +20,7 @@ type User struct {
// Recipient returns user ID (see Recipient interface).
func (u *User) Recipient() string {
return strconv.Itoa(u.ID)
return strconv.FormatInt(u.ID, 10)
}
// Chat object represents a Telegram user, bot, group or a channel.

@ -184,7 +184,7 @@ type Contact struct {
// (Optional)
LastName string `json:"last_name"`
UserID int `json:"user_id,omitempty"`
UserID int64 `json:"user_id,omitempty"`
}
// Location object represents geographic position.

Loading…
Cancel
Save