Skip to content

Commit

Permalink
7.10 (#114)
Browse files Browse the repository at this point in the history
* 7.10

* changelog
  • Loading branch information
negasus authored Sep 13, 2024
1 parent 463c180 commit 581c533
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 16 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## v1.8.0 (2024-09-13)

- support API v7.10
- change type for field Type in models.Chat and models.ChatFullInfo from `string` to `models.ChatType`
- add consts for ChatType
- models.ChatTypePrivate
- models.ChatTypeGroup
- models.ChatTypeSupergroup
- models.ChatTypeChannel


## v1.7.3 (2024-09-10)

- Fix findHandler behavior
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.9](https://core.telegram.org/bots/api#august-14-2024) from August 14, 2024
> Supports Bot API version: [7.10](https://core.telegram.org/bots/api#september-6-2024) from September 6, 2024
It's a Go zero-dependencies telegram bot framework

Expand Down
1 change: 1 addition & 0 deletions methods_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ type SendPaidMediaParams struct {
ChatID any `json:"chat_id"`
StarCount int `json:"star_count"`
Media []models.InputPaidMedia `json:"media"`
Payload string `json:"payload,omitempty"`
Caption string `json:"caption,omitempty"`
ParseMode models.ParseMode `json:"parse_mode,omitempty"`
CaptionEntities []models.MessageEntity `json:"caption_entities,omitempty"`
Expand Down
7 changes: 5 additions & 2 deletions models/boost.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ type ChatBoostSourceGiftCode struct {

// ChatBoostSourceGiveaway https://core.telegram.org/bots/api#chatboostsourcegiveaway
type ChatBoostSourceGiveaway struct {
Source ChatBoostSourceType `json:"source"` // always “giveaway”
User User `json:"user"`
Source ChatBoostSourceType `json:"source"` // always “giveaway”
GiveawayMessageID int `json:"giveaway_message_id"`
User User `json:"user"`
PrizeStarCount int `json:"prize_star_count,omitempty"`
IsUnclaimed bool `json:"is_unclaimed,omitempty"`
}
25 changes: 17 additions & 8 deletions models/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,30 @@ type Birthdate struct {
Year int `json:"year,omitempty"`
}

type ChatType string

const (
ChatTypePrivate ChatType = "private"
ChatTypeGroup ChatType = "group"
ChatTypeSupergroup ChatType = "supergroup"
ChatTypeChannel ChatType = "channel"
)

// 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"`
ID int64 `json:"id"`
Type ChatType `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"`
}

// ChatFullInfo https://core.telegram.org/bots/api#chatfullinfo
type ChatFullInfo struct {
ID int64 `json:"id"`
Type string `json:"type"`
Type ChatType `json:"type"`
Title string `json:"title,omitempty"`
Username string `json:"username,omitempty"`
FirstName string `json:"first_name,omitempty"`
Expand Down
7 changes: 6 additions & 1 deletion models/giveaway.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ type Giveaway struct {
HasPublicWinners bool `json:"has_public_winners,omitempty"`
PrizeDescription string `json:"prize_description,omitempty"`
CountryCodes []string `json:"country_codes,omitempty"`
PrizeStarCount int `json:"prize_star_count,omitempty"`
PremiumSubscriptionMonthCount int `json:"premium_subscription_month_count,omitempty"`
}

// GiveawayCreated https://core.telegram.org/bots/api#giveawaycreated
type GiveawayCreated struct{}
type GiveawayCreated struct {
PrizeStarCount int `json:"prize_star_count,omitempty"`
}

// GiveawayWinners https://core.telegram.org/bots/api#giveawaywinners
type GiveawayWinners struct {
Expand All @@ -25,6 +28,7 @@ type GiveawayWinners struct {
AdditionalChatCount int `json:"additional_chat_count,omitempty"`
PremiumSubscriptionMonthCount int `json:"premium_subscription_month_count,omitempty"`
UnclaimedPrizeCount int `json:"unclaimed_prize_count,omitempty"`
PrizeStarCount int `json:"prize_star_count,omitempty"`
OnlyNewMembers bool `json:"only_new_members,omitempty"`
WasRefunded bool `json:"was_refunded,omitempty"`
PrizeDescription string `json:"prize_description,omitempty"`
Expand All @@ -35,4 +39,5 @@ type GiveawayCompleted struct {
WinnerCount int `json:"winner_count"`
UnclaimedPrizeCount int `json:"unclaimed_prize_count,omitempty"`
GiveawayMessage *Message `json:"giveaway_message,omitempty"`
IsStarGiveaway bool `json:"is_star_giveaway,omitempty"`
}
6 changes: 6 additions & 0 deletions models/paid.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,9 @@ type PaidMediaInfo struct {
StarCount int `json:"star_count"`
PaidMedia []PaidMedia `json:"paid_media"`
}

// PaidMediaPurchased https://core.telegram.org/bots/api#paidmediapurchased
type PaidMediaPurchased struct {
From User `json:"from"`
PaidMediaPayload string `json:"paid_media_payload"`
}
9 changes: 5 additions & 4 deletions models/star.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ type TransactionPartnerFragment struct {

// TransactionPartnerUser https://core.telegram.org/bots/api#transactionpartneruser
type TransactionPartnerUser struct {
Type TransactionPartnerType `json:"type"`
User User `json:"user"`
InvoicePayload string `json:"invoice_payload,omitempty"`
PaidMedia []*PaidMedia `json:"paid_media,omitempty"`
Type TransactionPartnerType `json:"type"`
User User `json:"user"`
InvoicePayload string `json:"invoice_payload,omitempty"`
PaidMedia []*PaidMedia `json:"paid_media,omitempty"`
PaidMediaPayload string `json:"paid_media_payload,omitempty"`
}

// TransactionPartnerOther https://core.telegram.org/bots/api#transactionpartnerother
Expand Down
1 change: 1 addition & 0 deletions models/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type Update struct {
CallbackQuery *CallbackQuery `json:"callback_query,omitempty"`
ShippingQuery *ShippingQuery `json:"shipping_query,omitempty"`
PreCheckoutQuery *PreCheckoutQuery `json:"pre_checkout_query,omitempty"`
PurchasedPaidMedia *PaidMediaPurchased `json:"purchased_paid_media,omitempty"`
Poll *Poll `json:"poll,omitempty"`
PollAnswer *PollAnswer `json:"poll_answer,omitempty"`
MyChatMember *ChatMemberUpdated `json:"my_chat_member,omitempty"`
Expand Down

0 comments on commit 581c533

Please sign in to comment.