Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v7.11 #127

Merged
merged 1 commit into from
Oct 31, 2024
Merged

v7.11 #127

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
v7.11
negasus committed Oct 31, 2024
commit 6b999399e478ad38324eec81fbdaf198078a1738
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)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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

19 changes: 19 additions & 0 deletions methods_params.go
Original file line number Diff line number Diff line change
@@ -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"`
@@ -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"`
}
@@ -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"`
@@ -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"`
@@ -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"`
@@ -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"`
@@ -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"`
@@ -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"`
@@ -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"`
@@ -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"`
}
@@ -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"`
}
@@ -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"`
@@ -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"`
@@ -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"`
@@ -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"`
@@ -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"`
@@ -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"`
@@ -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"`
@@ -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"`
6 changes: 6 additions & 0 deletions models/reply_markup.go
Original file line number Diff line number Diff line change
@@ -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"`
@@ -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"`
}
60 changes: 39 additions & 21 deletions models/star.go
Original file line number Diff line number Diff line change
@@ -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 {
@@ -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{}
@@ -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"`
@@ -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"`
@@ -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"`
}