Skip to content

Commit

Permalink
7.4 (#86)
Browse files Browse the repository at this point in the history
* add omitempty for `provider_token` fields

* add RefundStarPayment method

* add effect_id to message

* add message_effect_id

* add show_caption_above_media

* add show_caption_above_media

* add types for chatAction consts

* changelog, readme
  • Loading branch information
negasus authored May 29, 2024
1 parent 0f68ee1 commit 79a3783
Show file tree
Hide file tree
Showing 8 changed files with 259 additions and 208 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.3.2 (2024-05-29)

- support API v7.4

## v1.3.1 (2024-05-22)

- add Marshal functions for struct with many types
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.3](https://core.telegram.org/bots/api#may-6-2024) from May 6, 2024
> Supports Bot API version: [7.4](https://core.telegram.org/bots/api#may-28-2024) from May 28, 2024
It's a Go zero-dependencies telegram bot framework

Expand Down
7 changes: 7 additions & 0 deletions methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,13 @@ func (b *Bot) AnswerPreCheckoutQuery(ctx context.Context, params *AnswerPreCheck
return result, err
}

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

// SetPassportDataErrors https://core.telegram.org/bots/api#setpassportdataerrors
func (b *Bot) SetPassportDataErrors(ctx context.Context, params *SetPassportDataErrorsParams) (bool, error) {
var result bool
Expand Down
143 changes: 85 additions & 58 deletions methods_params.go

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions models/chat_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ type ChatAction string

const (
ChatActionTyping ChatAction = "typing"
ChatActionUploadPhoto = "upload_photo"
ChatActionRecordVideo = "record_video"
ChatActionUploadVideo = "upload_video"
ChatActionRecordVoice = "record_voice"
ChatActionUploadVoice = "upload_voice"
ChatActionUploadDocument = "upload_document"
ChatActionChooseSticker = "choose_sticker"
ChatActionFindLocation = "find_location"
ChatActionRecordVideoNote = "record_video_note"
ChatActionUploadVideoNote = "upload_video_note"
ChatActionUploadPhoto ChatAction = "upload_photo"
ChatActionRecordVideo ChatAction = "record_video"
ChatActionUploadVideo ChatAction = "upload_video"
ChatActionRecordVoice ChatAction = "record_voice"
ChatActionUploadVoice ChatAction = "upload_voice"
ChatActionUploadDocument ChatAction = "upload_document"
ChatActionChooseSticker ChatAction = "choose_sticker"
ChatActionFindLocation ChatAction = "find_location"
ChatActionRecordVideoNote ChatAction = "record_video_note"
ChatActionUploadVideoNote ChatAction = "upload_video_note"
)
238 changes: 123 additions & 115 deletions models/inline_query.go

Large diffs are not rendered by default.

51 changes: 27 additions & 24 deletions models/input_media.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ type InputMedia interface {

// InputMediaPhoto https://core.telegram.org/bots/api#inputmediaphoto
type InputMediaPhoto struct {
Media string `json:"media"`
Caption string `json:"caption,omitempty"`
ParseMode ParseMode `json:"parse_mode,omitempty"`
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
HasSpoiler bool `json:"has_spoiler,omitempty"`
Media string `json:"media"`
Caption string `json:"caption,omitempty"`
ParseMode ParseMode `json:"parse_mode,omitempty"`
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
HasSpoiler bool `json:"has_spoiler,omitempty"`

MediaAttachment io.Reader `json:"-"`
}
Expand Down Expand Up @@ -49,16 +50,17 @@ func (InputMediaPhoto) inputMediaTag() {}

// InputMediaVideo https://core.telegram.org/bots/api#inputmediavideo
type InputMediaVideo struct {
Media string `json:"media"`
Thumbnail InputFile `json:"thumbnail,omitempty"`
Caption string `json:"caption,omitempty"`
ParseMode ParseMode `json:"parse_mode,omitempty"`
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
Duration int `json:"duration,omitempty"`
SupportsStreaming bool `json:"supports_streaming,omitempty"`
HasSpoiler bool `json:"has_spoiler,omitempty"`
Media string `json:"media"`
Thumbnail InputFile `json:"thumbnail,omitempty"`
Caption string `json:"caption,omitempty"`
ParseMode ParseMode `json:"parse_mode,omitempty"`
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
Duration int `json:"duration,omitempty"`
SupportsStreaming bool `json:"supports_streaming,omitempty"`
HasSpoiler bool `json:"has_spoiler,omitempty"`

MediaAttachment io.Reader `json:"-"`
}
Expand All @@ -85,15 +87,16 @@ func (InputMediaVideo) inputMediaTag() {}

// InputMediaAnimation https://core.telegram.org/bots/api#inputmediaanimation
type InputMediaAnimation struct {
Media string `json:"media"`
Thumbnail InputFile `json:"thumbnail,omitempty"`
Caption string `json:"caption,omitempty"`
ParseMode ParseMode `json:"parse_mode,omitempty"`
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
Duration int `json:"duration,omitempty"`
HasSpoiler bool `json:"has_spoiler,omitempty"`
Media string `json:"media"`
Thumbnail InputFile `json:"thumbnail,omitempty"`
Caption string `json:"caption,omitempty"`
ParseMode ParseMode `json:"parse_mode,omitempty"`
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
Duration int `json:"duration,omitempty"`
HasSpoiler bool `json:"has_spoiler,omitempty"`

MediaAttachment io.Reader `json:"-"`
}
Expand Down
2 changes: 2 additions & 0 deletions models/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ type Message struct {
Text string `json:"text,omitempty"`
Entities []MessageEntity `json:"entities,omitempty"`
LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`
EffectID string `json:"effect_id,omitempty"`
Animation *Animation `json:"animation,omitempty"`
Audio *Audio `json:"audio,omitempty"`
Document *Document `json:"document,omitempty"`
Expand All @@ -106,6 +107,7 @@ type Message struct {
Voice *Voice `json:"voice,omitempty"`
Caption string `json:"caption,omitempty"`
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
HasMediaSpoiler bool `json:"has_media_spoiler,omitempty"`
Contact *Contact `json:"contact,omitempty"`
Dice *Dice `json:"dice,omitempty"`
Expand Down

0 comments on commit 79a3783

Please sign in to comment.