Skip to content

Commit

Permalink
change user id type to int64
Browse files Browse the repository at this point in the history
  • Loading branch information
demget committed Dec 8, 2021
1 parent 3bc3f20 commit f1c5a5b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions bot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand All @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion media.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit f1c5a5b

Please sign in to comment.