Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ func (config GameConfig) method() string {

// SetGameScoreConfig allows you to update the game score in a chat.
type SetGameScoreConfig struct {
UserID int
UserID int64
Score int
Force bool
DisableEditMessage bool
Expand All @@ -685,7 +685,7 @@ type SetGameScoreConfig struct {
func (config SetGameScoreConfig) params() (Params, error) {
params := make(Params)

params.AddNonZero("user_id", config.UserID)
params.AddNonZero64("user_id", config.UserID)
params.AddNonZero("scrore", config.Score)
params.AddBool("disable_edit_message", config.DisableEditMessage)

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

// GetGameHighScoresConfig allows you to fetch the high scores for a game.
type GetGameHighScoresConfig struct {
UserID int
ChatID int
UserID int64
ChatID int64
ChannelUsername string
MessageID int
InlineMessageID string
Expand All @@ -715,7 +715,7 @@ type GetGameHighScoresConfig struct {
func (config GetGameHighScoresConfig) params() (Params, error) {
params := make(Params)

params.AddNonZero("user_id", config.UserID)
params.AddNonZero64("user_id", config.UserID)

if config.InlineMessageID != "" {
params["inline_message_id"] = config.InlineMessageID
Expand Down Expand Up @@ -850,7 +850,7 @@ func (StopPollConfig) method() string {
// UserProfilePhotosConfig contains information about a
// GetUserProfilePhotos request.
type UserProfilePhotosConfig struct {
UserID int
UserID int64
Offset int
Limit int
}
Expand All @@ -862,7 +862,7 @@ func (UserProfilePhotosConfig) method() string {
func (config UserProfilePhotosConfig) params() (Params, error) {
params := make(Params)

params.AddNonZero("user_id", config.UserID)
params.AddNonZero64("user_id", config.UserID)
params.AddNonZero("offset", config.Offset)
params.AddNonZero("limit", config.Limit)

Expand Down Expand Up @@ -1041,7 +1041,7 @@ type ChatMemberConfig struct {
ChatID int64
SuperGroupUsername string
ChannelUsername string
UserID int
UserID int64
}

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

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)

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

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.AddBool("revoke_messages", config.RevokeMessages)

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

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)
params.AddNonZero64("until_date", config.UntilDate)
Expand Down Expand Up @@ -1133,7 +1133,7 @@ func (config PromoteChatMemberConfig) params() (Params, error) {
params := make(Params)

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("can_manage_chat", config.CanManageChat)
Expand Down Expand Up @@ -1165,7 +1165,7 @@ func (config SetChatAdministratorCustomTitle) params() (Params, error) {
params := make(Params)

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)

return params, nil
Expand Down Expand Up @@ -1345,14 +1345,14 @@ func (config LeaveChatConfig) params() (Params, error) {
type ChatConfigWithUser struct {
ChatID int64
SuperGroupUsername string
UserID int
UserID int64
}

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

params.AddFirstValid("chat_id", config.ChatID, config.SuperGroupUsername)
params.AddNonZero("user_id", config.UserID)
params.AddNonZero64("user_id", config.UserID)

return params, nil
}
Expand Down Expand Up @@ -1828,7 +1828,7 @@ func (config DeleteStickerConfig) params() (Params, error) {
// SetStickerSetThumbConfig allows you to set the thumbnail for a sticker set.
type SetStickerSetThumbConfig struct {
Name string
UserID int
UserID int64
Thumb interface{}
}

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

params["name"] = config.Name
params.AddNonZero("user_id", config.UserID)
params.AddNonZero64("user_id", config.UserID)

if thumb, ok := config.Thumb.(string); ok {
params["thumb"] = thumb
Expand Down
2 changes: 1 addition & 1 deletion helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ func NewChatAction(chatID int64, action string) ChatActionConfig {
// NewUserProfilePhotos gets user profile photos.
//
// 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{
UserID: userID,
Offset: 0,
Expand Down
10 changes: 2 additions & 8 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (ch UpdatesChannel) Clear() {
// User represents a Telegram user or bot.
type User struct {
// 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
//
// optional
Expand Down Expand Up @@ -180,12 +180,6 @@ func (u *User) String() string {
return name
}

// GroupChat is a group chat.
type GroupChat struct {
ID int `json:"id"`
Title string `json:"title"`
}

// Chat represents a chat.
type Chat struct {
// ID is a unique identifier for this chat
Expand Down Expand Up @@ -922,7 +916,7 @@ type Contact struct {
// UserID contact's user identifier in Telegram
//
// 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.
//
// optional
Expand Down