From f4f48285697097e91393c4c43f2287addf877885 Mon Sep 17 00:00:00 2001 From: Paul Larsen Date: Sat, 23 Sep 2023 12:09:25 +0100 Subject: [PATCH] Bot API 6.9 (#117) * Regenerate lib with bot api 6.9 * re-regenerate to add missing fields from tg --- gen_methods.go | 19 ++++++++++++++----- gen_types.go | 51 +++++++++++++++++++++++++++++++++++++------------- spec_commit | 2 +- 3 files changed, 53 insertions(+), 19 deletions(-) diff --git a/gen_methods.go b/gen_methods.go index 0dd3f70a..406ae098 100755 --- a/gen_methods.go +++ b/gen_methods.go @@ -303,7 +303,7 @@ func (bot *Bot) ApproveChatJoinRequest(chatId int64, userId int64, opts *Approve // BanChatMemberOpts is the set of optional fields for Bot.BanChatMember. type BanChatMemberOpts struct { - // 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. + // 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 int64 // 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 @@ -2374,14 +2374,20 @@ func (bot *Bot) PinChatMessage(chatId int64, messageId int64, opts *PinChatMessa type PromoteChatMemberOpts struct { // Pass True if the administrator's presence in the chat is hidden IsAnonymous bool - // Pass True if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege + // Pass True if the administrator can access the chat event log, chat statistics, boost list in channels, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege CanManageChat bool - // Pass True if the administrator can create channel posts, channels only + // Pass True if the administrator can post messages in the channel; channels only CanPostMessages bool - // Pass True if the administrator can edit messages of other users and can pin messages, channels only + // Pass True if the administrator can edit messages of other users and can pin messages; channels only CanEditMessages bool // Pass True if the administrator can delete messages of other users CanDeleteMessages bool + // Pass True if the administrator can post stories in the channel; channels only + CanPostStories bool + // Pass True if the administrator can edit stories posted by other users; channels only + CanEditStories bool + // Pass True if the administrator can delete stories posted by other users; channels only + CanDeleteStories bool // Pass True if the administrator can manage video chats CanManageVideoChats bool // Pass True if the administrator can restrict, ban or unban chat members @@ -2416,6 +2422,9 @@ func (bot *Bot) PromoteChatMember(chatId int64, userId int64, opts *PromoteChatM v["can_post_messages"] = strconv.FormatBool(opts.CanPostMessages) v["can_edit_messages"] = strconv.FormatBool(opts.CanEditMessages) v["can_delete_messages"] = strconv.FormatBool(opts.CanDeleteMessages) + v["can_post_stories"] = strconv.FormatBool(opts.CanPostStories) + v["can_edit_stories"] = strconv.FormatBool(opts.CanEditStories) + v["can_delete_stories"] = strconv.FormatBool(opts.CanDeleteStories) v["can_manage_video_chats"] = strconv.FormatBool(opts.CanManageVideoChats) v["can_restrict_members"] = strconv.FormatBool(opts.CanRestrictMembers) v["can_promote_members"] = strconv.FormatBool(opts.CanPromoteMembers) @@ -2503,7 +2512,7 @@ func (bot *Bot) ReopenGeneralForumTopic(chatId int64, opts *ReopenGeneralForumTo type RestrictChatMemberOpts struct { // 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 - // 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 + // 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 int64 // RequestOpts are an additional optional field to configure timeouts for individual requests RequestOpts *RequestOpts diff --git a/gen_types.go b/gen_types.go index 002ae9e2..4b0eca57 100755 --- a/gen_types.go +++ b/gen_types.go @@ -432,7 +432,7 @@ type Chat struct { ActiveUsernames []string `json:"active_usernames,omitempty"` // Optional. Custom emoji identifier of emoji status of the other party in a private chat. Returned only in getChat. EmojiStatusCustomEmojiId string `json:"emoji_status_custom_emoji_id,omitempty"` - // Optional. Expiration date of the emoji status of the other party in a private chat, if any. Returned only in getChat. + // Optional. Expiration date of the emoji status of the other party in a private chat in Unix time, if any. Returned only in getChat. EmojiStatusExpirationDate int64 `json:"emoji_status_expiration_date,omitempty"` // Optional. Bio of the other party in a private chat. Returned only in getChat. Bio string `json:"bio,omitempty"` @@ -478,7 +478,7 @@ type Chat struct { type ChatAdministratorRights struct { // True, if the user's presence in the chat is hidden IsAnonymous bool `json:"is_anonymous"` - // True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege + // True, if the administrator can access the chat event log, chat statistics, boost list in channels, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege CanManageChat bool `json:"can_manage_chat"` // True, if the administrator can delete messages of other users CanDeleteMessages bool `json:"can_delete_messages"` @@ -492,12 +492,18 @@ type ChatAdministratorRights struct { CanChangeInfo bool `json:"can_change_info"` // True, if the user is allowed to invite new users to the chat CanInviteUsers bool `json:"can_invite_users"` - // Optional. True, if the administrator can post in the channel; channels only + // Optional. True, if the administrator can post messages in the channel; channels only CanPostMessages bool `json:"can_post_messages,omitempty"` // Optional. True, if the administrator can edit messages of other users and can pin messages; channels only CanEditMessages bool `json:"can_edit_messages,omitempty"` // Optional. True, if the user is allowed to pin messages; groups and supergroups only CanPinMessages bool `json:"can_pin_messages,omitempty"` + // Optional. True, if the administrator can post stories in the channel; channels only + CanPostStories bool `json:"can_post_stories,omitempty"` + // Optional. True, if the administrator can edit stories posted by other users; channels only + CanEditStories bool `json:"can_edit_stories,omitempty"` + // Optional. True, if the administrator can delete stories posted by other users; channels only + CanDeleteStories bool `json:"can_delete_stories,omitempty"` // Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only CanManageTopics bool `json:"can_manage_topics,omitempty"` } @@ -584,7 +590,7 @@ type MergedChatMember struct { CustomTitle string `json:"custom_title,omitempty"` // Optional. True, if the bot is allowed to edit administrator privileges of that user (Only for administrator) CanBeEdited bool `json:"can_be_edited,omitempty"` - // Optional. True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege (Only for administrator) + // Optional. True, if the administrator can access the chat event log, chat statistics, boost list in channels, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege (Only for administrator) CanManageChat bool `json:"can_manage_chat,omitempty"` // Optional. True, if the administrator can delete messages of other users (Only for administrator) CanDeleteMessages bool `json:"can_delete_messages,omitempty"` @@ -598,12 +604,18 @@ type MergedChatMember struct { CanChangeInfo bool `json:"can_change_info,omitempty"` // Optional. True, if the user is allowed to invite new users to the chat (Only for administrator, restricted) CanInviteUsers bool `json:"can_invite_users,omitempty"` - // Optional. True, if the administrator can post in the channel; channels only (Only for administrator) + // Optional. True, if the administrator can post messages in the channel; channels only (Only for administrator) CanPostMessages bool `json:"can_post_messages,omitempty"` // Optional. True, if the administrator can edit messages of other users and can pin messages; channels only (Only for administrator) CanEditMessages bool `json:"can_edit_messages,omitempty"` // Optional. True, if the user is allowed to pin messages; groups and supergroups only (Only for administrator, restricted) CanPinMessages bool `json:"can_pin_messages,omitempty"` + // Optional. True, if the administrator can post stories in the channel; channels only (Only for administrator) + CanPostStories bool `json:"can_post_stories,omitempty"` + // Optional. True, if the administrator can edit stories posted by other users; channels only (Only for administrator) + CanEditStories bool `json:"can_edit_stories,omitempty"` + // Optional. True, if the administrator can delete stories posted by other users; channels only (Only for administrator) + CanDeleteStories bool `json:"can_delete_stories,omitempty"` // Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only (Only for administrator, restricted) CanManageTopics bool `json:"can_manage_topics,omitempty"` // Optional. True, if the user is a member of the chat at the moment of the request (Only for restricted) @@ -628,7 +640,7 @@ type MergedChatMember struct { CanSendOtherMessages bool `json:"can_send_other_messages,omitempty"` // Optional. True, if the user is allowed to add web page previews to their messages (Only for restricted) CanAddWebPagePreviews bool `json:"can_add_web_page_previews,omitempty"` - // Optional. Date when restrictions will be lifted for this user; unix time. If 0, then the user is restricted forever (Only for restricted, kicked) + // Optional. Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever (Only for restricted, kicked) UntilDate int64 `json:"until_date,omitempty"` } @@ -749,7 +761,7 @@ type ChatMemberAdministrator struct { CanBeEdited bool `json:"can_be_edited"` // True, if the user's presence in the chat is hidden IsAnonymous bool `json:"is_anonymous"` - // True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege + // True, if the administrator can access the chat event log, chat statistics, boost list in channels, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege CanManageChat bool `json:"can_manage_chat"` // True, if the administrator can delete messages of other users CanDeleteMessages bool `json:"can_delete_messages"` @@ -763,12 +775,18 @@ type ChatMemberAdministrator struct { CanChangeInfo bool `json:"can_change_info"` // True, if the user is allowed to invite new users to the chat CanInviteUsers bool `json:"can_invite_users"` - // Optional. True, if the administrator can post in the channel; channels only + // Optional. True, if the administrator can post messages in the channel; channels only CanPostMessages bool `json:"can_post_messages,omitempty"` // Optional. True, if the administrator can edit messages of other users and can pin messages; channels only CanEditMessages bool `json:"can_edit_messages,omitempty"` // Optional. True, if the user is allowed to pin messages; groups and supergroups only CanPinMessages bool `json:"can_pin_messages,omitempty"` + // Optional. True, if the administrator can post stories in the channel; channels only + CanPostStories bool `json:"can_post_stories,omitempty"` + // Optional. True, if the administrator can edit stories posted by other users; channels only + CanEditStories bool `json:"can_edit_stories,omitempty"` + // Optional. True, if the administrator can delete stories posted by other users; channels only + CanDeleteStories bool `json:"can_delete_stories,omitempty"` // Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only CanManageTopics bool `json:"can_manage_topics,omitempty"` // Optional. Custom title for this user @@ -802,6 +820,9 @@ func (v ChatMemberAdministrator) MergeChatMember() MergedChatMember { CanPostMessages: v.CanPostMessages, CanEditMessages: v.CanEditMessages, CanPinMessages: v.CanPinMessages, + CanPostStories: v.CanPostStories, + CanEditStories: v.CanEditStories, + CanDeleteStories: v.CanDeleteStories, CanManageTopics: v.CanManageTopics, CustomTitle: v.CustomTitle, } @@ -829,7 +850,7 @@ func (v ChatMemberAdministrator) chatMember() {} type ChatMemberBanned struct { // Information about the user User User `json:"user"` - // Date when restrictions will be lifted for this user; unix time. If 0, then the user is banned forever + // Date when restrictions will be lifted for this user; Unix time. If 0, then the user is banned forever UntilDate int64 `json:"until_date"` } @@ -1036,7 +1057,7 @@ type ChatMemberRestricted struct { CanPinMessages bool `json:"can_pin_messages"` // True, if the user is allowed to create forum topics CanManageTopics bool `json:"can_manage_topics"` - // Date when restrictions will be lifted for this user; unix time. If 0, then the user is restricted forever + // Date when restrictions will be lifted for this user; Unix time. If 0, then the user is restricted forever UntilDate int64 `json:"until_date"` } @@ -4180,7 +4201,7 @@ type Message struct { ChatShared *ChatShared `json:"chat_shared,omitempty"` // Optional. The domain name of the website on which the user has logged in. More about Telegram Login: https://core.telegram.org/widgets/login ConnectedWebsite string `json:"connected_website,omitempty"` - // Optional. Service message: the user allowed the bot added to the attachment menu to write messages + // Optional. Service message: the user allowed the bot to write messages after adding it to the attachment or side menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess WriteAccessAllowed *WriteAccessAllowed `json:"write_access_allowed,omitempty"` // Optional. Telegram Passport data PassportData *PassportData `json:"passport_data,omitempty"` @@ -5364,8 +5385,12 @@ type WebhookInfo struct { // WriteAccessAllowed (https://core.telegram.org/bots/api#writeaccessallowed) // -// This object represents a service message about a user allowing a bot to write messages after adding the bot to the attachment menu or launching a Web App from a link. +// This object represents a service message about a user allowing a bot to write messages after adding it to the attachment menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess. type WriteAccessAllowed struct { - // Optional. Name of the Web App which was launched from a link + // Optional. True, if the access was granted after the user accepted an explicit request from a Web App sent by the method requestWriteAccess + FromRequest bool `json:"from_request,omitempty"` + // Optional. Name of the Web App, if the access was granted when the Web App was launched from a link WebAppName string `json:"web_app_name,omitempty"` + // Optional. True, if the access was granted when the bot was added to the attachment or side menu + FromAttachmentMenu bool `json:"from_attachment_menu,omitempty"` } diff --git a/spec_commit b/spec_commit index 1a239774..cd51719f 100644 --- a/spec_commit +++ b/spec_commit @@ -1 +1 @@ -f46e09c35720438381f35eef748596d1657688b0 \ No newline at end of file +183db0aa4379678b0e0afade0bf24285708a8da2 \ No newline at end of file