Skip to content

Commit f1c5a5b

Browse files
committed
change user id type to int64
1 parent 3bc3f20 commit f1c5a5b

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

bot_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ import (
1313
)
1414

1515
const (
16-
photoID = "AgACAgIAAxkDAAIBV16Ybpg7l2jPgMUiiLJ3WaQOUqTrAAJorjEbh2TBSPSOinaCHfydQO_pki4AAwEAAwIAA3kAA_NQAAIYBA"
16+
photoURL = "https://telegra.ph/file/4e477a2abc5f53c0bb4aa.jpg"
1717
)
1818

1919
var (
2020
// required to test send and edit methods
2121
token = os.Getenv("TELEBOT_SECRET")
2222
chatID, _ = strconv.ParseInt(os.Getenv("CHAT_ID"), 10, 64)
23-
userID, _ = strconv.Atoi(os.Getenv("USER_ID"))
23+
userID, _ = strconv.ParseInt(os.Getenv("USER_ID"), 10, 64)
2424

2525
b, _ = newTestBot() // cached bot instance to avoid getMe method flooding
2626
to = &Chat{ID: chatID} // to chat recipient for send and edit methods
@@ -313,7 +313,7 @@ func TestBot(t *testing.T) {
313313
assert.Equal(t, ErrBadRecipient, err)
314314

315315
photo := &Photo{
316-
File: File{FileID: photoID},
316+
File: File{FileURL: photoURL},
317317
Caption: t.Name(),
318318
}
319319
var msg *Message

chat.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import "strconv"
44

55
// User object represents a Telegram user, bot.
66
type User struct {
7-
ID int `json:"id"`
7+
ID int64 `json:"id"`
88

99
FirstName string `json:"first_name"`
1010
LastName string `json:"last_name"`
@@ -20,7 +20,7 @@ type User struct {
2020

2121
// Recipient returns user ID (see Recipient interface).
2222
func (u *User) Recipient() string {
23-
return strconv.Itoa(u.ID)
23+
return strconv.FormatInt(u.ID, 10)
2424
}
2525

2626
// Chat object represents a Telegram user, bot, group or a channel.

media.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ type Contact struct {
184184

185185
// (Optional)
186186
LastName string `json:"last_name"`
187-
UserID int `json:"user_id,omitempty"`
187+
UserID int64 `json:"user_id,omitempty"`
188188
}
189189

190190
// Location object represents geographic position.

0 commit comments

Comments
 (0)