Skip to content

Commit

Permalink
api 6.4
Browse files Browse the repository at this point in the history
  • Loading branch information
negasus committed Jan 10, 2023
1 parent 04069e2 commit 1d0067f
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v0.3.4 (2023-01-10)

- support bot api 6.4

## v0.3.3 (2022-12-28)

- add `RegisterHandlerMatchFunc`
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
35 changes: 35 additions & 0 deletions methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 29 additions & 4 deletions methods_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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"`
Expand All @@ -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"`
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -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"`
Expand Down
2 changes: 2 additions & 0 deletions models/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
21 changes: 21 additions & 0 deletions models/forum.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
}
5 changes: 5 additions & 0 deletions models/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand All @@ -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"`
Expand Down
1 change: 1 addition & 0 deletions models/reply_markup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down

0 comments on commit 1d0067f

Please sign in to comment.