Skip to content

Commit 0a6e349

Browse files
authored
Merge pull request #431 from go-telegram-bot-api/userid-int64
Change UserID to int64
2 parents badaa40 + e03cd7f commit 0a6e349

File tree

3 files changed

+20
-20
lines changed

3 files changed

+20
-20
lines changed

configs.go

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

795795
// SetGameScoreConfig allows you to update the game score in a chat.
796796
type SetGameScoreConfig struct {
797-
UserID int
797+
UserID int64
798798
Score int
799799
Force bool
800800
DisableEditMessage bool
@@ -807,7 +807,7 @@ type SetGameScoreConfig struct {
807807
func (config SetGameScoreConfig) params() (Params, error) {
808808
params := make(Params)
809809

810-
params.AddNonZero("user_id", config.UserID)
810+
params.AddNonZero64("user_id", config.UserID)
811811
params.AddNonZero("scrore", config.Score)
812812
params.AddBool("disable_edit_message", config.DisableEditMessage)
813813

@@ -827,8 +827,8 @@ func (config SetGameScoreConfig) method() string {
827827

828828
// GetGameHighScoresConfig allows you to fetch the high scores for a game.
829829
type GetGameHighScoresConfig struct {
830-
UserID int
831-
ChatID int
830+
UserID int64
831+
ChatID int64
832832
ChannelUsername string
833833
MessageID int
834834
InlineMessageID string
@@ -837,7 +837,7 @@ type GetGameHighScoresConfig struct {
837837
func (config GetGameHighScoresConfig) params() (Params, error) {
838838
params := make(Params)
839839

840-
params.AddNonZero("user_id", config.UserID)
840+
params.AddNonZero64("user_id", config.UserID)
841841

842842
if config.InlineMessageID != "" {
843843
params["inline_message_id"] = config.InlineMessageID
@@ -979,7 +979,7 @@ func (StopPollConfig) method() string {
979979
// UserProfilePhotosConfig contains information about a
980980
// GetUserProfilePhotos request.
981981
type UserProfilePhotosConfig struct {
982-
UserID int
982+
UserID int64
983983
Offset int
984984
Limit int
985985
}
@@ -991,7 +991,7 @@ func (UserProfilePhotosConfig) method() string {
991991
func (config UserProfilePhotosConfig) params() (Params, error) {
992992
params := make(Params)
993993

994-
params.AddNonZero("user_id", config.UserID)
994+
params.AddNonZero64("user_id", config.UserID)
995995
params.AddNonZero("offset", config.Offset)
996996
params.AddNonZero("limit", config.Limit)
997997

@@ -1174,7 +1174,7 @@ type ChatMemberConfig struct {
11741174
ChatID int64
11751175
SuperGroupUsername string
11761176
ChannelUsername string
1177-
UserID int
1177+
UserID int64
11781178
}
11791179

11801180
// UnbanChatMemberConfig allows you to unban a user.
@@ -1191,7 +1191,7 @@ func (config UnbanChatMemberConfig) params() (Params, error) {
11911191
params := make(Params)
11921192

11931193
params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername)
1194-
params.AddNonZero("user_id", config.UserID)
1194+
params.AddNonZero64("user_id", config.UserID)
11951195
params.AddBool("only_if_banned", config.OnlyIfBanned)
11961196

11971197
return params, nil
@@ -1212,7 +1212,7 @@ func (config KickChatMemberConfig) params() (Params, error) {
12121212
params := make(Params)
12131213

12141214
params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername)
1215-
params.AddNonZero("user_id", config.UserID)
1215+
params.AddNonZero64("user_id", config.UserID)
12161216
params.AddNonZero64("until_date", config.UntilDate)
12171217
params.AddBool("revoke_messages", config.RevokeMessages)
12181218

@@ -1234,7 +1234,7 @@ func (config RestrictChatMemberConfig) params() (Params, error) {
12341234
params := make(Params)
12351235

12361236
params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername)
1237-
params.AddNonZero("user_id", config.UserID)
1237+
params.AddNonZero64("user_id", config.UserID)
12381238

12391239
err := params.AddInterface("permissions", config.Permissions)
12401240
params.AddNonZero64("until_date", config.UntilDate)
@@ -1266,7 +1266,7 @@ func (config PromoteChatMemberConfig) params() (Params, error) {
12661266
params := make(Params)
12671267

12681268
params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername)
1269-
params.AddNonZero("user_id", config.UserID)
1269+
params.AddNonZero64("user_id", config.UserID)
12701270

12711271
params.AddBool("is_anonymous", config.IsAnonymous)
12721272
params.AddBool("can_manage_chat", config.CanManageChat)
@@ -1298,7 +1298,7 @@ func (config SetChatAdministratorCustomTitle) params() (Params, error) {
12981298
params := make(Params)
12991299

13001300
params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername)
1301-
params.AddNonZero("user_id", config.UserID)
1301+
params.AddNonZero64("user_id", config.UserID)
13021302
params.AddNonEmpty("custom_title", config.CustomTitle)
13031303

13041304
return params, nil
@@ -1478,14 +1478,14 @@ func (config LeaveChatConfig) params() (Params, error) {
14781478
type ChatConfigWithUser struct {
14791479
ChatID int64
14801480
SuperGroupUsername string
1481-
UserID int
1481+
UserID int64
14821482
}
14831483

14841484
func (config ChatConfigWithUser) params() (Params, error) {
14851485
params := make(Params)
14861486

14871487
params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername)
1488-
params.AddNonZero("user_id", config.UserID)
1488+
params.AddNonZero64("user_id", config.UserID)
14891489

14901490
return params, nil
14911491
}
@@ -1930,7 +1930,7 @@ func (config DeleteStickerConfig) params() (Params, error) {
19301930
// SetStickerSetThumbConfig allows you to set the thumbnail for a sticker set.
19311931
type SetStickerSetThumbConfig struct {
19321932
Name string
1933-
UserID int
1933+
UserID int64
19341934
Thumb interface{}
19351935
}
19361936

@@ -1942,7 +1942,7 @@ func (config SetStickerSetThumbConfig) params() (Params, error) {
19421942
params := make(Params)
19431943

19441944
params["name"] = config.Name
1945-
params.AddNonZero("user_id", config.UserID)
1945+
params.AddNonZero64("user_id", config.UserID)
19461946

19471947
return params, nil
19481948
}

helpers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ func NewChatAction(chatID int64, action string) ChatActionConfig {
277277
// NewUserProfilePhotos gets user profile photos.
278278
//
279279
// userID is the ID of the user you wish to get profile photos from.
280-
func NewUserProfilePhotos(userID int) UserProfilePhotosConfig {
280+
func NewUserProfilePhotos(userID int64) UserProfilePhotosConfig {
281281
return UserProfilePhotosConfig{
282282
UserID: userID,
283283
Offset: 0,

types.go

Lines changed: 2 additions & 2 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
@@ -916,7 +916,7 @@ type Contact struct {
916916
// UserID contact's user identifier in Telegram
917917
//
918918
// optional
919-
UserID int `json:"user_id,omitempty"`
919+
UserID int64 `json:"user_id,omitempty"`
920920
// VCard is additional data about the contact in the form of a vCard.
921921
//
922922
// optional

0 commit comments

Comments
 (0)