Merge pull request #431 from go-telegram-bot-api/userid-int64

Change UserID to int64
bot-api-6.1
Syfaro 2021-03-10 14:59:37 -05:00 committed by GitHub
commit 0a6e349f52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 20 deletions

View File

@ -794,7 +794,7 @@ func (config GameConfig) method() string {
// SetGameScoreConfig allows you to update the game score in a chat. // SetGameScoreConfig allows you to update the game score in a chat.
type SetGameScoreConfig struct { type SetGameScoreConfig struct {
UserID int UserID int64
Score int Score int
Force bool Force bool
DisableEditMessage bool DisableEditMessage bool
@ -807,7 +807,7 @@ type SetGameScoreConfig struct {
func (config SetGameScoreConfig) params() (Params, error) { func (config SetGameScoreConfig) params() (Params, error) {
params := make(Params) params := make(Params)
params.AddNonZero("user_id", config.UserID) params.AddNonZero64("user_id", config.UserID)
params.AddNonZero("scrore", config.Score) params.AddNonZero("scrore", config.Score)
params.AddBool("disable_edit_message", config.DisableEditMessage) params.AddBool("disable_edit_message", config.DisableEditMessage)
@ -827,8 +827,8 @@ func (config SetGameScoreConfig) method() string {
// GetGameHighScoresConfig allows you to fetch the high scores for a game. // GetGameHighScoresConfig allows you to fetch the high scores for a game.
type GetGameHighScoresConfig struct { type GetGameHighScoresConfig struct {
UserID int UserID int64
ChatID int ChatID int64
ChannelUsername string ChannelUsername string
MessageID int MessageID int
InlineMessageID string InlineMessageID string
@ -837,7 +837,7 @@ type GetGameHighScoresConfig struct {
func (config GetGameHighScoresConfig) params() (Params, error) { func (config GetGameHighScoresConfig) params() (Params, error) {
params := make(Params) params := make(Params)
params.AddNonZero("user_id", config.UserID) params.AddNonZero64("user_id", config.UserID)
if config.InlineMessageID != "" { if config.InlineMessageID != "" {
params["inline_message_id"] = config.InlineMessageID params["inline_message_id"] = config.InlineMessageID
@ -979,7 +979,7 @@ func (StopPollConfig) method() string {
// UserProfilePhotosConfig contains information about a // UserProfilePhotosConfig contains information about a
// GetUserProfilePhotos request. // GetUserProfilePhotos request.
type UserProfilePhotosConfig struct { type UserProfilePhotosConfig struct {
UserID int UserID int64
Offset int Offset int
Limit int Limit int
} }
@ -991,7 +991,7 @@ func (UserProfilePhotosConfig) method() string {
func (config UserProfilePhotosConfig) params() (Params, error) { func (config UserProfilePhotosConfig) params() (Params, error) {
params := make(Params) params := make(Params)
params.AddNonZero("user_id", config.UserID) params.AddNonZero64("user_id", config.UserID)
params.AddNonZero("offset", config.Offset) params.AddNonZero("offset", config.Offset)
params.AddNonZero("limit", config.Limit) params.AddNonZero("limit", config.Limit)
@ -1174,7 +1174,7 @@ type ChatMemberConfig struct {
ChatID int64 ChatID int64
SuperGroupUsername string SuperGroupUsername string
ChannelUsername string ChannelUsername string
UserID int UserID int64
} }
// UnbanChatMemberConfig allows you to unban a user. // UnbanChatMemberConfig allows you to unban a user.
@ -1191,7 +1191,7 @@ func (config UnbanChatMemberConfig) params() (Params, error) {
params := make(Params) params := make(Params)
params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername) params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername)
params.AddNonZero("user_id", config.UserID) params.AddNonZero64("user_id", config.UserID)
params.AddBool("only_if_banned", config.OnlyIfBanned) params.AddBool("only_if_banned", config.OnlyIfBanned)
return params, nil return params, nil
@ -1212,7 +1212,7 @@ func (config KickChatMemberConfig) params() (Params, error) {
params := make(Params) params := make(Params)
params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername) params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername)
params.AddNonZero("user_id", config.UserID) params.AddNonZero64("user_id", config.UserID)
params.AddNonZero64("until_date", config.UntilDate) params.AddNonZero64("until_date", config.UntilDate)
params.AddBool("revoke_messages", config.RevokeMessages) params.AddBool("revoke_messages", config.RevokeMessages)
@ -1234,7 +1234,7 @@ func (config RestrictChatMemberConfig) params() (Params, error) {
params := make(Params) params := make(Params)
params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername) params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername)
params.AddNonZero("user_id", config.UserID) params.AddNonZero64("user_id", config.UserID)
err := params.AddInterface("permissions", config.Permissions) err := params.AddInterface("permissions", config.Permissions)
params.AddNonZero64("until_date", config.UntilDate) params.AddNonZero64("until_date", config.UntilDate)
@ -1266,7 +1266,7 @@ func (config PromoteChatMemberConfig) params() (Params, error) {
params := make(Params) params := make(Params)
params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername) params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername)
params.AddNonZero("user_id", config.UserID) params.AddNonZero64("user_id", config.UserID)
params.AddBool("is_anonymous", config.IsAnonymous) params.AddBool("is_anonymous", config.IsAnonymous)
params.AddBool("can_manage_chat", config.CanManageChat) params.AddBool("can_manage_chat", config.CanManageChat)
@ -1298,7 +1298,7 @@ func (config SetChatAdministratorCustomTitle) params() (Params, error) {
params := make(Params) params := make(Params)
params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername) params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername, config.ChannelUsername)
params.AddNonZero("user_id", config.UserID) params.AddNonZero64("user_id", config.UserID)
params.AddNonEmpty("custom_title", config.CustomTitle) params.AddNonEmpty("custom_title", config.CustomTitle)
return params, nil return params, nil
@ -1478,14 +1478,14 @@ func (config LeaveChatConfig) params() (Params, error) {
type ChatConfigWithUser struct { type ChatConfigWithUser struct {
ChatID int64 ChatID int64
SuperGroupUsername string SuperGroupUsername string
UserID int UserID int64
} }
func (config ChatConfigWithUser) params() (Params, error) { func (config ChatConfigWithUser) params() (Params, error) {
params := make(Params) params := make(Params)
params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername) params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername)
params.AddNonZero("user_id", config.UserID) params.AddNonZero64("user_id", config.UserID)
return params, nil return params, nil
} }
@ -1930,7 +1930,7 @@ func (config DeleteStickerConfig) params() (Params, error) {
// SetStickerSetThumbConfig allows you to set the thumbnail for a sticker set. // SetStickerSetThumbConfig allows you to set the thumbnail for a sticker set.
type SetStickerSetThumbConfig struct { type SetStickerSetThumbConfig struct {
Name string Name string
UserID int UserID int64
Thumb interface{} Thumb interface{}
} }
@ -1942,7 +1942,7 @@ func (config SetStickerSetThumbConfig) params() (Params, error) {
params := make(Params) params := make(Params)
params["name"] = config.Name params["name"] = config.Name
params.AddNonZero("user_id", config.UserID) params.AddNonZero64("user_id", config.UserID)
return params, nil return params, nil
} }

View File

@ -277,7 +277,7 @@ func NewChatAction(chatID int64, action string) ChatActionConfig {
// NewUserProfilePhotos gets user profile photos. // NewUserProfilePhotos gets user profile photos.
// //
// userID is the ID of the user you wish to get profile photos from. // userID is the ID of the user you wish to get profile photos from.
func NewUserProfilePhotos(userID int) UserProfilePhotosConfig { func NewUserProfilePhotos(userID int64) UserProfilePhotosConfig {
return UserProfilePhotosConfig{ return UserProfilePhotosConfig{
UserID: userID, UserID: userID,
Offset: 0, Offset: 0,

View File

@ -123,7 +123,7 @@ func (ch UpdatesChannel) Clear() {
// User represents a Telegram user or bot. // User represents a Telegram user or bot.
type User struct { type User struct {
// ID is a unique identifier for this user or bot // ID is a unique identifier for this user or bot
ID int `json:"id"` ID int64 `json:"id"`
// IsBot true, if this user is a bot // IsBot true, if this user is a bot
// //
// optional // optional
@ -916,7 +916,7 @@ type Contact struct {
// UserID contact's user identifier in Telegram // UserID contact's user identifier in Telegram
// //
// optional // optional
UserID int `json:"user_id,omitempty"` UserID int64 `json:"user_id,omitempty"`
// VCard is additional data about the contact in the form of a vCard. // VCard is additional data about the contact in the form of a vCard.
// //
// optional // optional