diff --git a/CHANGELOG.md b/CHANGELOG.md index bde3cf5..9df5e7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v0.3.4 (2023-01-10) + +- support bot api 6.4 + ## v0.3.3 (2022-12-28) - add `RegisterHandlerMatchFunc` diff --git a/README.md b/README.md index 07a05d8..e225df2 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ > [Telegram Group](https://t.me/gotelegrambotui) -> Supports Bot API version: [6.3](https://core.telegram.org/bots/api#november-5-2022) from November 5, 2022 +> Supports Bot API version: [6.4](https://core.telegram.org/bots/api-changelog#december-30-2022) from December 30, 2022 It's a Go zero-dependencies telegram bot framework diff --git a/methods.go b/methods.go index 1f23c44..06be8f9 100644 --- a/methods.go +++ b/methods.go @@ -426,6 +426,41 @@ func (b *Bot) UnpinAllForumTopicMessages(ctx context.Context, params *UnpinAllFo return result, err } +// EditGeneralForumTopic https://core.telegram.org/bots/api#editgeneralforumtopic +func (b *Bot) EditGeneralForumTopic(ctx context.Context, params *EditGeneralForumTopicParams) (bool, error) { + var result bool + err := b.rawRequest(ctx, "editGeneralForumTopic", params, &result) + return result, err +} + +// CloseGeneralForumTopic https://core.telegram.org/bots/api#closegeneralforumtopic +func (b *Bot) CloseGeneralForumTopic(ctx context.Context, params *CloseGeneralForumTopicParams) (bool, error) { + var result bool + err := b.rawRequest(ctx, "closeGeneralForumTopic", params, &result) + return result, err +} + +// ReopenGeneralForumTopic https://core.telegram.org/bots/api#reopengeneralforumtopic +func (b *Bot) ReopenGeneralForumTopic(ctx context.Context, params *ReopenGeneralForumTopicParams) (bool, error) { + var result bool + err := b.rawRequest(ctx, "reopenGeneralForumTopic", params, &result) + return result, err +} + +// HideGeneralForumTopic https://core.telegram.org/bots/api#hidegeneralforumtopic +func (b *Bot) HideGeneralForumTopic(ctx context.Context, params *HideGeneralForumTopicParams) (bool, error) { + var result bool + err := b.rawRequest(ctx, "hideGeneralForumTopic", params, &result) + return result, err +} + +// UnhideGeneralForumTopic https://core.telegram.org/bots/api#unhidegeneralforumtopic +func (b *Bot) UnhideGeneralForumTopic(ctx context.Context, params *UnhideGeneralForumTopicParams) (bool, error) { + var result bool + err := b.rawRequest(ctx, "unhideGeneralForumTopic", params, &result) + return result, err +} + // DeleteForumTopic https://core.telegram.org/bots/api#unpinallforumtopicmessages func (b *Bot) DeleteForumTopic(ctx context.Context, params *DeleteForumTopicParams) (bool, error) { var result bool diff --git a/methods_params.go b/methods_params.go index 4f2af76..e80de5b 100644 --- a/methods_params.go +++ b/methods_params.go @@ -63,6 +63,7 @@ type SendPhotoParams struct { Caption string `json:"caption,omitempty"` ParseMode models.ParseMode `json:"parse_mode,omitempty"` CaptionEntities []models.MessageEntity `json:"caption_entities,omitempty"` + HasSpoiler bool `json:"has_spoiler,omitempty"` DisableNotification bool `json:"disable_notification,omitempty"` ProtectContent bool `json:"protect_content,omitempty"` ReplyToMessageID int `json:"reply_to_message_id,omitempty"` @@ -115,6 +116,7 @@ type SendVideoParams struct { Caption string `json:"caption,omitempty"` ParseMode models.ParseMode `json:"parse_mode,omitempty"` CaptionEntities []models.MessageEntity `json:"caption_entities,omitempty"` + HasSpoiler bool `json:"has_spoiler,omitempty"` SupportsStreaming bool `json:"supports_streaming,omitempty"` DisableNotification bool `json:"disable_notification,omitempty"` ProtectContent bool `json:"protect_content,omitempty"` @@ -134,6 +136,7 @@ type SendAnimationParams struct { Caption string `json:"caption,omitempty"` ParseMode models.ParseMode `json:"parse_mode,omitempty"` CaptionEntities []models.MessageEntity `json:"caption_entities,omitempty"` + HasSpoiler bool `json:"has_spoiler,omitempty"` DisableNotification bool `json:"disable_notification,omitempty"` ProtectContent bool `json:"protect_content,omitempty"` ReplyToMessageID int `json:"reply_to_message_id,omitempty"` @@ -281,8 +284,9 @@ type SendDiceParams struct { } type SendChatActionParams struct { - ChatID any `json:"chat_id"` - Action string `json:"action"` + ChatID any `json:"chat_id"` + MessageThreadID int `json:"message_thread_id,omitempty"` + Action string `json:"action"` } type GetUserProfilePhotosParams struct { @@ -458,8 +462,8 @@ type CreateForumTopicParams struct { type EditForumTopicParams struct { ChatID any `json:"chat_id"` MessageThreadID int `json:"message_thread_id"` - Name string `json:"name"` - IconCustomEmojiID string `json:"icon_custom_emoji_id"` + Name string `json:"name,omitempty"` + IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"` } type CloseForumTopicParams struct { @@ -482,6 +486,27 @@ type UnpinAllForumTopicMessagesParams struct { MessageThreadID int `json:"message_thread_id"` } +type EditGeneralForumTopicParams struct { + ChatID any `json:"chat_id"` + Name string `json:"name"` +} + +type CloseGeneralForumTopicParams struct { + ChatID any `json:"chat_id"` +} + +type ReopenGeneralForumTopicParams struct { + ChatID any `json:"chat_id"` +} + +type HideGeneralForumTopicParams struct { + ChatID any `json:"chat_id"` +} + +type UnhideGeneralForumTopicParams struct { + ChatID any `json:"chat_id"` +} + type DeleteChatStickerSetParams struct { ChatID any `json:"chat_id"` StickerSetName string `json:"sticker_set_name"` diff --git a/models/chat.go b/models/chat.go index 74f5ed9..8da9bd1 100644 --- a/models/chat.go +++ b/models/chat.go @@ -88,6 +88,8 @@ type Chat struct { Permissions *ChatPermissions `json:"permissions,omitempty"` SlowModeDelay int `json:"slow_mode_delay,omitempty"` MessageAutoDeleteTime int `json:"message_auto_delete_time,omitempty"` + HasAggressiveAntiSpamEnabled bool `json:"has_aggressive_anti_spam_enabled,omitempty"` + HasHiddenMembers bool `json:"has_hidden_members,omitempty"` HasProtectedContent bool `json:"has_protected_content,omitempty"` StickerSetName string `json:"sticker_set_name,omitempty"` CanSetStickerSet bool `json:"can_set_sticker_set,omitempty"` diff --git a/models/forum.go b/models/forum.go index df8a3f6..6291eb8 100644 --- a/models/forum.go +++ b/models/forum.go @@ -8,14 +8,35 @@ type ForumTopic struct { IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"` } +// ForumTopicCreated https://core.telegram.org/bots/api#forumtopiccreated type ForumTopicCreated struct { Name string `json:"name"` IconColor int `json:"icon_color"` IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"` } +// ForumTopicClosed https://core.telegram.org/bots/api#forumtopicclosed type ForumTopicClosed struct { } +// ForumTopicEdited https://core.telegram.org/bots/api#forumtopicedited +type ForumTopicEdited struct { + Name string `json:"name,omitempty"` + IconCustomEmojiID string `json:"icon_custom_emoji_id,omitempty"` +} + +// ForumTopicReopened https://core.telegram.org/bots/api#forumtopicreopened type ForumTopicReopened struct { } + +// GeneralForumTopicHidden https://core.telegram.org/bots/api#generalforumtopichidden +type GeneralForumTopicHidden struct { +} + +// GeneralForumTopicUnhidden https://core.telegram.org/bots/api#generalforumtopicunhidden +type GeneralForumTopicUnhidden struct { +} + +// WriteAccessAllowed https://core.telegram.org/bots/api#writeaccessallowed +type WriteAccessAllowed struct { +} diff --git a/models/message.go b/models/message.go index f47a1c0..46cb04f 100644 --- a/models/message.go +++ b/models/message.go @@ -43,6 +43,7 @@ type Message struct { Voice *Voice `json:"voice,omitempty"` Caption string `json:"caption,omitempty"` CaptionEntities []MessageEntity `json:"caption_entities,omitempty"` + HasMediaSpoiler bool `json:"has_media_spoiler,omitempty"` Contact *Contact `json:"contact,omitempty"` Dice *Dice `json:"dice,omitempty"` Game *Game `json:"game,omitempty"` @@ -64,11 +65,15 @@ type Message struct { Invoice *Invoice `json:"invoice,omitempty"` SuccessfulPayment *SuccessfulPayment `json:"successful_payment,omitempty"` ConnectedWebsite string `json:"connected_website,omitempty"` + WriteAccessAllowed *WriteAccessAllowed `json:"write_access_allowed,omitempty"` PassportData *PassportData `json:"passport_data,omitempty"` ProximityAlertTriggered *ProximityAlertTriggered `json:"proximity_alert_triggered,omitempty"` ForumTopicCreated *ForumTopicCreated `json:"forum_topic_created,omitempty"` + ForumTopicEdited *ForumTopicEdited `json:"forum_topic_edited,omitempty"` ForumTopicClosed *ForumTopicClosed `json:"forum_topic_closed,omitempty"` ForumTopicReopened *ForumTopicReopened `json:"forum_topic_reopened,omitempty"` + GeneralForumTopicHidden *GeneralForumTopicHidden `json:"general_forum_topic_hidden,omitempty"` + GeneralForumTopicUnhidden *GeneralForumTopicUnhidden `json:"general_forum_topic_unhidden,omitempty"` VoiceChatScheduled *VoiceChatScheduled `json:"voice_chat_scheduled,omitempty"` VoiceChatStarted *VoiceChatStarted `json:"voice_chat_started,omitempty"` VoiceChatEnded *VoiceChatEnded `json:"voice_chat_ended,omitempty"` diff --git a/models/reply_markup.go b/models/reply_markup.go index 4475aea..0dce1e1 100644 --- a/models/reply_markup.go +++ b/models/reply_markup.go @@ -31,6 +31,7 @@ type InlineKeyboardButton struct { // ReplyKeyboardMarkup https://core.telegram.org/bots/api#replykeyboardmarkup type ReplyKeyboardMarkup struct { Keyboard [][]KeyboardButton `json:"keyboard"` + IsPersistent bool `json:"is_persistent,omitempty"` ResizeKeyboard bool `json:"resize_keyboard,omitempty"` OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"` InputFieldPlaceholder string `json:"input_field_placeholder,omitempty"`