+272
-80
@@ -6,10 +6,19 @@ import "context"
|
||||
// Since: Bot API 5.3
|
||||
// See https://core.telegram.org/bots/api#banchatmember
|
||||
type BanChatMember struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
UserID int64 `json:"user_id"`
|
||||
UntilDate int `json:"until_date,omitempty"`
|
||||
RevokeMessages bool `json:"revoke_messages,omitempty"`
|
||||
// ChatID Required. Unique identifier for the target group or username of the target supergroup or channel
|
||||
// in the format @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// UserID Required. Unique identifier of the target user
|
||||
UserID int64 `json:"user_id"`
|
||||
// UntilDate Optional. Date when the user will be unbanned; Unix time. If user is banned for more than 366
|
||||
// days or less than 30 seconds from the current time they are considered to be banned forever. Applied for
|
||||
// supergroups and channels only.
|
||||
UntilDate int `json:"until_date,omitempty"`
|
||||
// RevokeMessages Optional. Pass True to delete all messages from the chat for the user that is being
|
||||
// removed. If False, the user will be able to see messages in the group that were sent before the user was
|
||||
// removed. Always True for supergroups and channels.
|
||||
RevokeMessages bool `json:"revoke_messages,omitempty"`
|
||||
}
|
||||
|
||||
// BanChatMember bans a user in a chat.
|
||||
@@ -34,9 +43,13 @@ func (api *API) BanChatMemberWithContext(ctx context.Context, params BanChatMemb
|
||||
// Since: Bot API 2.0
|
||||
// See https://core.telegram.org/bots/api#unbanchatmember
|
||||
type UnbanChatMember struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
UserID int64 `json:"user_id"`
|
||||
OnlyIfBanned bool `json:"only_if_banned"`
|
||||
// ChatID Required. Unique identifier for the target group or username of the target supergroup or channel
|
||||
// in the format @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// UserID Required. Unique identifier of the target user
|
||||
UserID int64 `json:"user_id"`
|
||||
// OnlyIfBanned Optional. Do nothing if the user is not banned
|
||||
OnlyIfBanned bool `json:"only_if_banned"`
|
||||
}
|
||||
|
||||
// UnbanChatMember unbans a previously banned user in a chat.
|
||||
@@ -61,11 +74,23 @@ func (api *API) UnbanChatMemberWithContext(ctx context.Context, params UnbanChat
|
||||
// Since: Bot API 3.1
|
||||
// See https://core.telegram.org/bots/api#restrictchatmember
|
||||
type RestrictChatMember struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
UserID int64 `json:"user_id"`
|
||||
Permissions ChatPermissions `json:"permissions"`
|
||||
UseIndependentChatPermissions bool `json:"use_independent_chat_permissions,omitempty"`
|
||||
UntilDate int `json:"until_date,omitempty"`
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target supergroup in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// UserID Required. Unique identifier of the target user
|
||||
UserID int64 `json:"user_id"`
|
||||
// Permissions Required. A JSON-serialized object for new user permissions
|
||||
Permissions ChatPermissions `json:"permissions"`
|
||||
// UseIndependentChatPermissions Optional. Pass True if chat permissions are set independently. Otherwise,
|
||||
// the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages,
|
||||
// can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and
|
||||
// can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages
|
||||
// permission.
|
||||
UseIndependentChatPermissions bool `json:"use_independent_chat_permissions,omitempty"`
|
||||
// UntilDate Optional. Date when restrictions will be lifted for the user; Unix time. If user is restricted
|
||||
// for more than 366 days or less than 30 seconds from the current time, they are considered to be
|
||||
// restricted forever.
|
||||
UntilDate int `json:"until_date,omitempty"`
|
||||
}
|
||||
|
||||
// RestrictChatMember restricts a user in a chat.
|
||||
@@ -90,26 +115,58 @@ func (api *API) RestrictChatMemberWithContext(ctx context.Context, params Restri
|
||||
// Since: Bot API 3.1
|
||||
// See https://core.telegram.org/bots/api#promotechatmember
|
||||
type PromoteChatMember struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
UserID int64 `json:"user_id"`
|
||||
IsAnonymous bool `json:"is_anonymous,omitempty"` // Since: Bot API 5.1
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target channel in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// UserID Required. Unique identifier of the target user
|
||||
UserID int64 `json:"user_id"`
|
||||
// IsAnonymous Optional. Pass True if the administrator's presence in the chat is hidden
|
||||
IsAnonymous bool `json:"is_anonymous,omitempty"` // Since: Bot API 5.1
|
||||
|
||||
CanManageChat bool `json:"can_manage_chat,omitempty"` // Since: Bot API 5.3
|
||||
CanDeleteMessages bool `json:"can_delete_messages,omitempty"`
|
||||
CanManageVideoChats bool `json:"can_manage_video_chats,omitempty"` // Since: Bot API 6.0
|
||||
CanRestrictMembers bool `json:"can_restrict_members,omitempty"`
|
||||
CanPromoteMembers bool `json:"can_promote_members,omitempty"`
|
||||
CanChangeInfo bool `json:"can_change_info,omitempty"`
|
||||
CanInviteUsers bool `json:"can_invite_users,omitempty"`
|
||||
CanPostStories bool `json:"can_post_stories,omitempty"` // Since: Bot API 6.9
|
||||
CanEditStories bool `json:"can_edit_stories,omitempty"` // Since: Bot API 6.9
|
||||
CanDeleteStories bool `json:"can_delete_stories,omitempty"` // Since: Bot API 6.9
|
||||
CanPostMessages bool `json:"can_post_messages,omitempty"`
|
||||
CanEditMessages bool `json:"can_edit_messages,omitempty"`
|
||||
CanPinMessages bool `json:"can_pin_messages,omitempty"`
|
||||
CanManageTopics bool `json:"can_manage_topics,omitempty"` // Since: Bot API 6.3
|
||||
// CanManageChat Optional. Pass True if the administrator can access the chat event log, get boost list, see
|
||||
// hidden supergroup and channel members, report spam messages, ignore slow mode, and send messages to the
|
||||
// chat without paying Telegram Stars. Implied by any other administrator privilege.
|
||||
CanManageChat bool `json:"can_manage_chat,omitempty"` // Since: Bot API 5.3
|
||||
// CanDeleteMessages Optional. Pass True if the administrator can delete messages of other users
|
||||
CanDeleteMessages bool `json:"can_delete_messages,omitempty"`
|
||||
// CanManageVideoChats Optional. Pass True if the administrator can manage video chats
|
||||
CanManageVideoChats bool `json:"can_manage_video_chats,omitempty"` // Since: Bot API 6.0
|
||||
// CanRestrictMembers Optional. Pass True if the administrator can restrict, ban or unban chat members, or
|
||||
// access supergroup statistics. For backward compatibility, defaults to True for promotions of channel
|
||||
// administrators.
|
||||
CanRestrictMembers bool `json:"can_restrict_members,omitempty"`
|
||||
// CanPromoteMembers Optional. Pass True if the administrator can add new administrators with a subset of
|
||||
// their own privileges or demote administrators that they have promoted, directly or indirectly (promoted
|
||||
// by administrators that were appointed by him)
|
||||
CanPromoteMembers bool `json:"can_promote_members,omitempty"`
|
||||
// CanChangeInfo Optional. Pass True if the administrator can change chat title, photo and other settings
|
||||
CanChangeInfo bool `json:"can_change_info,omitempty"`
|
||||
// CanInviteUsers Optional. Pass True if the administrator can invite new users to the chat
|
||||
CanInviteUsers bool `json:"can_invite_users,omitempty"`
|
||||
// CanPostStories Optional. Pass True if the administrator can post stories to the chat
|
||||
CanPostStories bool `json:"can_post_stories,omitempty"` // Since: Bot API 6.9
|
||||
// CanEditStories Optional. Pass True if the administrator can edit stories posted by other users, post
|
||||
// stories to the chat page, pin chat stories, and access the chat's story archive
|
||||
CanEditStories bool `json:"can_edit_stories,omitempty"` // Since: Bot API 6.9
|
||||
// CanDeleteStories Optional. Pass True if the administrator can delete stories posted by other users
|
||||
CanDeleteStories bool `json:"can_delete_stories,omitempty"` // Since: Bot API 6.9
|
||||
// CanPostMessages Optional. Pass True if the administrator can post messages in the channel, approve
|
||||
// suggested posts, or access channel statistics; for channels only
|
||||
CanPostMessages bool `json:"can_post_messages,omitempty"`
|
||||
// CanEditMessages Optional. Pass True if the administrator can edit messages of other users and can pin
|
||||
// messages; for channels only
|
||||
CanEditMessages bool `json:"can_edit_messages,omitempty"`
|
||||
// CanPinMessages Optional. Pass True if the administrator can pin messages; for supergroups only
|
||||
CanPinMessages bool `json:"can_pin_messages,omitempty"`
|
||||
// CanManageTopics Optional. Pass True if the user is allowed to create, rename, close, and reopen forum
|
||||
// topics; for supergroups only
|
||||
CanManageTopics bool `json:"can_manage_topics,omitempty"` // Since: Bot API 6.3
|
||||
// CanManageDirectMessages Optional. Pass True if the administrator can manage direct messages within the
|
||||
// channel and decline suggested posts; for channels only
|
||||
CanManageDirectMessages bool `json:"can_manage_direct_messages,omitempty"` // Since: Bot API 9.1
|
||||
CanManageTags bool `json:"can_manage_tags,omitempty"` // Since: Bot API 9.5
|
||||
// CanManageTags Optional. Pass True if the administrator can edit the tags of regular members; for groups
|
||||
// and supergroups only
|
||||
CanManageTags bool `json:"can_manage_tags,omitempty"` // Since: Bot API 9.5
|
||||
}
|
||||
|
||||
// PromoteChatMember promotes or demotes a user in a chat.
|
||||
@@ -134,8 +191,12 @@ func (api *API) PromoteChatMemberWithContext(ctx context.Context, params Promote
|
||||
// Since: Bot API 5.0
|
||||
// See https://core.telegram.org/bots/api#setchatadministratorcustomtitle
|
||||
type SetChatAdministratorCustomTitle struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
UserID int64 `json:"user_id"`
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target supergroup in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// UserID Required. Unique identifier of the target user
|
||||
UserID int64 `json:"user_id"`
|
||||
// CustomTitle Required. New custom title for the administrator; 0-16 characters, emoji are not allowed
|
||||
CustomTitle string `json:"custom_title"`
|
||||
}
|
||||
|
||||
@@ -161,9 +222,13 @@ func (api *API) SetChatAdministratorCustomTitleWithContext(ctx context.Context,
|
||||
// Since: Bot API 9.5
|
||||
// See https://core.telegram.org/bots/api#setchatmembertag
|
||||
type SetChatMemberTag struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
UserID int64 `json:"user_id"`
|
||||
Tag string `json:"tag,omitempty"`
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target supergroup in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// UserID Required. Unique identifier of the target user
|
||||
UserID int64 `json:"user_id"`
|
||||
// Tag Optional. New tag for the member; 0-16 characters, emoji are not allowed
|
||||
Tag string `json:"tag,omitempty"`
|
||||
}
|
||||
|
||||
// SetChatMemberTag sets a tag for a chat member.
|
||||
@@ -188,7 +253,10 @@ func (api *API) SetChatMemberTagWithContext(ctx context.Context, params SetChatM
|
||||
// Since: Bot API 5.6
|
||||
// See https://core.telegram.org/bots/api#banchatsenderchat
|
||||
type BanChatSenderChat struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target channel in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// SenderChatID Required. Unique identifier of the target sender chat
|
||||
SenderChatID int64 `json:"sender_chat_id"`
|
||||
}
|
||||
|
||||
@@ -214,7 +282,10 @@ func (api *API) BanChatSenderChatWithContext(ctx context.Context, params BanChat
|
||||
// Since: Bot API 5.6
|
||||
// See https://core.telegram.org/bots/api#unbanchatsenderchat
|
||||
type UnbanChatSenderChat struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target channel in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// SenderChatID Required. Unique identifier of the target sender chat
|
||||
SenderChatID int64 `json:"sender_chat_id"`
|
||||
}
|
||||
|
||||
@@ -240,9 +311,17 @@ func (api *API) UnbanChatSenderChatWithContext(ctx context.Context, params Unban
|
||||
// Since: Bot API 4.4
|
||||
// See https://core.telegram.org/bots/api#setchatpermissions
|
||||
type SetChatPermissions struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
Permissions ChatPermissions `json:"permissions"`
|
||||
UseIndependentChatPermissions bool `json:"use_independent_chat_permissions,omitempty"`
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target supergroup in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// Permissions Required. A JSON-serialized object for new default chat permissions
|
||||
Permissions ChatPermissions `json:"permissions"`
|
||||
// UseIndependentChatPermissions Optional. Pass True if chat permissions are set independently. Otherwise,
|
||||
// the can_send_other_messages and can_add_web_page_previews permissions will imply the can_send_messages,
|
||||
// can_send_audios, can_send_documents, can_send_photos, can_send_videos, can_send_video_notes, and
|
||||
// can_send_voice_notes permissions; the can_send_polls permission will imply the can_send_messages
|
||||
// permission.
|
||||
UseIndependentChatPermissions bool `json:"use_independent_chat_permissions,omitempty"`
|
||||
}
|
||||
|
||||
// SetChatPermissions sets default chat permissions for all members.
|
||||
@@ -267,6 +346,8 @@ func (api *API) SetChatPermissionsWithContext(ctx context.Context, params SetCha
|
||||
// Since: Bot API 3.1
|
||||
// See https://core.telegram.org/bots/api#exportchatinvitelink
|
||||
type ExportChatInviteLink struct {
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target channel in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
@@ -292,11 +373,19 @@ func (api *API) ExportChatInviteLinkWithContext(ctx context.Context, params Expo
|
||||
// Since: Bot API 5.1
|
||||
// See https://core.telegram.org/bots/api#createchatinvitelink
|
||||
type CreateChatInviteLink struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
ExpireDate int `json:"expire_date,omitempty"`
|
||||
MemberLimit int `json:"member_limit,omitempty"`
|
||||
CreatesJoinRequest bool `json:"creates_join_request,omitempty"`
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target channel in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// Name Optional. Invite link name; 0-32 characters
|
||||
Name *string `json:"name,omitempty"`
|
||||
// ExpireDate Optional. Point in time (Unix timestamp) when the link will expire
|
||||
ExpireDate int `json:"expire_date,omitempty"`
|
||||
// MemberLimit Optional. The maximum number of users that can be members of the chat simultaneously after
|
||||
// joining the chat via this invite link; 1-99999
|
||||
MemberLimit int `json:"member_limit,omitempty"`
|
||||
// CreatesJoinRequest Optional. True, if users joining the chat via the link need to be approved by chat
|
||||
// administrators. If True, member_limit can't be specified.
|
||||
CreatesJoinRequest bool `json:"creates_join_request,omitempty"`
|
||||
}
|
||||
|
||||
// CreateChatInviteLink creates an additional invite link for a chat.
|
||||
@@ -321,13 +410,22 @@ func (api *API) CreateChatInviteLinkWithContext(ctx context.Context, params Crea
|
||||
// Since: Bot API 5.1
|
||||
// See https://core.telegram.org/bots/api#editchatinvitelink
|
||||
type EditChatInviteLink struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target channel in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// InviteLink Required. The invite link to edit
|
||||
InviteLink string `json:"invite_link"`
|
||||
|
||||
Name string `json:"name,omitempty"`
|
||||
ExpireDate int `json:"expire_date,omitempty"`
|
||||
MemberLimit int `json:"member_limit,omitempty"`
|
||||
CreatesJoinRequest bool `json:"creates_join_request,omitempty"`
|
||||
// Name Optional. Invite link name; 0-32 characters
|
||||
Name string `json:"name,omitempty"`
|
||||
// ExpireDate Optional. Point in time (Unix timestamp) when the link will expire
|
||||
ExpireDate int `json:"expire_date,omitempty"`
|
||||
// MemberLimit Optional. The maximum number of users that can be members of the chat simultaneously after
|
||||
// joining the chat via this invite link; 1-99999
|
||||
MemberLimit int `json:"member_limit,omitempty"`
|
||||
// CreatesJoinRequest Optional. True, if users joining the chat via the link need to be approved by chat
|
||||
// administrators. If True, member_limit can't be specified.
|
||||
CreatesJoinRequest bool `json:"creates_join_request,omitempty"`
|
||||
}
|
||||
|
||||
// EditChatInviteLink edits a non‑primary invite link.
|
||||
@@ -352,10 +450,17 @@ func (api *API) EditChatInviteLinkWithContext(ctx context.Context, params EditCh
|
||||
// Since: Bot API 8.0
|
||||
// See https://core.telegram.org/bots/api#createchatsubscriptioninvitelink
|
||||
type CreateChatSubscriptionInviteLink struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
Name string `json:"name,omitempty"`
|
||||
SubscriptionPeriod int `json:"subscription_period,omitempty"`
|
||||
SubscriptionPrice int `json:"subscription_price,omitempty"`
|
||||
// ChatID Required. Unique identifier for the target channel chat or username of the target channel in the
|
||||
// format @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// Name Optional. Invite link name; 0-32 characters
|
||||
Name string `json:"name,omitempty"`
|
||||
// SubscriptionPeriod Required. The number of seconds the subscription will be active for before the next
|
||||
// payment. Currently, it must always be 2592000 (30 days).
|
||||
SubscriptionPeriod int `json:"subscription_period,omitempty"`
|
||||
// SubscriptionPrice Required. The amount of Telegram Stars a user must pay initially and after each
|
||||
// subsequent subscription period to be a member of the chat; 1-10000
|
||||
SubscriptionPrice int `json:"subscription_price,omitempty"`
|
||||
}
|
||||
|
||||
// CreateChatSubscriptionInviteLink creates a subscription invite link for a channel chat.
|
||||
@@ -380,9 +485,13 @@ func (api *API) CreateChatSubscriptionInviteLinkWithContext(ctx context.Context,
|
||||
// Since: Bot API 8.0
|
||||
// See https://core.telegram.org/bots/api#editchatsubscriptioninvitelink
|
||||
type EditChatSubscriptionInviteLink struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target channel in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// InviteLink Required. The invite link to edit
|
||||
InviteLink string `json:"invite_link"`
|
||||
Name string `json:"name,omitempty"`
|
||||
// Name Optional. Invite link name; 0-32 characters
|
||||
Name string `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// EditChatSubscriptionInviteLink edits a subscription invite link.
|
||||
@@ -407,7 +516,10 @@ func (api *API) EditChatSubscriptionInviteLinkWithContext(ctx context.Context, p
|
||||
// Since: Bot API 5.1
|
||||
// See https://core.telegram.org/bots/api#revokechatinvitelink
|
||||
type RevokeChatInviteLink struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// ChatID Required. Unique identifier of the target chat or username of the target channel in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// InviteLink Required. The invite link to revoke
|
||||
InviteLink string `json:"invite_link"`
|
||||
}
|
||||
|
||||
@@ -433,7 +545,10 @@ func (api *API) RevokeChatInviteLinkWithContext(ctx context.Context, params Revo
|
||||
// Since: Bot API 5.4
|
||||
// See https://core.telegram.org/bots/api#approvechatjoinrequest
|
||||
type ApproveChatJoinRequest struct {
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target channel in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// UserID Required. Unique identifier of the target user
|
||||
UserID int64 `json:"user_id"`
|
||||
}
|
||||
|
||||
@@ -459,7 +574,10 @@ func (api *API) ApproveChatJoinRequestWithContext(ctx context.Context, params Ap
|
||||
// Since: Bot API 5.4
|
||||
// See https://core.telegram.org/bots/api#declinechatjoinrequest
|
||||
type DeclineChatJoinRequest struct {
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target channel in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// UserID Required. Unique identifier of the target user
|
||||
UserID int64 `json:"user_id"`
|
||||
}
|
||||
|
||||
@@ -556,6 +674,8 @@ func (api *API) SendChatJoinRequestWebAppWithContext(ctx context.Context, params
|
||||
// Since: Bot API 3.1
|
||||
// See https://core.telegram.org/bots/api#setchatphoto
|
||||
type SetChatPhoto struct {
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target channel in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
@@ -565,18 +685,29 @@ type SetChatPhoto struct {
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#setchatphoto
|
||||
func (api *API) SetChatPhoto(params SetChatPhoto, photo UploaderFile) (bool, error) {
|
||||
return api.SetChatPhotoWithContext(context.Background(), params, photo)
|
||||
}
|
||||
|
||||
// SetChatPhotoWithContext changes the chat photo using ctx for cancellation and deadlines.
|
||||
// Since: Bot API 3.1
|
||||
// photo is the file to upload as the new photo.
|
||||
// Returns True on success.
|
||||
// See https://core.telegram.org/bots/api#setchatphoto
|
||||
func (api *API) SetChatPhotoWithContext(ctx context.Context, params SetChatPhoto, photo UploaderFile) (bool, error) {
|
||||
uploader := NewUploader(api)
|
||||
defer func() {
|
||||
_ = uploader.Close()
|
||||
}()
|
||||
req := NewUploaderRequestWithChatID[bool]("setChatPhoto", params, params.ChatID, photo.SetType(UploaderPhotoType))
|
||||
return req.Do(uploader)
|
||||
return req.DoWithContext(ctx, uploader)
|
||||
}
|
||||
|
||||
// DeleteChatPhoto holds parameters for the deleteChatPhoto method.
|
||||
// Since: Bot API 3.1
|
||||
// See https://core.telegram.org/bots/api#deletechatphoto
|
||||
type DeleteChatPhoto struct {
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target channel in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
@@ -602,8 +733,11 @@ func (api *API) DeleteChatPhotoWithContext(ctx context.Context, params DeleteCha
|
||||
// Since: Bot API 3.1
|
||||
// See https://core.telegram.org/bots/api#setchattitle
|
||||
type SetChatTitle struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
Title string `json:"title"`
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target channel in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// Title Required. New chat title, 1-128 characters
|
||||
Title string `json:"title"`
|
||||
}
|
||||
|
||||
// SetChatTitle changes the chat title.
|
||||
@@ -628,7 +762,10 @@ func (api *API) SetChatTitleWithContext(ctx context.Context, params SetChatTitle
|
||||
// Since: Bot API 3.1
|
||||
// See https://core.telegram.org/bots/api#setchatdescription
|
||||
type SetChatDescription struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target channel in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// Description Optional. New chat description, 0-255 characters
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
@@ -654,10 +791,17 @@ func (api *API) SetChatDescriptionWithContext(ctx context.Context, params SetCha
|
||||
// Since: Bot API 3.1
|
||||
// See https://core.telegram.org/bots/api#pinchatmessage
|
||||
type PinChatMessage struct {
|
||||
// BusinessConnectionID Optional. Unique identifier of the business connection on behalf of which the
|
||||
// message will be pinned
|
||||
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
|
||||
ChatID int64 `json:"chat_id"`
|
||||
MessageID int `json:"message_id"`
|
||||
DisableNotification bool `json:"disable_notification,omitempty"`
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target channel in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// MessageID Required. Identifier of a message to pin
|
||||
MessageID int `json:"message_id"`
|
||||
// DisableNotification Optional. Pass True if it is not necessary to send a notification to all chat members
|
||||
// about the new pinned message. Notifications are always disabled in channels and private chats.
|
||||
DisableNotification bool `json:"disable_notification,omitempty"`
|
||||
}
|
||||
|
||||
// PinChatMessage pins a message in a chat.
|
||||
@@ -682,9 +826,15 @@ func (api *API) PinChatMessageWithContext(ctx context.Context, params PinChatMes
|
||||
// Since: Bot API 3.1
|
||||
// See https://core.telegram.org/bots/api#unpinchatmessage
|
||||
type UnpinChatMessage struct {
|
||||
// BusinessConnectionID Optional. Unique identifier of the business connection on behalf of which the
|
||||
// message will be unpinned
|
||||
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
|
||||
ChatID int64 `json:"chat_id"`
|
||||
MessageID int `json:"message_id"`
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target channel in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// MessageID Optional. Identifier of the message to unpin. Required if business_connection_id is specified.
|
||||
// If not specified, the most recent pinned message (by sending date) will be unpinned.
|
||||
MessageID int `json:"message_id"`
|
||||
}
|
||||
|
||||
// UnpinChatMessage unpins a message in a chat.
|
||||
@@ -709,6 +859,8 @@ func (api *API) UnpinChatMessageWithContext(ctx context.Context, params UnpinCha
|
||||
// Since: Bot API 5.0
|
||||
// See https://core.telegram.org/bots/api#unpinallchatmessages
|
||||
type UnpinAllChatMessages struct {
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target channel in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
@@ -734,6 +886,9 @@ func (api *API) UnpinAllChatMessagesWithContext(ctx context.Context, params Unpi
|
||||
// Since: Bot API 2.1
|
||||
// See https://core.telegram.org/bots/api#leavechat
|
||||
type LeaveChat struct {
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target supergroup or channel in
|
||||
// the format @username. Channel direct messages chats aren't supported; leave the corresponding channel
|
||||
// instead.
|
||||
ChatID int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
@@ -759,6 +914,8 @@ func (api *API) LeaveChatWithContext(ctx context.Context, params LeaveChat) (boo
|
||||
// Since: Bot API 2.1
|
||||
// See https://core.telegram.org/bots/api#getchat
|
||||
type GetChat struct {
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target supergroup or channel in
|
||||
// the format @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
@@ -783,8 +940,12 @@ func (api *API) GetChatWithContext(ctx context.Context, params GetChat) (ChatFul
|
||||
// Since: Bot API 2.1
|
||||
// See https://core.telegram.org/bots/api#getchatadministrators
|
||||
type GetChatAdministrators struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
ReturnBots bool `json:"return_bots,omitempty"` // Since: Bot API 10.0
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target supergroup or channel in
|
||||
// the format @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// ReturnBots Optional. Pass True to additionally receive all bots that are administrators of the chat. By
|
||||
// default, bots other than the current bot are omitted.
|
||||
ReturnBots bool `json:"return_bots,omitempty"` // Since: Bot API 10.0
|
||||
}
|
||||
|
||||
// GetChatAdministrators returns a list of administrators in a chat.
|
||||
@@ -808,6 +969,8 @@ func (api *API) GetChatAdministratorsWithContext(ctx context.Context, params Get
|
||||
// Since: Bot API 2.1
|
||||
// See https://core.telegram.org/bots/api#getchatmembercount
|
||||
type GetChatMemberCount struct {
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target supergroup or channel in
|
||||
// the format @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
@@ -832,7 +995,10 @@ func (api *API) GetChatMemberCountWithContext(ctx context.Context, params GetCha
|
||||
// Since: Bot API 2.1
|
||||
// See https://core.telegram.org/bots/api#getchatmember
|
||||
type GetChatMember struct {
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target supergroup or channel in
|
||||
// the format @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// UserID Required. Unique identifier of the target user
|
||||
UserID int64 `json:"user_id"`
|
||||
}
|
||||
|
||||
@@ -857,7 +1023,10 @@ func (api *API) GetChatMemberWithContext(ctx context.Context, params GetChatMemb
|
||||
// Since: Bot API 3.2
|
||||
// See https://core.telegram.org/bots/api#setchatstickerset
|
||||
type SetChatStickerSet struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target supergroup in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// StickerSetName Required. Name of the sticker set to be set as the group sticker set
|
||||
StickerSetName string `json:"sticker_set_name"`
|
||||
}
|
||||
|
||||
@@ -883,6 +1052,8 @@ func (api *API) SetChatStickerSetWithContext(ctx context.Context, params SetChat
|
||||
// Since: Bot API 3.2
|
||||
// See https://core.telegram.org/bots/api#deletechatstickerset
|
||||
type DeleteChatStickerSet struct {
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target supergroup in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
}
|
||||
|
||||
@@ -908,7 +1079,9 @@ func (api *API) DeleteChatStickerSetWithContext(ctx context.Context, params Dele
|
||||
// Since: Bot API 7.0
|
||||
// See https://core.telegram.org/bots/api#getuserchatboosts
|
||||
type GetUserChatBoosts struct {
|
||||
// ChatID Required. Unique identifier for the chat or username of the channel in the format @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// UserID Required. Unique identifier of the target user
|
||||
UserID int64 `json:"user_id"`
|
||||
}
|
||||
|
||||
@@ -933,17 +1106,36 @@ func (api *API) GetUserChatBoostsWithContext(ctx context.Context, params GetUser
|
||||
// Since: Bot API 9.3
|
||||
// See https://core.telegram.org/bots/api#getchatgifts
|
||||
type GetChatGifts struct {
|
||||
ChatID int64 `json:"chat_id"`
|
||||
ExcludeUnsaved bool `json:"exclude_unsaved,omitempty"`
|
||||
ExcludeSaved bool `json:"exclude_saved,omitempty"`
|
||||
ExcludeUnlimited bool `json:"exclude_unlimited,omitempty"`
|
||||
ExcludeLimitedUpgradable bool `json:"exclude_limited_upgradable,omitempty"`
|
||||
ExcludeLimitedNonUpgradable bool `json:"exclude_limited_non_upgradable,omitempty"`
|
||||
ExcludeUnique bool `json:"exclude_unique,omitempty"`
|
||||
ExcludeFromBlockchain bool `json:"exclude_from_blockchain,omitempty"`
|
||||
SortByPrice bool `json:"sort_by_price,omitempty"`
|
||||
Offset string `json:"offset,omitempty"`
|
||||
Limit int `json:"limit,omitempty"`
|
||||
// ChatID Required. Unique identifier for the target chat or username of the target channel in the format
|
||||
// @username
|
||||
ChatID int64 `json:"chat_id"`
|
||||
// ExcludeUnsaved Optional. Pass True to exclude gifts that aren't saved to the chat's profile page. Always
|
||||
// True, unless the bot has the can_post_messages administrator right in the channel.
|
||||
ExcludeUnsaved bool `json:"exclude_unsaved,omitempty"`
|
||||
// ExcludeSaved Optional. Pass True to exclude gifts that are saved to the chat's profile page. Always
|
||||
// False, unless the bot has the can_post_messages administrator right in the channel.
|
||||
ExcludeSaved bool `json:"exclude_saved,omitempty"`
|
||||
// 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"`
|
||||
}
|
||||
|
||||
// GetChatGifts returns gifts owned by a chat.
|
||||
|
||||
Reference in New Issue
Block a user