Skip to content

Commit

Permalink
v7.2 (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
negasus authored Apr 2, 2024
1 parent 158a3c1 commit d8831e7
Show file tree
Hide file tree
Showing 11 changed files with 325 additions and 216 deletions.
7 changes: 7 additions & 0 deletions methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,13 @@ func (b *Bot) DeleteStickerFromSet(ctx context.Context, params *DeleteStickerFro
return result, err
}

// ReplaceStickerInSet https://core.telegram.org/bots/api#replacestickerinset
func (b *Bot) ReplaceStickerInSet(ctx context.Context, params *ReplaceStickerInSetParams) (bool, error) {
var result bool
err := b.rawRequest(ctx, "replaceStickerInSet", params, &result)
return result, err
}

// SetStickerEmojiList https://core.telegram.org/bots/api#setstickeremojilist
func (b *Bot) SetStickerEmojiList(ctx context.Context, params *SetStickerEmojiListParams) (bool, error) {
var result bool
Expand Down
312 changes: 168 additions & 144 deletions methods_params.go

Large diffs are not rendered by default.

43 changes: 43 additions & 0 deletions models/business.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package models

// BusinessConnection https://core.telegram.org/bots/api#businessconnection
type BusinessConnection struct {
ID string `json:"id"`
User User `json:"user"`
UserChatID int64 `json:"user_chat_id"`
Date int64 `json:"date"`
CanReply bool `json:"can_reply"`
IsEnabled bool `json:"is_enabled"`
}

// BusinessMessagesDeleted https://core.telegram.org/bots/api#businessmessagesdeleted
type BusinessMessagesDeleted struct {
BusinessConnectionID string `json:"business_connection_id"`
Chat Chat `json:"chat"`
MessageIDs []int `json:"message_ids"`
}

// BusinessIntro https://core.telegram.org/bots/api#businessintro
type BusinessIntro struct {
Title string `json:"title,omitempty"`
Message string `json:"message,omitempty"`
Sticker *Sticker `json:"sticker,omitempty"`
}

// BusinessLocation https://core.telegram.org/bots/api#businesslocation
type BusinessLocation struct {
Address string `json:"address"`
Location *Location `json:"location,omitempty"`
}

// BusinessOpeningHours https://core.telegram.org/bots/api#businessopeninghours
type BusinessOpeningHours struct {
TimeZoneName string `json:"time_zone_name"`
OpeningHours []BusinessOpeningHoursInterval `json:"opening_hours"`
}

// BusinessOpeningHoursInterval https://core.telegram.org/bots/api#businessopeninghoursinterval
type BusinessOpeningHoursInterval struct {
OpeningMinute int `json:"opening_minute"`
ClosingMinute int `json:"closing_minute"`
}
85 changes: 48 additions & 37 deletions models/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,43 +74,54 @@ type ChatLocation struct {
Address string `json:"address"`
}

type Birthdate struct {
Day int `json:"day"`
Month int `json:"month"`
Year int `json:"year,omitempty"`
}

// Chat https://core.telegram.org/bots/api#chat
type Chat struct {
ID int64 `json:"id"`
Type string `json:"type"`
Title string `json:"title,omitempty"`
Username string `json:"username,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
IsForum bool `json:"is_forum,omitempty"`
Photo *ChatPhoto `json:"photo,omitempty"`
ActiveUsernames []string `json:"active_usernames,omitempty"`
AvailableReactions []ReactionType `json:"available_reactions,omitempty"`
AccentColorID int `json:"accent_color_id,omitempty"`
BackgroundCustomEmojiID string `json:"background_custom_emoji_id,omitempty"`
ProfileAccentColorID int `json:"profile_accent_color_id,omitempty"`
ProfileBackgroundCustomEmojiID string `json:"profile_background_custom_emoji_id,omitempty"`
EmojiStatusCustomEmojiID string `json:"emoji_status_custom_emoji_id,omitempty"`
EmojiStatusExpirationDate int `json:"emoji_status_expiration_date,omitempty"`
Bio string `json:"bio"`
HasPrivateForwards bool `json:"has_private_forwards,omitempty"`
HasRestrictedVoiceAndVideoMessages bool `json:"has_restricted_voice_and_video_messages,omitempty"`
JoinToSendMessages bool `json:"join_to_send_messages"`
JoinByRequest bool `json:"join_by_request"`
Description string `json:"description,omitempty"`
InviteLink string `json:"invite_link,omitempty"`
PinnedMessage *Message `json:"pinned_message,omitempty"`
Permissions *ChatPermissions `json:"permissions,omitempty"`
SlowModeDelay int `json:"slow_mode_delay,omitempty"`
UnrestrictBoostCount int `json:"unrestrict_boost_count,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"`
HasVisibleHistory bool `json:"has_visible_history,omitempty"`
StickerSetName string `json:"sticker_set_name,omitempty"`
CanSetStickerSet bool `json:"can_set_sticker_set,omitempty"`
CustomEmojiStickerSetName string `json:"custom_emoji_sticker_set_name,omitempty"`
LinkedChatID int64 `json:"linked_chat_id,omitempty"`
Location *ChatLocation `json:"location,omitempty"`
ID int64 `json:"id"`
Type string `json:"type"`
Title string `json:"title,omitempty"`
Username string `json:"username,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
IsForum bool `json:"is_forum,omitempty"`
Photo *ChatPhoto `json:"photo,omitempty"`
ActiveUsernames []string `json:"active_usernames,omitempty"`
Birthdate Birthdate `json:"birthdate,omitempty"`
BusinessIntro *BusinessIntro `json:"business_intro,omitempty"`
BusinessLocation *BusinessLocation `json:"business_location,omitempty"`
BusinessOpeningHours *BusinessOpeningHours `json:"business_opening_hours,omitempty"`
PersonalChat *Chat `json:"personal_chat,omitempty"`
AvailableReactions []ReactionType `json:"available_reactions,omitempty"`
AccentColorID int `json:"accent_color_id,omitempty"`
BackgroundCustomEmojiID string `json:"background_custom_emoji_id,omitempty"`
ProfileAccentColorID int `json:"profile_accent_color_id,omitempty"`
ProfileBackgroundCustomEmojiID string `json:"profile_background_custom_emoji_id,omitempty"`
EmojiStatusCustomEmojiID string `json:"emoji_status_custom_emoji_id,omitempty"`
EmojiStatusExpirationDate int `json:"emoji_status_expiration_date,omitempty"`
Bio string `json:"bio"`
HasPrivateForwards bool `json:"has_private_forwards,omitempty"`
HasRestrictedVoiceAndVideoMessages bool `json:"has_restricted_voice_and_video_messages,omitempty"`
JoinToSendMessages bool `json:"join_to_send_messages"`
JoinByRequest bool `json:"join_by_request"`
Description string `json:"description,omitempty"`
InviteLink string `json:"invite_link,omitempty"`
PinnedMessage *Message `json:"pinned_message,omitempty"`
Permissions *ChatPermissions `json:"permissions,omitempty"`
SlowModeDelay int `json:"slow_mode_delay,omitempty"`
UnrestrictBoostCount int `json:"unrestrict_boost_count,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"`
HasVisibleHistory bool `json:"has_visible_history,omitempty"`
StickerSetName string `json:"sticker_set_name,omitempty"`
CanSetStickerSet bool `json:"can_set_sticker_set,omitempty"`
CustomEmojiStickerSetName string `json:"custom_emoji_sticker_set_name,omitempty"`
LinkedChatID int64 `json:"linked_chat_id,omitempty"`
Location *ChatLocation `json:"location,omitempty"`
}
20 changes: 16 additions & 4 deletions models/forum.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,28 @@ type UserShared struct {
UserID int64 `json:"user_id"`
}

// SharedUser https://core.telegram.org/bots/api#shareduser
type SharedUser struct {
UserID int64 `json:"user_id"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Username string `json:"username,omitempty"`
Photo []PhotoSize `json:"photo,omitempty"`
}

// UsersShared https://core.telegram.org/bots/api#usersshared
type UsersShared struct {
RequestID int `json:"request_id"`
UserIDs []int64 `json:"user_ids"`
RequestID int `json:"request_id"`
Users []SharedUser `json:"users"`
}

// ChatShared https://core.telegram.org/bots/api#chatshared
type ChatShared struct {
RequestID int `json:"request_id"`
ChatID int64 `json:"chat_id"`
RequestID int `json:"request_id"`
ChatID int64 `json:"chat_id"`
Title string `json:"title,omitempty"`
Username string `json:"username,omitempty"`
Photo []PhotoSize `json:"photo,omitempty"`
}

// WriteAccessAllowed https://core.telegram.org/bots/api#writeaccessallowed
Expand Down
3 changes: 3 additions & 0 deletions models/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ type Message struct {
From *User `json:"from,omitempty"`
SenderChat *Chat `json:"sender_chat,omitempty"`
SenderBoostCount int `json:"sender_boost_count,omitempty"`
SenderBusinessBot *User `json:"sender_business_bot,omitempty"`
Date int `json:"date"`
BusinessConnectionID string `json:"business_connection_id,omitempty"`
Chat Chat `json:"chat"`
ForwardOrigin *MessageOrigin `json:"forward_origin,omitempty"`
IsTopicMessage bool `json:"is_topic_message,omitempty"`
Expand All @@ -75,6 +77,7 @@ type Message struct {
ViaBot *User `json:"via_bot,omitempty"`
EditDate int `json:"edit_date,omitempty"`
HasProtectedContent bool `json:"has_protected_content,omitempty"`
IsFromOffline bool `json:"is_from_offline,omitempty"`
MediaGroupID string `json:"media_group_id,omitempty"`
AuthorSignature string `json:"author_signature,omitempty"`
Text string `json:"text,omitempty"`
Expand Down
14 changes: 10 additions & 4 deletions models/reply_markup.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,13 @@ type KeyboardButtonRequestUser struct {

// KeyboardButtonRequestUsers https://core.telegram.org/bots/api#keyboardbuttonrequestusers
type KeyboardButtonRequestUsers struct {
RequestID int32 `json:"request_id"`
UserIsBot bool `json:"user_is_bot,omitempty"`
UserIsPremium bool `json:"user_is_premium,omitempty"`
MaxQuantity int `json:"max_quantity,omitempty"`
RequestID int32 `json:"request_id"`
UserIsBot bool `json:"user_is_bot,omitempty"`
UserIsPremium bool `json:"user_is_premium,omitempty"`
MaxQuantity int `json:"max_quantity,omitempty"`
RequestName bool `json:"request_name,omitempty"`
RequestUsername bool `json:"request_username,omitempty"`
RequestPhoto bool `json:"request_photo,omitempty"`
}

// KeyboardButtonRequestChat https://core.telegram.org/bots/api#keyboardbuttonrequestchat
Expand All @@ -85,6 +88,9 @@ type KeyboardButtonRequestChat struct {
UserAdministratorRights *ChatAdministratorRights `json:"user_administrator_rights,omitempty"`
BotAdministratorRights *ChatAdministratorRights `json:"bot_administrator_rights,omitempty"`
BotIsMember bool `json:"bot_is_member,omitempty"`
RequestTitle bool `json:"request_title,omitempty"`
RequestUsername bool `json:"request_username,omitempty"`
RequestPhoto bool `json:"request_photo,omitempty"`
}

// KeyboardButtonPollType https://core.telegram.org/bots/api#keyboardbuttonpolltype
Expand Down
1 change: 1 addition & 0 deletions models/sticker.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type Sticker struct {
// InputSticker https://core.telegram.org/bots/api#inputsticker
type InputSticker struct {
Sticker InputFile `json:"sticker"`
Format string `json:"format"`
EmojiList []string `json:"emoji_list"`
MaskPosition MaskPosition `json:"mask_position,omitempty"`
Keywords []string `json:"keywords,omitempty"`
Expand Down
13 changes: 5 additions & 8 deletions models/sticker_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ package models

// StickerSet https://core.telegram.org/bots/api#stickerset
type StickerSet struct {
Name string `json:"name"`
Title string `json:"title"`
StickerType string `json:"sticker_type"`
IsAnimated bool `json:"is_animated"`
IsVideo bool `json:"is_video"`
ContainsMasks bool `json:"contains_masks"`
Stickers []Sticker `json:"stickers"`
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
Name string `json:"name"`
Title string `json:"title"`
StickerType string `json:"sticker_type"`
Stickers []Sticker `json:"stickers"`
Thumbnail *PhotoSize `json:"thumbnail,omitempty"`
}
42 changes: 23 additions & 19 deletions models/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,27 @@ package models

// Update https://core.telegram.org/bots/api#update
type Update struct {
ID int64 `json:"update_id"`
Message *Message `json:"message,omitempty"`
EditedMessage *Message `json:"edited_message,omitempty"`
ChannelPost *Message `json:"channel_post,omitempty"`
EditedChannelPost *Message `json:"edited_channel_post,omitempty"`
MessageReaction *MessageReactionUpdated `json:"message_reaction,omitempty"`
MessageReactionCount *MessageReactionCountUpdated `json:"message_reaction_count,omitempty"`
InlineQuery *InlineQuery `json:"inline_query,omitempty"`
ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"`
CallbackQuery *CallbackQuery `json:"callback_query,omitempty"`
ShippingQuery *ShippingQuery `json:"shipping_query,omitempty"`
PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query,omitempty"`
Poll *Poll `json:"poll,omitempty"`
PollAnswer *PollAnswer `json:"poll_answer,omitempty"`
MyChatMember *ChatMemberUpdated `json:"my_chat_member,omitempty"`
ChatMember *ChatMemberUpdated `json:"chat_member,omitempty"`
ChatJoinRequest *ChatJoinRequest `json:"chat_join_request,omitempty"`
ChatBoost *ChatBoostUpdated `json:"chat_boost,omitempty"`
RemovedChatBoost *ChatBoostRemoved `json:"removed_chat_boost,omitempty"`
ID int64 `json:"update_id"`
Message *Message `json:"message,omitempty"`
EditedMessage *Message `json:"edited_message,omitempty"`
ChannelPost *Message `json:"channel_post,omitempty"`
EditedChannelPost *Message `json:"edited_channel_post,omitempty"`
BusinessConnection *BusinessConnection `json:"business_connection,omitempty"`
BusinessMessage *Message `json:"business_message,omitempty"`
EditedBusinessMessage *Message `json:"edited_business_message,omitempty"`
DeletedBusinessMessages *BusinessMessagesDeleted `json:"deleted_business_messages,omitempty"`
MessageReaction *MessageReactionUpdated `json:"message_reaction,omitempty"`
MessageReactionCount *MessageReactionCountUpdated `json:"message_reaction_count,omitempty"`
InlineQuery *InlineQuery `json:"inline_query,omitempty"`
ChosenInlineResult *ChosenInlineResult `json:"chosen_inline_result,omitempty"`
CallbackQuery *CallbackQuery `json:"callback_query,omitempty"`
ShippingQuery *ShippingQuery `json:"shipping_query,omitempty"`
PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query,omitempty"`
Poll *Poll `json:"poll,omitempty"`
PollAnswer *PollAnswer `json:"poll_answer,omitempty"`
MyChatMember *ChatMemberUpdated `json:"my_chat_member,omitempty"`
ChatMember *ChatMemberUpdated `json:"chat_member,omitempty"`
ChatJoinRequest *ChatJoinRequest `json:"chat_join_request,omitempty"`
ChatBoost *ChatBoostUpdated `json:"chat_boost,omitempty"`
RemovedChatBoost *ChatBoostRemoved `json:"removed_chat_boost,omitempty"`
}
1 change: 1 addition & 0 deletions models/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ type User struct {
CanJoinGroups bool `json:"can_join_groups,omitempty"`
CanReadAllGroupMessages bool `json:"can_read_all_group_messages,omitempty"`
SupportInlineQueries bool `json:"support_inline_queries,omitempty"`
CanConnectToBusiness bool `json:"can_connect_to_business,omitempty"`
}

0 comments on commit d8831e7

Please sign in to comment.