Skip to content

Commit e03cd7f

Browse files
committed
Change UserID to int64.
1 parent 24d4f79 commit e03cd7f

File tree

3 files changed

+20
-26
lines changed

3 files changed

+20
-26
lines changed

configs.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ func (config GameConfig) method() string {
672672

673673
// SetGameScoreConfig allows you to update the game score in a chat.
674674
type SetGameScoreConfig struct {
675-
UserID int
675+
UserID int64
676676
Score int
677677
Force bool
678678
DisableEditMessage bool
@@ -685,7 +685,7 @@ type SetGameScoreConfig struct {
685685
func (config SetGameScoreConfig) params() (Params, error) {
686686
params := make(Params)
687687

688-
params.AddNonZero("user_id", config.UserID)
688+
params.AddNonZero64("user_id", config.UserID)
689689
params.AddNonZero("scrore", config.Score)
690690
params.AddBool("disable_edit_message", config.DisableEditMessage)
691691

@@ -705,8 +705,8 @@ func (config SetGameScoreConfig) method() string {
705705

706706
// GetGameHighScoresConfig allows you to fetch the high scores for a game.
707707
type GetGameHighScoresConfig struct {
708-
UserID int
709-
ChatID int
708+
UserID int64
709+
ChatID int64
710710
ChannelUsername string
711711
MessageID int
712712
InlineMessageID string
@@ -715,7 +715,7 @@ type GetGameHighScoresConfig struct {
715715
func (config GetGameHighScoresConfig) params() (Params, error) {
716716
params := make(Params)
717717

718-
params.AddNonZero("user_id", config.UserID)
718+
params.AddNonZero64("user_id", config.UserID)
719719

720720
if config.InlineMessageID != "" {
721721
params["inline_message_id"] = config.InlineMessageID
@@ -850,7 +850,7 @@ func (StopPollConfig) method() string {
850850
// UserProfilePhotosConfig contains information about a
851851
// GetUserProfilePhotos request.
852852
type UserProfilePhotosConfig struct {
853-
UserID int
853+
UserID int64
854854
Offset int
855855
Limit int
856856
}
@@ -862,7 +862,7 @@ func (UserProfilePhotosConfig) method() string {
862862
func (config UserProfilePhotosConfig) params() (Params, error) {
863863
params := make(Params)
864864

865-
params.AddNonZero("user_id", config.UserID)
865+
params.AddNonZero64("user_id", config.UserID)
866866
params.AddNonZero("offset", config.Offset)
867867
params.AddNonZero("limit", config.Limit)
868868

@@ -1041,7 +1041,7 @@ type ChatMemberConfig struct {
10411041
ChatID int64
10421042
SuperGroupUsername string
10431043
ChannelUsername string
1044-
UserID int
1044+
UserID int64
10451045
}
10461046

10471047
// UnbanChatMemberConfig allows you to unban a user.
@@ -1058,7 +1058,7 @@ func (config UnbanChatMemberConfig) params() (Params, error) {
10581058
params := make(Params)
10591059

10601060
params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername)
1061-
params.AddNonZero("user_id", config.UserID)
1061+
params.AddNonZero64("user_id", config.UserID)
10621062
params.AddBool("only_if_banned", config.OnlyIfBanned)
10631063

10641064
return params, nil
@@ -1079,7 +1079,7 @@ func (config KickChatMemberConfig) params() (Params, error) {
10791079
params := make(Params)
10801080

10811081
params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername)
1082-
params.AddNonZero("user_id", config.UserID)
1082+
params.AddNonZero64("user_id", config.UserID)
10831083
params.AddNonZero64("until_date", config.UntilDate)
10841084
params.AddBool("revoke_messages", config.RevokeMessages)
10851085

@@ -1101,7 +1101,7 @@ func (config RestrictChatMemberConfig) params() (Params, error) {
11011101
params := make(Params)
11021102

11031103
params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername)
1104-
params.AddNonZero("user_id", config.UserID)
1104+
params.AddNonZero64("user_id", config.UserID)
11051105

11061106
err := params.AddInterface("permissions", config.Permissions)
11071107
params.AddNonZero64("until_date", config.UntilDate)
@@ -1133,7 +1133,7 @@ func (config PromoteChatMemberConfig) params() (Params, error) {
11331133
params := make(Params)
11341134

11351135
params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername)
1136-
params.AddNonZero("user_id", config.UserID)
1136+
params.AddNonZero64("user_id", config.UserID)
11371137

11381138
params.AddBool("is_anonymous", config.IsAnonymous)
11391139
params.AddBool("can_manage_chat", config.CanManageChat)
@@ -1165,7 +1165,7 @@ func (config SetChatAdministratorCustomTitle) params() (Params, error) {
11651165
params := make(Params)
11661166

11671167
params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername)
1168-
params.AddNonZero("user_id", config.UserID)
1168+
params.AddNonZero64("user_id", config.UserID)
11691169
params.AddNonEmpty("custom_title", config.CustomTitle)
11701170

11711171
return params, nil
@@ -1345,14 +1345,14 @@ func (config LeaveChatConfig) params() (Params, error) {
13451345
type ChatConfigWithUser struct {
13461346
ChatID int64
13471347
SuperGroupUsername string
1348-
UserID int
1348+
UserID int64
13491349
}
13501350

13511351
func (config ChatConfigWithUser) params() (Params, error) {
13521352
params := make(Params)
13531353

13541354
params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername)
1355-
params.AddNonZero("user_id", config.UserID)
1355+
params.AddNonZero64("user_id", config.UserID)
13561356

13571357
return params, nil
13581358
}
@@ -1828,7 +1828,7 @@ func (config DeleteStickerConfig) params() (Params, error) {
18281828
// SetStickerSetThumbConfig allows you to set the thumbnail for a sticker set.
18291829
type SetStickerSetThumbConfig struct {
18301830
Name string
1831-
UserID int
1831+
UserID int64
18321832
Thumb interface{}
18331833
}
18341834

@@ -1840,7 +1840,7 @@ func (config SetStickerSetThumbConfig) params() (Params, error) {
18401840
params := make(Params)
18411841

18421842
params["name"] = config.Name
1843-
params.AddNonZero("user_id", config.UserID)
1843+
params.AddNonZero64("user_id", config.UserID)
18441844

18451845
if thumb, ok := config.Thumb.(string); ok {
18461846
params["thumb"] = thumb

helpers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ func NewChatAction(chatID int64, action string) ChatActionConfig {
431431
// NewUserProfilePhotos gets user profile photos.
432432
//
433433
// userID is the ID of the user you wish to get profile photos from.
434-
func NewUserProfilePhotos(userID int) UserProfilePhotosConfig {
434+
func NewUserProfilePhotos(userID int64) UserProfilePhotosConfig {
435435
return UserProfilePhotosConfig{
436436
UserID: userID,
437437
Offset: 0,

types.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func (ch UpdatesChannel) Clear() {
123123
// User represents a Telegram user or bot.
124124
type User struct {
125125
// ID is a unique identifier for this user or bot
126-
ID int `json:"id"`
126+
ID int64 `json:"id"`
127127
// IsBot true, if this user is a bot
128128
//
129129
// optional
@@ -180,12 +180,6 @@ func (u *User) String() string {
180180
return name
181181
}
182182

183-
// GroupChat is a group chat.
184-
type GroupChat struct {
185-
ID int `json:"id"`
186-
Title string `json:"title"`
187-
}
188-
189183
// Chat represents a chat.
190184
type Chat struct {
191185
// ID is a unique identifier for this chat
@@ -922,7 +916,7 @@ type Contact struct {
922916
// UserID contact's user identifier in Telegram
923917
//
924918
// optional
925-
UserID int `json:"user_id,omitempty"`
919+
UserID int64 `json:"user_id,omitempty"`
926920
// VCard is additional data about the contact in the form of a vCard.
927921
//
928922
// optional

0 commit comments

Comments
 (0)