Skip to content

Commit

Permalink
v7.11 (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
negasus authored Oct 31, 2024
1 parent ffe9424 commit 7500be4
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 22 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.10.0 (2024-10-31)

- support API v7.11

## v1.9.1 (2024-10-21)

- fix unmarshal `ChatBackground` type (#126)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

> [Telegram Group](https://t.me/gotelegrambotui)
> Supports Bot API version: [7.10](https://core.telegram.org/bots/api#september-6-2024) from September 6, 2024
> Supports Bot API version: [7.11](https://core.telegram.org/bots/api#october-31-2024) from October 31, 2024
It's a Go zero-dependencies telegram bot framework

Expand Down
19 changes: 19 additions & 0 deletions methods_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type SendMessageParams struct {
LinkPreviewOptions *models.LinkPreviewOptions `json:"link_preview_options,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ProtectContent bool `json:"protect_content,omitempty"`
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
MessageEffectID string `json:"message_effect_id,omitempty"`
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
Expand Down Expand Up @@ -66,6 +67,7 @@ type CopyMessageParams struct {
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ProtectContent bool `json:"protect_content,omitempty"`
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
}
Expand Down Expand Up @@ -94,6 +96,7 @@ type SendPhotoParams struct {
HasSpoiler bool `json:"has_spoiler,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ProtectContent bool `json:"protect_content,omitempty"`
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
MessageEffectID string `json:"message_effect_id,omitempty"`
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
Expand All @@ -114,6 +117,7 @@ type SendAudioParams struct {
Thumbnail models.InputFile `json:"thumbnail,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ProtectContent bool `json:"protect_content,omitempty"`
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
MessageEffectID string `json:"message_effect_id,omitempty"`
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
Expand All @@ -132,6 +136,7 @@ type SendDocumentParams struct {
DisableContentTypeDetection bool `json:"disable_content_type_detection,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ProtectContent bool `json:"protect_content,omitempty"`
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
MessageEffectID string `json:"message_effect_id,omitempty"`
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
Expand All @@ -155,6 +160,7 @@ type SendVideoParams struct {
SupportsStreaming bool `json:"supports_streaming,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ProtectContent bool `json:"protect_content,omitempty"`
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
MessageEffectID string `json:"message_effect_id,omitempty"`
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
Expand All @@ -177,6 +183,7 @@ type SendAnimationParams struct {
HasSpoiler bool `json:"has_spoiler,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ProtectContent bool `json:"protect_content,omitempty"`
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
MessageEffectID string `json:"message_effect_id,omitempty"`
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
Expand All @@ -194,6 +201,7 @@ type SendVoiceParams struct {
Duration int `json:"duration,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ProtectContent bool `json:"protect_content,omitempty"`
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
MessageEffectID string `json:"message_effect_id,omitempty"`
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
Expand All @@ -210,6 +218,7 @@ type SendVideoNoteParams struct {
Thumbnail models.InputFile `json:"thumbnail,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ProtectContent bool `json:"protect_content,omitempty"`
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
MessageEffectID string `json:"message_effect_id,omitempty"`
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
Expand All @@ -228,6 +237,7 @@ type SendPaidMediaParams struct {
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ProtectContent bool `json:"protect_content,omitempty"`
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
}
Expand All @@ -240,6 +250,7 @@ type SendMediaGroupParams struct {
Media []models.InputMedia `json:"media"`
DisableNotification bool `json:"disable_notification,omitempty"`
ProtectContent bool `json:"protect_content,omitempty"`
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
MessageEffectID string `json:"message_effect_id,omitempty"`
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
}
Expand All @@ -257,6 +268,7 @@ type SendLocationParams struct {
ProximityAlertRadius int `json:"proximity_alert_radius,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ProtectContent bool `json:"protect_content,omitempty"`
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
MessageEffectID string `json:"message_effect_id,omitempty"`
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
Expand Down Expand Up @@ -299,6 +311,7 @@ type SendVenueParams struct {
GooglePlaceType string `json:"google_place_type,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ProtectContent bool `json:"protect_content,omitempty"`
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
MessageEffectID string `json:"message_effect_id,omitempty"`
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
Expand All @@ -315,6 +328,7 @@ type SendContactParams struct {
VCard string `json:"vcard,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ProtectContent bool `json:"protect_content,omitempty"`
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
MessageEffectID string `json:"message_effect_id,omitempty"`
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
Expand All @@ -341,6 +355,7 @@ type SendPollParams struct {
IsClosed bool `json:"is_closed,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ProtectContent bool `json:"protect_content,omitempty"`
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
MessageEffectID string `json:"message_effect_id,omitempty"`
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
Expand All @@ -354,6 +369,7 @@ type SendDiceParams struct {
Emoji string `json:"emoji,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ProtectContent bool `json:"protect_content,omitempty"`
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
MessageEffectID string `json:"message_effect_id,omitempty"`
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
Expand Down Expand Up @@ -771,6 +787,7 @@ type SendStickerParams struct {
Emoji string `json:"emoji,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ProtectContent bool `json:"protect_content,omitempty"`
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
MessageEffectID string `json:"message_effect_id,omitempty"`
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
Expand Down Expand Up @@ -897,6 +914,7 @@ type SendInvoiceParams struct {
IsFlexible bool `json:"is_flexible,omitempty"`
DisableNotification bool `json:"disable_notification,omitempty"`
ProtectContent bool `json:"protect_content,omitempty"`
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
MessageEffectID string `json:"message_effect_id,omitempty"`
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
Expand Down Expand Up @@ -961,6 +979,7 @@ type SendGameParams struct {
GameShorName string `json:"game_short_name"`
DisableNotification bool `json:"disable_notification,omitempty"`
ProtectContent bool `json:"protect_content,omitempty"`
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
MessageEffectID string `json:"message_effect_id,omitempty"`
ReplyParameters *models.ReplyParameters `json:"reply_parameters,omitempty"`
ReplyMarkup models.ReplyMarkup `json:"reply_markup,omitempty"`
Expand Down
6 changes: 6 additions & 0 deletions models/reply_markup.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ type SwitchInlineQueryChosenChat struct {
AllowChannelChats bool `json:"allow_channel_chats,omitempty"`
}

// CopyTextButton https://core.telegram.org/bots/api#copytextbutton
type CopyTextButton struct {
Text string `json:"text"`
}

// InlineKeyboardButton https://core.telegram.org/bots/api#inlinekeyboardbutton
type InlineKeyboardButton struct {
Text string `json:"text"`
Expand All @@ -34,6 +39,7 @@ type InlineKeyboardButton struct {
SwitchInlineQuery string `json:"switch_inline_query,omitempty"`
SwitchInlineQueryCurrentChat string `json:"switch_inline_query_current_chat,omitempty"`
SwitchInlineQueryChosenChat *SwitchInlineQueryChosenChat `json:"switch_inline_query_chosen_chat,omitempty"`
CopyText CopyTextButton `json:"copy_text,omitempty"`
CallbackGame *CallbackGame `json:"callback_game,omitempty"`
Pay bool `json:"pay,omitempty"`
}
Expand Down
60 changes: 39 additions & 21 deletions models/star.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,22 @@ import (
type TransactionPartnerType string

const (
TransactionPartnerTypeFragment TransactionPartnerType = "fragment"
TransactionPartnerTypeUser TransactionPartnerType = "user"
TransactionPartnerTypeOther TransactionPartnerType = "other"
TransactionPartnerTypeUser TransactionPartnerType = "user"
TransactionPartnerTypeFragment TransactionPartnerType = "fragment"
TransactionPartnerTypeTelegramAds TransactionPartnerType = "telegram_ads"
TransactionPartnerTypeTelegramApi TransactionPartnerType = "telegram_api"
TransactionPartnerTypeOther TransactionPartnerType = "other"
)

// TransactionPartner https://core.telegram.org/bots/api#transactionpartner
type TransactionPartner struct {
Type TransactionPartnerType

Fragment *TransactionPartnerFragment `json:"fragment,omitempty"`
User *TransactionPartnerUser `json:"user,omitempty"`
Other *TransactionPartnerOther `json:"other,omitempty"`
User *TransactionPartnerUser `json:"user,omitempty"`
Fragment *TransactionPartnerFragment `json:"fragment,omitempty"`
TelegramAds *TransactionPartnerTelegramAds `json:"telegram_ads,omitempty"`
TelegramApi *TransactionPartnerTelegramApi `json:"telegram_api,omitempty"`
Other *TransactionPartnerOther `json:"other,omitempty"`
}

func (m *TransactionPartner) UnmarshalJSON(data []byte) error {
Expand All @@ -32,14 +36,22 @@ func (m *TransactionPartner) UnmarshalJSON(data []byte) error {
}

switch v.Type {
case TransactionPartnerTypeFragment:
m.Type = TransactionPartnerTypeFragment
m.Fragment = &TransactionPartnerFragment{}
return json.Unmarshal(data, m.Fragment)
case TransactionPartnerTypeUser:
m.Type = TransactionPartnerTypeUser
m.User = &TransactionPartnerUser{}
return json.Unmarshal(data, m.User)
case TransactionPartnerTypeFragment:
m.Type = TransactionPartnerTypeFragment
m.Fragment = &TransactionPartnerFragment{}
return json.Unmarshal(data, m.Fragment)
case TransactionPartnerTypeTelegramAds:
m.Type = TransactionPartnerTypeTelegramAds
m.TelegramAds = &TransactionPartnerTelegramAds{}
return json.Unmarshal(data, m.TelegramAds)
case TransactionPartnerTypeTelegramApi:
m.Type = TransactionPartnerTypeTelegramApi
m.TelegramApi = &TransactionPartnerTelegramApi{}
return json.Unmarshal(data, m.TelegramApi)
case TransactionPartnerTypeOther:
m.Type = TransactionPartnerTypeOther
m.Other = &TransactionPartnerOther{}
Expand All @@ -49,12 +61,6 @@ func (m *TransactionPartner) UnmarshalJSON(data []byte) error {
return fmt.Errorf("unsupported TransactionPartner type")
}

// TransactionPartnerFragment https://core.telegram.org/bots/api#transactionpartnerfragment
type TransactionPartnerFragment struct {
Type TransactionPartnerType `json:"type"`
WithdrawalState *RevenueWithdrawalState `json:"withdrawal_state,omitempty"`
}

// TransactionPartnerUser https://core.telegram.org/bots/api#transactionpartneruser
type TransactionPartnerUser struct {
Type TransactionPartnerType `json:"type"`
Expand All @@ -64,6 +70,23 @@ type TransactionPartnerUser struct {
PaidMediaPayload string `json:"paid_media_payload,omitempty"`
}

// TransactionPartnerFragment https://core.telegram.org/bots/api#transactionpartnerfragment
type TransactionPartnerFragment struct {
Type TransactionPartnerType `json:"type"`
WithdrawalState *RevenueWithdrawalState `json:"withdrawal_state,omitempty"`
}

// TransactionPartnerTelegramAds https://core.telegram.org/bots/api#transactionpartnertelegramads
type TransactionPartnerTelegramAds struct {
Type TransactionPartnerType `json:"type"`
}

// TransactionPartnerTelegramApi https://core.telegram.org/bots/api#transactionpartnertelegramapi
type TransactionPartnerTelegramApi struct {
Type TransactionPartnerType `json:"type"`
RequestCount int `json:"request_count"`
}

// TransactionPartnerOther https://core.telegram.org/bots/api#transactionpartnerother
type TransactionPartnerOther struct {
Type TransactionPartnerType `json:"type"`
Expand Down Expand Up @@ -143,8 +166,3 @@ type StarTransaction struct {
type StarTransactions struct {
Transactions []StarTransaction `json:"transactions"`
}

// TransactionPartnerTelegramAds https://core.telegram.org/bots/api#transactionpartnertelegramads
type TransactionPartnerTelegramAds struct {
Type string `json:"type"`
}

0 comments on commit 7500be4

Please sign in to comment.