(new): Bot API 10.0
Golang lint / lint (push) Successful in 2m53s
Golang lint / lint (pull_request) Successful in 2m54s

(doc): Since: Bot API X.Y annotations across all tgapi types and methods
This commit is contained in:
2026-05-19 13:42:10 +03:00
parent affb802a7b
commit 1e26d871b5
29 changed files with 1347 additions and 242 deletions
+113 -14
View File
@@ -3,6 +3,7 @@ package tgapi
import "context"
// BanChatMember holds parameters for the banChatMember method.
// Since: Bot API 5.3
// See https://core.telegram.org/bots/api#banchatmember
type BanChatMember struct {
ChatID int64 `json:"chat_id"`
@@ -12,6 +13,7 @@ type BanChatMember struct {
}
// BanChatMember bans a user in a chat.
// Since: Bot API 5.3
// Returns True on success.
// See https://core.telegram.org/bots/api#banchatmember
func (api *API) BanChatMember(params BanChatMember) (bool, error) {
@@ -20,6 +22,7 @@ func (api *API) BanChatMember(params BanChatMember) (bool, error) {
}
// BanChatMemberWithContext is the context-aware variant of BanChatMember.
// Since: Bot API 5.3
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#banchatmember
func (api *API) BanChatMemberWithContext(ctx context.Context, params BanChatMember) (bool, error) {
@@ -28,6 +31,7 @@ func (api *API) BanChatMemberWithContext(ctx context.Context, params BanChatMemb
}
// UnbanChatMember holds parameters for the unbanChatMember method.
// Since: Bot API 2.0
// See https://core.telegram.org/bots/api#unbanchatmember
type UnbanChatMember struct {
ChatID int64 `json:"chat_id"`
@@ -36,6 +40,7 @@ type UnbanChatMember struct {
}
// UnbanChatMember unbans a previously banned user in a chat.
// Since: Bot API 2.0
// Returns True on success.
// See https://core.telegram.org/bots/api#unbanchatmember
func (api *API) UnbanChatMember(params UnbanChatMember) (bool, error) {
@@ -44,6 +49,7 @@ func (api *API) UnbanChatMember(params UnbanChatMember) (bool, error) {
}
// UnbanChatMemberWithContext is the context-aware variant of UnbanChatMember.
// Since: Bot API 2.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#unbanchatmember
func (api *API) UnbanChatMemberWithContext(ctx context.Context, params UnbanChatMember) (bool, error) {
@@ -52,6 +58,7 @@ func (api *API) UnbanChatMemberWithContext(ctx context.Context, params UnbanChat
}
// RestrictChatMember holds parameters for the restrictChatMember method.
// Since: Bot API 3.1
// See https://core.telegram.org/bots/api#restrictchatmember
type RestrictChatMember struct {
ChatID int64 `json:"chat_id"`
@@ -62,6 +69,7 @@ type RestrictChatMember struct {
}
// RestrictChatMember restricts a user in a chat.
// Since: Bot API 3.1
// Returns True on success.
// See https://core.telegram.org/bots/api#restrictchatmember
func (api *API) RestrictChatMember(params RestrictChatMember) (bool, error) {
@@ -70,6 +78,7 @@ func (api *API) RestrictChatMember(params RestrictChatMember) (bool, error) {
}
// RestrictChatMemberWithContext is the context-aware variant of RestrictChatMember.
// Since: Bot API 3.1
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#restrictchatmember
func (api *API) RestrictChatMemberWithContext(ctx context.Context, params RestrictChatMember) (bool, error) {
@@ -78,31 +87,33 @@ func (api *API) RestrictChatMemberWithContext(ctx context.Context, params Restri
}
// PromoteChatMember holds parameters for the promoteChatMember method.
// 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"`
IsAnonymous bool `json:"is_anonymous,omitempty"` // Since: Bot API 5.1
CanManageChat bool `json:"can_manage_chat,omitempty"`
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"`
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"`
CanEditStories bool `json:"can_edit_stories,omitempty"`
CanDeleteStories bool `json:"can_delete_stories,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"`
CanManageDirectMessages bool `json:"can_manage_direct_messages,omitempty"`
CanManageTags bool `json:"can_manage_tags,omitempty"`
CanManageTopics bool `json:"can_manage_topics,omitempty"` // Since: Bot API 6.3
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
}
// PromoteChatMember promotes or demotes a user in a chat.
// Since: Bot API 3.1
// Returns True on success.
// See https://core.telegram.org/bots/api#promotechatmember
func (api *API) PromoteChatMember(params PromoteChatMember) (bool, error) {
@@ -111,6 +122,7 @@ func (api *API) PromoteChatMember(params PromoteChatMember) (bool, error) {
}
// PromoteChatMemberWithContext is the context-aware variant of PromoteChatMember.
// Since: Bot API 3.1
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#promotechatmember
func (api *API) PromoteChatMemberWithContext(ctx context.Context, params PromoteChatMember) (bool, error) {
@@ -119,6 +131,7 @@ func (api *API) PromoteChatMemberWithContext(ctx context.Context, params Promote
}
// SetChatAdministratorCustomTitle holds parameters for the setChatAdministratorCustomTitle method.
// Since: Bot API 5.0
// See https://core.telegram.org/bots/api#setchatadministratorcustomtitle
type SetChatAdministratorCustomTitle struct {
ChatID int64 `json:"chat_id"`
@@ -127,6 +140,7 @@ type SetChatAdministratorCustomTitle struct {
}
// SetChatAdministratorCustomTitle sets a custom title for an administrator.
// Since: Bot API 5.0
// Returns True on success.
// See https://core.telegram.org/bots/api#setchatadministratorcustomtitle
func (api *API) SetChatAdministratorCustomTitle(params SetChatAdministratorCustomTitle) (bool, error) {
@@ -135,6 +149,7 @@ func (api *API) SetChatAdministratorCustomTitle(params SetChatAdministratorCusto
}
// SetChatAdministratorCustomTitleWithContext is the context-aware variant of SetChatAdministratorCustomTitle.
// Since: Bot API 5.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#setchatadministratorcustomtitle
func (api *API) SetChatAdministratorCustomTitleWithContext(ctx context.Context, params SetChatAdministratorCustomTitle) (bool, error) {
@@ -143,6 +158,7 @@ func (api *API) SetChatAdministratorCustomTitleWithContext(ctx context.Context,
}
// SetChatMemberTag holds parameters for the setChatMemberTag method.
// Since: Bot API 9.5
// See https://core.telegram.org/bots/api#setchatmembertag
type SetChatMemberTag struct {
ChatID int64 `json:"chat_id"`
@@ -151,6 +167,7 @@ type SetChatMemberTag struct {
}
// SetChatMemberTag sets a tag for a chat member.
// Since: Bot API 9.5
// Returns True on success.
// See https://core.telegram.org/bots/api#setchatmembertag
func (api *API) SetChatMemberTag(params SetChatMemberTag) (bool, error) {
@@ -159,6 +176,7 @@ func (api *API) SetChatMemberTag(params SetChatMemberTag) (bool, error) {
}
// SetChatMemberTagWithContext is the context-aware variant of SetChatMemberTag.
// Since: Bot API 9.5
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#setchatmembertag
func (api *API) SetChatMemberTagWithContext(ctx context.Context, params SetChatMemberTag) (bool, error) {
@@ -167,6 +185,7 @@ func (api *API) SetChatMemberTagWithContext(ctx context.Context, params SetChatM
}
// BanChatSenderChat holds parameters for the banChatSenderChat method.
// Since: Bot API 5.6
// See https://core.telegram.org/bots/api#banchatsenderchat
type BanChatSenderChat struct {
ChatID int64 `json:"chat_id"`
@@ -174,6 +193,7 @@ type BanChatSenderChat struct {
}
// BanChatSenderChat bans a channel chat in a supergroup or channel.
// Since: Bot API 5.6
// Returns True on success.
// See https://core.telegram.org/bots/api#banchatsenderchat
func (api *API) BanChatSenderChat(params BanChatSenderChat) (bool, error) {
@@ -182,6 +202,7 @@ func (api *API) BanChatSenderChat(params BanChatSenderChat) (bool, error) {
}
// BanChatSenderChatWithContext is the context-aware variant of BanChatSenderChat.
// Since: Bot API 5.6
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#banchatsenderchat
func (api *API) BanChatSenderChatWithContext(ctx context.Context, params BanChatSenderChat) (bool, error) {
@@ -190,6 +211,7 @@ func (api *API) BanChatSenderChatWithContext(ctx context.Context, params BanChat
}
// UnbanChatSenderChat holds parameters for the unbanChatSenderChat method.
// Since: Bot API 5.6
// See https://core.telegram.org/bots/api#unbanchatsenderchat
type UnbanChatSenderChat struct {
ChatID int64 `json:"chat_id"`
@@ -197,6 +219,7 @@ type UnbanChatSenderChat struct {
}
// UnbanChatSenderChat unbans a previously banned channel chat.
// Since: Bot API 5.6
// Returns True on success.
// See https://core.telegram.org/bots/api#unbanchatsenderchat
func (api *API) UnbanChatSenderChat(params UnbanChatSenderChat) (bool, error) {
@@ -205,6 +228,7 @@ func (api *API) UnbanChatSenderChat(params UnbanChatSenderChat) (bool, error) {
}
// UnbanChatSenderChatWithContext is the context-aware variant of UnbanChatSenderChat.
// Since: Bot API 5.6
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#unbanchatsenderchat
func (api *API) UnbanChatSenderChatWithContext(ctx context.Context, params UnbanChatSenderChat) (bool, error) {
@@ -213,6 +237,7 @@ func (api *API) UnbanChatSenderChatWithContext(ctx context.Context, params Unban
}
// SetChatPermissions holds parameters for the setChatPermissions method.
// Since: Bot API 4.4
// See https://core.telegram.org/bots/api#setchatpermissions
type SetChatPermissions struct {
ChatID int64 `json:"chat_id"`
@@ -221,6 +246,7 @@ type SetChatPermissions struct {
}
// SetChatPermissions sets default chat permissions for all members.
// Since: Bot API 4.4
// Returns True on success.
// See https://core.telegram.org/bots/api#setchatpermissions
func (api *API) SetChatPermissions(params SetChatPermissions) (bool, error) {
@@ -229,6 +255,7 @@ func (api *API) SetChatPermissions(params SetChatPermissions) (bool, error) {
}
// SetChatPermissionsWithContext is the context-aware variant of SetChatPermissions.
// Since: Bot API 4.4
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#setchatpermissions
func (api *API) SetChatPermissionsWithContext(ctx context.Context, params SetChatPermissions) (bool, error) {
@@ -237,12 +264,14 @@ func (api *API) SetChatPermissionsWithContext(ctx context.Context, params SetCha
}
// ExportChatInviteLink holds parameters for the exportChatInviteLink method.
// Since: Bot API 3.1
// See https://core.telegram.org/bots/api#exportchatinvitelink
type ExportChatInviteLink struct {
ChatID int64 `json:"chat_id"`
}
// ExportChatInviteLink generates a new primary invite link for a chat.
// Since: Bot API 3.1
// Returns the new invite link as string.
// See https://core.telegram.org/bots/api#exportchatinvitelink
func (api *API) ExportChatInviteLink(params ExportChatInviteLink) (string, error) {
@@ -251,6 +280,7 @@ func (api *API) ExportChatInviteLink(params ExportChatInviteLink) (string, error
}
// ExportChatInviteLinkWithContext is the context-aware variant of ExportChatInviteLink.
// Since: Bot API 3.1
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#exportchatinvitelink
func (api *API) ExportChatInviteLinkWithContext(ctx context.Context, params ExportChatInviteLink) (string, error) {
@@ -259,6 +289,7 @@ func (api *API) ExportChatInviteLinkWithContext(ctx context.Context, params Expo
}
// CreateChatInviteLink holds parameters for the createChatInviteLink method.
// Since: Bot API 5.1
// See https://core.telegram.org/bots/api#createchatinvitelink
type CreateChatInviteLink struct {
ChatID int64 `json:"chat_id"`
@@ -269,6 +300,7 @@ type CreateChatInviteLink struct {
}
// CreateChatInviteLink creates an additional invite link for a chat.
// Since: Bot API 5.1
// Returns the created invite link.
// See https://core.telegram.org/bots/api#createchatinvitelink
func (api *API) CreateChatInviteLink(params CreateChatInviteLink) (ChatInviteLink, error) {
@@ -277,6 +309,7 @@ func (api *API) CreateChatInviteLink(params CreateChatInviteLink) (ChatInviteLin
}
// CreateChatInviteLinkWithContext is the context-aware variant of CreateChatInviteLink.
// Since: Bot API 5.1
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#createchatinvitelink
func (api *API) CreateChatInviteLinkWithContext(ctx context.Context, params CreateChatInviteLink) (ChatInviteLink, error) {
@@ -285,6 +318,7 @@ func (api *API) CreateChatInviteLinkWithContext(ctx context.Context, params Crea
}
// EditChatInviteLink holds parameters for the editChatInviteLink method.
// Since: Bot API 5.1
// See https://core.telegram.org/bots/api#editchatinvitelink
type EditChatInviteLink struct {
ChatID int64 `json:"chat_id"`
@@ -297,6 +331,7 @@ type EditChatInviteLink struct {
}
// EditChatInviteLink edits a nonprimary invite link.
// Since: Bot API 5.1
// Returns the edited invite link.
// See https://core.telegram.org/bots/api#editchatinvitelink
func (api *API) EditChatInviteLink(params EditChatInviteLink) (ChatInviteLink, error) {
@@ -305,6 +340,7 @@ func (api *API) EditChatInviteLink(params EditChatInviteLink) (ChatInviteLink, e
}
// EditChatInviteLinkWithContext is the context-aware variant of EditChatInviteLink.
// Since: Bot API 5.1
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#editchatinvitelink
func (api *API) EditChatInviteLinkWithContext(ctx context.Context, params EditChatInviteLink) (ChatInviteLink, error) {
@@ -313,6 +349,7 @@ func (api *API) EditChatInviteLinkWithContext(ctx context.Context, params EditCh
}
// CreateChatSubscriptionInviteLink holds parameters for the createChatSubscriptionInviteLink method.
// Since: Bot API 8.0
// See https://core.telegram.org/bots/api#createchatsubscriptioninvitelink
type CreateChatSubscriptionInviteLink struct {
ChatID int64 `json:"chat_id"`
@@ -322,6 +359,7 @@ type CreateChatSubscriptionInviteLink struct {
}
// CreateChatSubscriptionInviteLink creates a subscription invite link for a channel chat.
// Since: Bot API 8.0
// Returns the created invite link.
// See https://core.telegram.org/bots/api#createchatsubscriptioninvitelink
func (api *API) CreateChatSubscriptionInviteLink(params CreateChatSubscriptionInviteLink) (ChatInviteLink, error) {
@@ -330,6 +368,7 @@ func (api *API) CreateChatSubscriptionInviteLink(params CreateChatSubscriptionIn
}
// CreateChatSubscriptionInviteLinkWithContext is the context-aware variant of CreateChatSubscriptionInviteLink.
// Since: Bot API 8.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#createchatsubscriptioninvitelink
func (api *API) CreateChatSubscriptionInviteLinkWithContext(ctx context.Context, params CreateChatSubscriptionInviteLink) (ChatInviteLink, error) {
@@ -338,6 +377,7 @@ func (api *API) CreateChatSubscriptionInviteLinkWithContext(ctx context.Context,
}
// EditChatSubscriptionInviteLink holds parameters for the editChatSubscriptionInviteLink method.
// Since: Bot API 8.0
// See https://core.telegram.org/bots/api#editchatsubscriptioninvitelink
type EditChatSubscriptionInviteLink struct {
ChatID int64 `json:"chat_id"`
@@ -346,6 +386,7 @@ type EditChatSubscriptionInviteLink struct {
}
// EditChatSubscriptionInviteLink edits a subscription invite link.
// Since: Bot API 8.0
// Returns the edited invite link.
// See https://core.telegram.org/bots/api#editchatsubscriptioninvitelink
func (api *API) EditChatSubscriptionInviteLink(params EditChatSubscriptionInviteLink) (ChatInviteLink, error) {
@@ -354,6 +395,7 @@ func (api *API) EditChatSubscriptionInviteLink(params EditChatSubscriptionInvite
}
// EditChatSubscriptionInviteLinkWithContext is the context-aware variant of EditChatSubscriptionInviteLink.
// Since: Bot API 8.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#editchatsubscriptioninvitelink
func (api *API) EditChatSubscriptionInviteLinkWithContext(ctx context.Context, params EditChatSubscriptionInviteLink) (ChatInviteLink, error) {
@@ -362,6 +404,7 @@ func (api *API) EditChatSubscriptionInviteLinkWithContext(ctx context.Context, p
}
// RevokeChatInviteLink holds parameters for the revokeChatInviteLink method.
// Since: Bot API 5.1
// See https://core.telegram.org/bots/api#revokechatinvitelink
type RevokeChatInviteLink struct {
ChatID int64 `json:"chat_id"`
@@ -369,6 +412,7 @@ type RevokeChatInviteLink struct {
}
// RevokeChatInviteLink revokes an invite link.
// Since: Bot API 5.1
// Returns the revoked invite link object.
// See https://core.telegram.org/bots/api#revokechatinvitelink
func (api *API) RevokeChatInviteLink(params RevokeChatInviteLink) (ChatInviteLink, error) {
@@ -377,6 +421,7 @@ func (api *API) RevokeChatInviteLink(params RevokeChatInviteLink) (ChatInviteLin
}
// RevokeChatInviteLinkWithContext is the context-aware variant of RevokeChatInviteLink.
// Since: Bot API 5.1
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#revokechatinvitelink
func (api *API) RevokeChatInviteLinkWithContext(ctx context.Context, params RevokeChatInviteLink) (ChatInviteLink, error) {
@@ -385,6 +430,7 @@ func (api *API) RevokeChatInviteLinkWithContext(ctx context.Context, params Revo
}
// ApproveChatJoinRequest holds parameters for the approveChatJoinRequest method.
// Since: Bot API 5.4
// See https://core.telegram.org/bots/api#approvechatjoinrequest
type ApproveChatJoinRequest struct {
ChatID int64 `json:"chat_id"`
@@ -392,6 +438,7 @@ type ApproveChatJoinRequest struct {
}
// ApproveChatJoinRequest approves a chat join request.
// Since: Bot API 5.4
// Returns True on success.
// See https://core.telegram.org/bots/api#approvechatjoinrequest
func (api *API) ApproveChatJoinRequest(params ApproveChatJoinRequest) (bool, error) {
@@ -400,6 +447,7 @@ func (api *API) ApproveChatJoinRequest(params ApproveChatJoinRequest) (bool, err
}
// ApproveChatJoinRequestWithContext is the context-aware variant of ApproveChatJoinRequest.
// Since: Bot API 5.4
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#approvechatjoinrequest
func (api *API) ApproveChatJoinRequestWithContext(ctx context.Context, params ApproveChatJoinRequest) (bool, error) {
@@ -408,6 +456,7 @@ func (api *API) ApproveChatJoinRequestWithContext(ctx context.Context, params Ap
}
// DeclineChatJoinRequest holds parameters for the declineChatJoinRequest method.
// Since: Bot API 5.4
// See https://core.telegram.org/bots/api#declinechatjoinrequest
type DeclineChatJoinRequest struct {
ChatID int64 `json:"chat_id"`
@@ -415,6 +464,7 @@ type DeclineChatJoinRequest struct {
}
// DeclineChatJoinRequest declines a chat join request.
// Since: Bot API 5.4
// Returns True on success.
// See https://core.telegram.org/bots/api#declinechatjoinrequest
func (api *API) DeclineChatJoinRequest(params DeclineChatJoinRequest) (bool, error) {
@@ -423,6 +473,7 @@ func (api *API) DeclineChatJoinRequest(params DeclineChatJoinRequest) (bool, err
}
// DeclineChatJoinRequestWithContext is the context-aware variant of DeclineChatJoinRequest.
// Since: Bot API 5.4
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#declinechatjoinrequest
func (api *API) DeclineChatJoinRequestWithContext(ctx context.Context, params DeclineChatJoinRequest) (bool, error) {
@@ -431,12 +482,14 @@ func (api *API) DeclineChatJoinRequestWithContext(ctx context.Context, params De
}
// SetChatPhoto holds parameters for the setChatPhoto method.
// Since: Bot API 3.1
// See https://core.telegram.org/bots/api#setchatphoto
type SetChatPhoto struct {
ChatID int64 `json:"chat_id"`
}
// SetChatPhoto changes the chat photo.
// 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
@@ -450,12 +503,14 @@ func (api *API) SetChatPhoto(params SetChatPhoto, photo UploaderFile) (bool, err
}
// DeleteChatPhoto holds parameters for the deleteChatPhoto method.
// Since: Bot API 3.1
// See https://core.telegram.org/bots/api#deletechatphoto
type DeleteChatPhoto struct {
ChatID int64 `json:"chat_id"`
}
// DeleteChatPhoto deletes a chat photo.
// Since: Bot API 3.1
// Returns True on success.
// See https://core.telegram.org/bots/api#deletechatphoto
func (api *API) DeleteChatPhoto(params DeleteChatPhoto) (bool, error) {
@@ -464,6 +519,7 @@ func (api *API) DeleteChatPhoto(params DeleteChatPhoto) (bool, error) {
}
// DeleteChatPhotoWithContext is the context-aware variant of DeleteChatPhoto.
// Since: Bot API 3.1
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#deletechatphoto
func (api *API) DeleteChatPhotoWithContext(ctx context.Context, params DeleteChatPhoto) (bool, error) {
@@ -472,6 +528,7 @@ func (api *API) DeleteChatPhotoWithContext(ctx context.Context, params DeleteCha
}
// SetChatTitle holds parameters for the setChatTitle method.
// Since: Bot API 3.1
// See https://core.telegram.org/bots/api#setchattitle
type SetChatTitle struct {
ChatID int64 `json:"chat_id"`
@@ -479,6 +536,7 @@ type SetChatTitle struct {
}
// SetChatTitle changes the chat title.
// Since: Bot API 3.1
// Returns True on success.
// See https://core.telegram.org/bots/api#setchattitle
func (api *API) SetChatTitle(params SetChatTitle) (bool, error) {
@@ -487,6 +545,7 @@ func (api *API) SetChatTitle(params SetChatTitle) (bool, error) {
}
// SetChatTitleWithContext is the context-aware variant of SetChatTitle.
// Since: Bot API 3.1
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#setchattitle
func (api *API) SetChatTitleWithContext(ctx context.Context, params SetChatTitle) (bool, error) {
@@ -495,6 +554,7 @@ func (api *API) SetChatTitleWithContext(ctx context.Context, params SetChatTitle
}
// SetChatDescription holds parameters for the setChatDescription method.
// Since: Bot API 3.1
// See https://core.telegram.org/bots/api#setchatdescription
type SetChatDescription struct {
ChatID int64 `json:"chat_id"`
@@ -502,6 +562,7 @@ type SetChatDescription struct {
}
// SetChatDescription changes the chat description.
// Since: Bot API 3.1
// Returns True on success.
// See https://core.telegram.org/bots/api#setchatdescription
func (api *API) SetChatDescription(params SetChatDescription) (bool, error) {
@@ -510,6 +571,7 @@ func (api *API) SetChatDescription(params SetChatDescription) (bool, error) {
}
// SetChatDescriptionWithContext is the context-aware variant of SetChatDescription.
// Since: Bot API 3.1
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#setchatdescription
func (api *API) SetChatDescriptionWithContext(ctx context.Context, params SetChatDescription) (bool, error) {
@@ -518,6 +580,7 @@ func (api *API) SetChatDescriptionWithContext(ctx context.Context, params SetCha
}
// PinChatMessage holds parameters for the pinChatMessage method.
// Since: Bot API 3.1
// See https://core.telegram.org/bots/api#pinchatmessage
type PinChatMessage struct {
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
@@ -527,6 +590,7 @@ type PinChatMessage struct {
}
// PinChatMessage pins a message in a chat.
// Since: Bot API 3.1
// Returns True on success.
// See https://core.telegram.org/bots/api#pinchatmessage
func (api *API) PinChatMessage(params PinChatMessage) (bool, error) {
@@ -535,6 +599,7 @@ func (api *API) PinChatMessage(params PinChatMessage) (bool, error) {
}
// PinChatMessageWithContext is the context-aware variant of PinChatMessage.
// Since: Bot API 3.1
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#pinchatmessage
func (api *API) PinChatMessageWithContext(ctx context.Context, params PinChatMessage) (bool, error) {
@@ -543,6 +608,7 @@ func (api *API) PinChatMessageWithContext(ctx context.Context, params PinChatMes
}
// UnpinChatMessage holds parameters for the unpinChatMessage method.
// Since: Bot API 3.1
// See https://core.telegram.org/bots/api#unpinchatmessage
type UnpinChatMessage struct {
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
@@ -551,6 +617,7 @@ type UnpinChatMessage struct {
}
// UnpinChatMessage unpins a message in a chat.
// Since: Bot API 3.1
// Returns True on success.
// See https://core.telegram.org/bots/api#unpinchatmessage
func (api *API) UnpinChatMessage(params UnpinChatMessage) (bool, error) {
@@ -559,6 +626,7 @@ func (api *API) UnpinChatMessage(params UnpinChatMessage) (bool, error) {
}
// UnpinChatMessageWithContext is the context-aware variant of UnpinChatMessage.
// Since: Bot API 3.1
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#unpinchatmessage
func (api *API) UnpinChatMessageWithContext(ctx context.Context, params UnpinChatMessage) (bool, error) {
@@ -567,12 +635,14 @@ func (api *API) UnpinChatMessageWithContext(ctx context.Context, params UnpinCha
}
// UnpinAllChatMessages holds parameters for the unpinAllChatMessages method.
// Since: Bot API 5.0
// See https://core.telegram.org/bots/api#unpinallchatmessages
type UnpinAllChatMessages struct {
ChatID int64 `json:"chat_id"`
}
// UnpinAllChatMessages unpins all pinned messages in a chat.
// Since: Bot API 5.0
// Returns True on success.
// See https://core.telegram.org/bots/api#unpinallchatmessages
func (api *API) UnpinAllChatMessages(params UnpinAllChatMessages) (bool, error) {
@@ -581,6 +651,7 @@ func (api *API) UnpinAllChatMessages(params UnpinAllChatMessages) (bool, error)
}
// UnpinAllChatMessagesWithContext is the context-aware variant of UnpinAllChatMessages.
// Since: Bot API 5.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#unpinallchatmessages
func (api *API) UnpinAllChatMessagesWithContext(ctx context.Context, params UnpinAllChatMessages) (bool, error) {
@@ -589,55 +660,64 @@ func (api *API) UnpinAllChatMessagesWithContext(ctx context.Context, params Unpi
}
// LeaveChat holds parameters for the leaveChat method.
// Since: Bot API 2.1
// See https://core.telegram.org/bots/api#leavechat
type LeaveChat struct {
ChatID int64 `json:"chat_id"`
}
// LeaveChat makes the bot leave a chat.
// Since: Bot API 2.1
// Returns True on success.
// See https://core.telegram.org/bots/api#leavechat
func (api *API) LeaveChat(params LeaveChat) (bool, error) {
req := NewRequestWithChatID[bool]("leaveChat", params, params.ChatID) // fixed method name
req := NewRequestWithChatID[bool]("leaveChat", params, params.ChatID)
return req.Do(api)
}
// LeaveChatWithContext is the context-aware variant of LeaveChat.
// Since: Bot API 2.1
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#leavechat
func (api *API) LeaveChatWithContext(ctx context.Context, params LeaveChat) (bool, error) {
req := NewRequestWithChatID[bool]("leaveChat", params, params.ChatID) // fixed method name
req := NewRequestWithChatID[bool]("leaveChat", params, params.ChatID)
return req.DoWithContext(ctx, api)
}
// GetChat holds parameters for the getChat method.
// Since: Bot API 2.1
// See https://core.telegram.org/bots/api#getchat
type GetChat struct {
ChatID int64 `json:"chat_id"`
}
// GetChat gets uptodate information about a chat.
// Since: Bot API 2.1
// See https://core.telegram.org/bots/api#getchat
func (api *API) GetChat(params GetChat) (ChatFullInfo, error) {
req := NewRequestWithChatID[ChatFullInfo]("getChat", params, params.ChatID) // fixed method name
req := NewRequestWithChatID[ChatFullInfo]("getChat", params, params.ChatID)
return req.Do(api)
}
// GetChatWithContext is the context-aware variant of GetChat.
// Since: Bot API 2.1
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#getchat
func (api *API) GetChatWithContext(ctx context.Context, params GetChat) (ChatFullInfo, error) {
req := NewRequestWithChatID[ChatFullInfo]("getChat", params, params.ChatID) // fixed method name
req := NewRequestWithChatID[ChatFullInfo]("getChat", params, params.ChatID)
return req.DoWithContext(ctx, api)
}
// GetChatAdministrators holds parameters for the getChatAdministrators method.
// Since: Bot API 2.1
// See https://core.telegram.org/bots/api#getchatadministrators
type GetChatAdministrators struct {
ChatID int64 `json:"chat_id"`
ChatID int64 `json:"chat_id"`
ReturnBots bool `json:"return_bots,omitempty"` // Since: Bot API 10.0
}
// GetChatAdministrators returns a list of administrators in a chat.
// Since: Bot API 2.1
// See https://core.telegram.org/bots/api#getchatadministrators
func (api *API) GetChatAdministrators(params GetChatAdministrators) ([]ChatMember, error) {
req := NewRequestWithChatID[[]ChatMember]("getChatAdministrators", params, params.ChatID)
@@ -645,6 +725,7 @@ func (api *API) GetChatAdministrators(params GetChatAdministrators) ([]ChatMembe
}
// GetChatAdministratorsWithContext is the context-aware variant of GetChatAdministrators.
// Since: Bot API 2.1
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#getchatadministrators
func (api *API) GetChatAdministratorsWithContext(ctx context.Context, params GetChatAdministrators) ([]ChatMember, error) {
@@ -653,12 +734,14 @@ func (api *API) GetChatAdministratorsWithContext(ctx context.Context, params Get
}
// GetChatMemberCount holds parameters for the getChatMemberCount method.
// Since: Bot API 2.1
// See https://core.telegram.org/bots/api#getchatmembercount
type GetChatMemberCount struct {
ChatID int64 `json:"chat_id"`
}
// GetChatMemberCount returns the number of members in a chat.
// Since: Bot API 2.1
// See https://core.telegram.org/bots/api#getchatmembercount
func (api *API) GetChatMemberCount(params GetChatMemberCount) (int, error) {
req := NewRequestWithChatID[int]("getChatMemberCount", params, params.ChatID)
@@ -666,6 +749,7 @@ func (api *API) GetChatMemberCount(params GetChatMemberCount) (int, error) {
}
// GetChatMemberCountWithContext is the context-aware variant of GetChatMemberCount.
// Since: Bot API 2.1
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#getchatmembercount
func (api *API) GetChatMemberCountWithContext(ctx context.Context, params GetChatMemberCount) (int, error) {
@@ -674,6 +758,7 @@ func (api *API) GetChatMemberCountWithContext(ctx context.Context, params GetCha
}
// GetChatMember holds parameters for the getChatMember method.
// Since: Bot API 2.1
// See https://core.telegram.org/bots/api#getchatmember
type GetChatMember struct {
ChatID int64 `json:"chat_id"`
@@ -681,6 +766,7 @@ type GetChatMember struct {
}
// GetChatMember returns information about a member of a chat.
// Since: Bot API 2.1
// See https://core.telegram.org/bots/api#getchatmember
func (api *API) GetChatMember(params GetChatMember) (ChatMember, error) {
req := NewRequestWithChatID[ChatMember]("getChatMember", params, params.ChatID)
@@ -688,6 +774,7 @@ func (api *API) GetChatMember(params GetChatMember) (ChatMember, error) {
}
// GetChatMemberWithContext is the context-aware variant of GetChatMember.
// Since: Bot API 2.1
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#getchatmember
func (api *API) GetChatMemberWithContext(ctx context.Context, params GetChatMember) (ChatMember, error) {
@@ -696,6 +783,7 @@ func (api *API) GetChatMemberWithContext(ctx context.Context, params GetChatMemb
}
// SetChatStickerSet holds parameters for the setChatStickerSet method.
// Since: Bot API 3.2
// See https://core.telegram.org/bots/api#setchatstickerset
type SetChatStickerSet struct {
ChatID int64 `json:"chat_id"`
@@ -703,6 +791,7 @@ type SetChatStickerSet struct {
}
// SetChatStickerSet associates a sticker set with a supergroup.
// Since: Bot API 3.2
// Returns True on success.
// See https://core.telegram.org/bots/api#setchatstickerset
func (api *API) SetChatStickerSet(params SetChatStickerSet) (bool, error) {
@@ -711,6 +800,7 @@ func (api *API) SetChatStickerSet(params SetChatStickerSet) (bool, error) {
}
// SetChatStickerSetWithContext is the context-aware variant of SetChatStickerSet.
// Since: Bot API 3.2
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#setchatstickerset
func (api *API) SetChatStickerSetWithContext(ctx context.Context, params SetChatStickerSet) (bool, error) {
@@ -719,12 +809,14 @@ func (api *API) SetChatStickerSetWithContext(ctx context.Context, params SetChat
}
// DeleteChatStickerSet holds parameters for the deleteChatStickerSet method.
// Since: Bot API 3.2
// See https://core.telegram.org/bots/api#deletechatstickerset
type DeleteChatStickerSet struct {
ChatID int64 `json:"chat_id"`
}
// DeleteChatStickerSet deletes a sticker set from a supergroup.
// Since: Bot API 3.2
// Returns True on success.
// See https://core.telegram.org/bots/api#deletechatstickerset
func (api *API) DeleteChatStickerSet(params DeleteChatStickerSet) (bool, error) {
@@ -733,6 +825,7 @@ func (api *API) DeleteChatStickerSet(params DeleteChatStickerSet) (bool, error)
}
// DeleteChatStickerSetWithContext is the context-aware variant of DeleteChatStickerSet.
// Since: Bot API 3.2
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#deletechatstickerset
func (api *API) DeleteChatStickerSetWithContext(ctx context.Context, params DeleteChatStickerSet) (bool, error) {
@@ -741,6 +834,7 @@ func (api *API) DeleteChatStickerSetWithContext(ctx context.Context, params Dele
}
// GetUserChatBoosts holds parameters for the getUserChatBoosts method.
// Since: Bot API 7.0
// See https://core.telegram.org/bots/api#getuserchatboosts
type GetUserChatBoosts struct {
ChatID int64 `json:"chat_id"`
@@ -748,6 +842,7 @@ type GetUserChatBoosts struct {
}
// GetUserChatBoosts returns the list of boosts a user has given to a chat.
// Since: Bot API 7.0
// See https://core.telegram.org/bots/api#getuserchatboosts
func (api *API) GetUserChatBoosts(params GetUserChatBoosts) (UserChatBoosts, error) {
req := NewRequestWithChatID[UserChatBoosts]("getUserChatBoosts", params, params.ChatID)
@@ -755,6 +850,7 @@ func (api *API) GetUserChatBoosts(params GetUserChatBoosts) (UserChatBoosts, err
}
// GetUserChatBoostsWithContext is the context-aware variant of GetUserChatBoosts.
// Since: Bot API 7.0
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#getuserchatboosts
func (api *API) GetUserChatBoostsWithContext(ctx context.Context, params GetUserChatBoosts) (UserChatBoosts, error) {
@@ -763,6 +859,7 @@ func (api *API) GetUserChatBoostsWithContext(ctx context.Context, params GetUser
}
// GetChatGifts holds parameters for the getChatGifts method.
// Since: Bot API 9.3
// See https://core.telegram.org/bots/api#getchatgifts
type GetChatGifts struct {
ChatID int64 `json:"chat_id"`
@@ -779,6 +876,7 @@ type GetChatGifts struct {
}
// GetChatGifts returns gifts owned by a chat.
// Since: Bot API 9.3
// See https://core.telegram.org/bots/api#getchatgifts
func (api *API) GetChatGifts(params GetChatGifts) (OwnedGifts, error) {
req := NewRequestWithChatID[OwnedGifts]("getChatGifts", params, params.ChatID)
@@ -786,6 +884,7 @@ func (api *API) GetChatGifts(params GetChatGifts) (OwnedGifts, error) {
}
// GetChatGiftsWithContext is the context-aware variant of GetChatGifts.
// Since: Bot API 9.3
// It executes the same request but uses ctx for cancellation and deadlines.
// See https://core.telegram.org/bots/api#getchatgifts
func (api *API) GetChatGiftsWithContext(ctx context.Context, params GetChatGifts) (OwnedGifts, error) {