FILE / ScuroNeko/Laniakea

tgapi/users_methods.go

Исходный файл и его история в репозитории.
FILE 29b208eeec6d77c16e9b5c5a4c4d280b36c10dea
Files
Laniakea/tgapi/users_methods.go
T
ScuroNeko 29b208eeec
Golang lint / lint (push) Successful in 11m32s
(new): v1.2 release
2026-08-19 14:58:25 +03:00

172 lines
7.9 KiB
Go

package tgapi
import "context"
// GetUserProfilePhotos holds parameters for the GetUserProfilePhotos method.
// Since: Bot API 1.4
// See https://core.telegram.org/bots/api#getuserprofilephotos
type GetUserProfilePhotos struct {
// UserID Required. Unique identifier of the target user
UserID int64 `json:"user_id"`
// Offset Optional. Sequential number of the first photo to be returned. By default, all photos are
// returned.
Offset int `json:"offset,omitempty"`
// Limit Optional. Limits the number of photos to be retrieved. Values between 1-100 are accepted. Defaults
// to 100.
Limit int `json:"limit,omitempty"`
}
// GetUserProfilePhotos returns a list of profile pictures for a user.
// Since: Bot API 1.4
// See https://core.telegram.org/bots/api#getuserprofilephotos
func (api *API) GetUserProfilePhotos(params GetUserProfilePhotos) (UserProfilePhotos, error) {
req := NewRequest[UserProfilePhotos]("getUserProfilePhotos", params)
return req.Do(api)
}
// GetUserProfilePhotosWithContext is the context-aware variant of GetUserProfilePhotos.
// Since: Bot API 1.4
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#getuserprofilephotos
func (api *API) GetUserProfilePhotosWithContext(ctx context.Context, params GetUserProfilePhotos) (UserProfilePhotos, error) {
req := NewRequest[UserProfilePhotos]("getUserProfilePhotos", params)
return req.DoWithContext(ctx, api)
}
// GetUserProfileAudios holds parameters for the GetUserProfileAudios method.
// Since: Bot API 9.3
// See https://core.telegram.org/bots/api#getuserprofileaudios
type GetUserProfileAudios struct {
// UserID Required. Unique identifier of the target user
UserID int64 `json:"user_id"`
// Offset Optional. Sequential number of the first audio to be returned. By default, all audios are
// returned.
Offset int `json:"offset,omitempty"`
// Limit Optional. Limits the number of audios to be retrieved. Values between 1-100 are accepted. Defaults
// to 100.
Limit int `json:"limit,omitempty"`
}
// GetUserProfileAudios returns a list of profile audios for a user.
// Since: Bot API 9.3
// See https://core.telegram.org/bots/api#getuserprofileaudios
func (api *API) GetUserProfileAudios(params GetUserProfileAudios) (UserProfileAudios, error) {
req := NewRequest[UserProfileAudios]("getUserProfileAudios", params)
return req.Do(api)
}
// GetUserProfileAudiosWithContext is the context-aware variant of GetUserProfileAudios.
// Since: Bot API 9.3
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#getuserprofileaudios
func (api *API) GetUserProfileAudiosWithContext(ctx context.Context, params GetUserProfileAudios) (UserProfileAudios, error) {
req := NewRequest[UserProfileAudios]("getUserProfileAudios", params)
return req.DoWithContext(ctx, api)
}
// SetUserEmojiStatus holds parameters for the SetUserEmojiStatus method.
// Since: Bot API 8.0
// See https://core.telegram.org/bots/api#setuseremojistatus
type SetUserEmojiStatus struct {
// UserID Required. Unique identifier of the target user
UserID int64 `json:"user_id"`
// EmojiID Optional. Custom emoji identifier of the emoji status to set. Pass an empty string to remove the
// status.
EmojiID string `json:"emoji_status_custom_emoji_id,omitempty"`
// ExpirationDate Optional. Expiration date of the emoji status, if any
ExpirationDate int `json:"emoji_status_expiration_date,omitempty"`
}
// SetUserEmojiStatus sets a custom emoji status for a user.
// Since: Bot API 8.0
// Returns true on success.
// See https://core.telegram.org/bots/api#setuseremojistatus
func (api *API) SetUserEmojiStatus(params SetUserEmojiStatus) (bool, error) {
req := NewRequest[bool]("setUserEmojiStatus", params)
return req.Do(api)
}
// SetUserEmojiStatusWithContext is the context-aware variant of SetUserEmojiStatus.
// Since: Bot API 8.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#setuseremojistatus
func (api *API) SetUserEmojiStatusWithContext(ctx context.Context, params SetUserEmojiStatus) (bool, error) {
req := NewRequest[bool]("setUserEmojiStatus", params)
return req.DoWithContext(ctx, api)
}
// GetUserGifts holds parameters for the GetUserGifts method.
// Since: Bot API 9.3
// See https://core.telegram.org/bots/api#getusergifts
type GetUserGifts struct {
// UserID Required. Unique identifier of the user
UserID int64 `json:"user_id"`
// ExcludeUnlimited Optional. Pass True to exclude gifts that can be purchased an unlimited number of times
ExcludeUnlimited bool `json:"exclude_unlimited,omitempty"`
// ExcludeLimitedUpgradable Optional. Pass True to exclude gifts that can be purchased a limited number of
// times and can be upgraded to unique
ExcludeLimitedUpgradable bool `json:"exclude_limited_upgradable,omitempty"`
// ExcludeLimitedNonUpgradable Optional. Pass True to exclude gifts that can be purchased a limited number
// of times and can't be upgraded to unique
ExcludeLimitedNonUpgradable bool `json:"exclude_limited_non_upgradable,omitempty"`
// ExcludeUnique Optional. Pass True to exclude unique gifts
ExcludeUnique bool `json:"exclude_unique,omitempty"`
// ExcludeFromBlockchain Optional. Pass True to exclude gifts that were assigned from the TON blockchain and
// can't be resold or transferred in Telegram
ExcludeFromBlockchain bool `json:"exclude_from_blockchain,omitempty"`
// SortByPrice Optional. Pass True to sort results by gift price instead of send date. Sorting is applied
// before pagination.
SortByPrice bool `json:"sort_by_price,omitempty"`
// Offset Optional. Offset of the first entry to return as received from the previous request; use an empty
// string to get the first chunk of results
Offset string `json:"offset,omitempty"`
// Limit Optional. The maximum number of gifts to be returned; 1-100. Defaults to 100.
Limit int `json:"limit,omitempty"`
}
// GetUserGifts returns gifts owned by a user.
// Since: Bot API 9.3
// See https://core.telegram.org/bots/api#getusergifts
func (api *API) GetUserGifts(params GetUserGifts) (OwnedGifts, error) {
req := NewRequest[OwnedGifts]("getUserGifts", params)
return req.Do(api)
}
// GetUserGiftsWithContext is the context-aware variant of GetUserGifts.
// Since: Bot API 9.3
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#getusergifts
func (api *API) GetUserGiftsWithContext(ctx context.Context, params GetUserGifts) (OwnedGifts, error) {
req := NewRequest[OwnedGifts]("getUserGifts", params)
return req.DoWithContext(ctx, api)
}
// GetUserPersonalChatMessages holds parameters for the getUserPersonalChatMessages method.
// Since: Bot API 10.0
// See https://core.telegram.org/bots/api#getuserpersonalchatmessages
type GetUserPersonalChatMessages struct {
// UserID Required. Unique identifier for the target user
UserID int64 `json:"user_id"`
// Offset is the zero-based offset of the first message to return.
Offset int `json:"offset,omitempty"`
// Limit Required. The maximum number of messages to return; 1-20
Limit int `json:"limit,omitempty"`
}
// GetUserPersonalChatMessages returns messages from the personal chat of the user with the bot.
// Since: Bot API 10.0
// See https://core.telegram.org/bots/api#getuserpersonalchatmessages
func (api *API) GetUserPersonalChatMessages(params GetUserPersonalChatMessages) ([]Message, error) {
req := NewRequest[[]Message]("getUserPersonalChatMessages", params)
return req.Do(api)
}
// GetUserPersonalChatMessagesWithContext is the context-aware variant of GetUserPersonalChatMessages.
// Since: Bot API 10.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#getuserpersonalchatmessages
func (api *API) GetUserPersonalChatMessagesWithContext(ctx context.Context, params GetUserPersonalChatMessages) ([]Message, error) {
req := NewRequest[[]Message]("getUserPersonalChatMessages", params)
return req.DoWithContext(ctx, api)
}