v0.5.0 #8
9
go.mod
9
go.mod
@@ -17,13 +17,14 @@ require (
|
||||
github.com/klauspost/compress v1.18.4 // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/muir/sqltoken v0.2.1 // indirect
|
||||
github.com/muir/list v1.2.1 // indirect
|
||||
github.com/muir/sqltoken v0.3.0 // indirect
|
||||
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
|
||||
github.com/xdg-go/scram v1.2.0 // indirect
|
||||
github.com/xdg-go/stringprep v1.0.4 // indirect
|
||||
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
|
||||
golang.org/x/crypto v0.47.0 // indirect
|
||||
golang.org/x/crypto v0.48.0 // indirect
|
||||
golang.org/x/sync v0.19.0 // indirect
|
||||
golang.org/x/sys v0.40.0 // indirect
|
||||
golang.org/x/text v0.33.0 // indirect
|
||||
golang.org/x/sys v0.41.0 // indirect
|
||||
golang.org/x/text v0.34.0 // indirect
|
||||
)
|
||||
|
||||
10
go.sum
10
go.sum
@@ -30,8 +30,12 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
|
||||
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||
github.com/muir/list v1.2.1 h1:lmF8fz2B1WbXkzHr/Eh0oWPJArDBzWqIifOwbA4gWSo=
|
||||
github.com/muir/list v1.2.1/go.mod h1:v0l2f997MxCohQlD7PTejJqyYKwFVz/i3mTpDl4LAf0=
|
||||
github.com/muir/sqltoken v0.2.1 h1:19KvJrCj9aOMfU921hjnizWPlQmPTe+tb36zupOY2FA=
|
||||
github.com/muir/sqltoken v0.2.1/go.mod h1:sSlj5M0VqQ4OuedmxwWs1TmzzRXaH3DLf5ukzg6meIo=
|
||||
github.com/muir/sqltoken v0.3.0 h1:3xbcqr80f3IA4OlwkOpdIHC4DTu6gsi1TwMqgYL4Dpg=
|
||||
github.com/muir/sqltoken v0.3.0/go.mod h1:+OSmbGI22QcVZ6DCzlHT8EAzEq/mqtqedtPP91Le+3A=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/redis/go-redis/v9 v9.17.3 h1:fN29NdNrE17KttK5Ndf20buqfDZwGNgoUr9qjl1DQx4=
|
||||
@@ -55,6 +59,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.47.0 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8=
|
||||
golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A=
|
||||
golang.org/x/crypto v0.48.0 h1:/VRzVqiRSggnhY7gNRxPauEQ5Drw9haKdM0jqfcCFts=
|
||||
golang.org/x/crypto v0.48.0/go.mod h1:r0kV5h3qnFPlQnBSrULhlsRfryS2pmewsg+XfMgkVos=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
@@ -71,6 +77,8 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
|
||||
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k=
|
||||
golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
@@ -79,6 +87,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
||||
golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE=
|
||||
golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8=
|
||||
golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk=
|
||||
golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
|
||||
@@ -6,10 +6,10 @@ type SendPhotoP struct {
|
||||
MessageThreadID int `json:"message_thread_id,omitempty"`
|
||||
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
||||
|
||||
Photo string `json:"photo"`
|
||||
Caption string `json:"caption,omitempty"`
|
||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||
CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`
|
||||
Photo string `json:"photo"`
|
||||
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"`
|
||||
@@ -34,13 +34,13 @@ type SendAudioP struct {
|
||||
MessageThreadID int `json:"message_thread_id,omitempty"`
|
||||
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
||||
|
||||
Audio string `json:"audio"`
|
||||
Caption string `json:"caption,omitempty"`
|
||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||
CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`
|
||||
Duration int `json:"duration,omitempty"`
|
||||
Performer string `json:"performer,omitempty"`
|
||||
Title string `json:"title,omitempty"`
|
||||
Audio string `json:"audio"`
|
||||
Caption string `json:"caption,omitempty"`
|
||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
|
||||
Duration int `json:"duration,omitempty"`
|
||||
Performer string `json:"performer,omitempty"`
|
||||
Title string `json:"title,omitempty"`
|
||||
|
||||
DisableNotification bool `json:"disable_notification,omitempty"`
|
||||
ProtectContent bool `json:"protect_content,omitempty"`
|
||||
@@ -63,10 +63,10 @@ type SendDocumentP struct {
|
||||
MessageThreadID int `json:"message_thread_id,omitempty"`
|
||||
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
||||
|
||||
Document string `json:"document"`
|
||||
Caption string `json:"caption,omitempty"`
|
||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||
CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`
|
||||
Document string `json:"document"`
|
||||
Caption string `json:"caption,omitempty"`
|
||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
|
||||
|
||||
DisableNotification bool `json:"disable_notification,omitempty"`
|
||||
ProtectContent bool `json:"protect_content,omitempty"`
|
||||
@@ -93,12 +93,12 @@ type SendVideoP struct {
|
||||
Duration int `json:"duration,omitempty"`
|
||||
Width int `json:"width,omitempty"`
|
||||
Height int `json:"height,omitempty"`
|
||||
Cover string `json:"cover,omitempty"`
|
||||
Cover int `json:"cover,omitempty"`
|
||||
|
||||
StartTimestamp int `json:"start_timestamp,omitempty"`
|
||||
Caption string `json:"caption,omitempty"`
|
||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||
CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`
|
||||
StartTimestamp int `json:"start_timestamp,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"`
|
||||
HasSpoiler bool `json:"has_spoiler,omitempty"`
|
||||
@@ -129,15 +129,15 @@ type SendAnimationP struct {
|
||||
Width int `json:"width,omitempty"`
|
||||
Height int `json:"height,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"`
|
||||
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"`
|
||||
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"`
|
||||
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"`
|
||||
|
||||
SuggestedPostParameters *SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
|
||||
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
|
||||
@@ -155,15 +155,15 @@ type SendVoiceP struct {
|
||||
MessageThreadID int `json:"message_thread_id,omitempty"`
|
||||
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
||||
|
||||
Voice string `json:"voice"`
|
||||
Caption string `json:"caption,omitempty"`
|
||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||
CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`
|
||||
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"`
|
||||
Voice string `json:"voice"`
|
||||
Caption string `json:"caption,omitempty"`
|
||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
|
||||
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"`
|
||||
|
||||
SuggestedPostParameters *SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
|
||||
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
|
||||
@@ -199,18 +199,18 @@ func (api *Api) SendVideoNote(params SendVideoNoteP) (Message, error) {
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
type SendPaidMediaP[T InputPaidMedia] struct {
|
||||
type SendPaidMediaP struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
ChatID int `json:"chat_id"`
|
||||
MessageThreadID int `json:"message_thread_id,omitempty"`
|
||||
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
||||
StarCount int `json:"star_count,omitempty"`
|
||||
|
||||
Media []T `json:"media"`
|
||||
Media []InputPaidMedia `json:"media"`
|
||||
Payload string `json:"payload,omitempty"`
|
||||
Caption string `json:"caption,omitempty"`
|
||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||
CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`
|
||||
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
|
||||
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
|
||||
DisableNotification bool `json:"disable_notification,omitempty"`
|
||||
ProtectContent bool `json:"protect_content,omitempty"`
|
||||
@@ -221,22 +221,18 @@ type SendPaidMediaP[T InputPaidMedia] struct {
|
||||
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
|
||||
}
|
||||
|
||||
func (api *Api) SendPaidMediaPhoto(params SendPaidMediaP[InputPaidMediaPhoto]) (Message, error) {
|
||||
req := NewRequest[Message]("sendPaidMedia", params)
|
||||
return req.Do(api)
|
||||
}
|
||||
func (api *Api) SendPaidMediaVideo(params SendPaidMediaP[InputPaidMediaVideo]) (Message, error) {
|
||||
func (api *Api) SendPaidMedia(params SendPaidMediaP) (Message, error) {
|
||||
req := NewRequest[Message]("sendPaidMedia", params)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
type SendMediaGroupP[T InputMedia] struct {
|
||||
type SendMediaGroupP struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
ChatID int `json:"chat_id"`
|
||||
MessageThreadID int `json:"message_thread_id,omitempty"`
|
||||
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
||||
|
||||
Media []T `json:"media"`
|
||||
Media []InputMedia `json:"media"`
|
||||
DisableNotification bool `json:"disable_notification,omitempty"`
|
||||
ProtectContent bool `json:"protect_content,omitempty"`
|
||||
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
|
||||
@@ -244,19 +240,7 @@ type SendMediaGroupP[T InputMedia] struct {
|
||||
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
|
||||
}
|
||||
|
||||
func (api *Api) SendMediaGroupAudio(p SendMediaGroupP[InputMediaAudio]) (Message, error) {
|
||||
req := NewRequest[Message]("sendMediaGroupAudio", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
func (api *Api) SendMediaGroupDocument(p SendMediaGroupP[InputMediaDocument]) (Message, error) {
|
||||
req := NewRequest[Message]("sendMediaGroupDocument", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
func (api *Api) SendMediaGroupPhoto(p SendMediaGroupP[InputMediaPhoto]) (Message, error) {
|
||||
req := NewRequest[Message]("sendMediaGroupPhoto", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
func (api *Api) SendMediaGroupVideo(p SendMediaGroupP[InputMediaVideo]) (Message, error) {
|
||||
req := NewRequest[Message]("sendMediaGroupVideo", p)
|
||||
func (api *Api) SendMediaGroup(p SendMediaGroupP) (Message, error) {
|
||||
req := NewRequest[Message]("sendMediaGroup", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,24 @@
|
||||
package tgapi
|
||||
|
||||
type InputMedia interface {
|
||||
InputMediaPhoto | InputMediaVideo | InputMediaAudio | InputMediaDocument
|
||||
type InputMedia struct {
|
||||
Type InputMediaType `json:"type"`
|
||||
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"`
|
||||
|
||||
Cover *string `json:"cover"`
|
||||
StartTimestamp *int `json:"start_timestamp"`
|
||||
Width *int `json:"width,omitempty"`
|
||||
Height *int `json:"height,omitempty"`
|
||||
Duration *int `json:"duration,omitempty"`
|
||||
SupportsStreaming *bool `json:"supports_streaming,omitempty"`
|
||||
|
||||
Performer *string `json:"performer,omitempty"`
|
||||
Title *string `json:"title,omitempty"`
|
||||
}
|
||||
|
||||
type InputMediaType string
|
||||
@@ -14,66 +31,6 @@ const (
|
||||
InputMediaTypeAudio InputMediaType = "audio"
|
||||
)
|
||||
|
||||
type InputMediaPhoto struct {
|
||||
Type InputMediaType `json:"type"`
|
||||
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"`
|
||||
}
|
||||
type InputMediaVideo struct {
|
||||
Type InputMediaType `json:"type"`
|
||||
Media string `json:"media"`
|
||||
|
||||
Cover string `json:"cover"`
|
||||
StartTimestamp int `json:"start_timestamp"`
|
||||
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"`
|
||||
}
|
||||
type InputMediaAnimation struct {
|
||||
Type InputMediaType `json:"type"`
|
||||
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"`
|
||||
Width int `json:"width,omitempty"`
|
||||
Height int `json:"height,omitempty"`
|
||||
Duration int `json:"duration,omitempty"`
|
||||
HasSpoiler bool `json:"has_spoiler,omitempty"`
|
||||
}
|
||||
type InputMediaAudio struct {
|
||||
Type InputMediaType `json:"type"`
|
||||
Media string `json:"media"`
|
||||
|
||||
Caption string `json:"caption,omitempty"`
|
||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
|
||||
Duration int `json:"duration,omitempty"`
|
||||
Performer string `json:"performer,omitempty"`
|
||||
Title string `json:"title,omitempty"`
|
||||
}
|
||||
type InputMediaDocument struct {
|
||||
Type InputMediaType `json:"type"`
|
||||
Media string `json:"media"`
|
||||
|
||||
Caption string `json:"caption,omitempty"`
|
||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
|
||||
}
|
||||
|
||||
type InputPaidMediaType string
|
||||
|
||||
const (
|
||||
@@ -81,14 +38,7 @@ const (
|
||||
InputPaidMediaTypePhoto InputPaidMediaType = "photo"
|
||||
)
|
||||
|
||||
type InputPaidMedia interface {
|
||||
InputPaidMediaVideo | InputPaidMediaPhoto
|
||||
}
|
||||
type InputPaidMediaPhoto struct {
|
||||
Type InputPaidMediaType `json:"type"`
|
||||
Media string `json:"media"`
|
||||
}
|
||||
type InputPaidMediaVideo struct {
|
||||
type InputPaidMedia struct {
|
||||
Type InputPaidMediaType `json:"type"`
|
||||
Media string `json:"media"`
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package tgapi
|
||||
|
||||
type SetMyCommandsP struct {
|
||||
Commands []BotCommand `json:"commands"`
|
||||
Scope *BaseBotCommandScope `json:"scope,omitempty"`
|
||||
Language string `json:"language_code,omitempty"`
|
||||
Commands []BotCommand `json:"commands"`
|
||||
Scope *BotCommandScope `json:"scope,omitempty"`
|
||||
Language string `json:"language_code,omitempty"`
|
||||
}
|
||||
|
||||
func (api *Api) SetMyCommands(p SetMyCommandsP) (bool, error) {
|
||||
@@ -12,8 +12,8 @@ func (api *Api) SetMyCommands(p SetMyCommandsP) (bool, error) {
|
||||
}
|
||||
|
||||
type DeleteMyCommandsP struct {
|
||||
Scope *BaseBotCommandScope `json:"scope,omitempty"`
|
||||
Language string `json:"language_code,omitempty"`
|
||||
Scope *BotCommandScope `json:"scope,omitempty"`
|
||||
Language string `json:"language_code,omitempty"`
|
||||
}
|
||||
|
||||
func (api *Api) DeleteMyCommands(p DeleteMyCommandsP) (bool, error) {
|
||||
@@ -22,8 +22,8 @@ func (api *Api) DeleteMyCommands(p DeleteMyCommandsP) (bool, error) {
|
||||
}
|
||||
|
||||
type GetMyCommands struct {
|
||||
Scope *BaseBotCommandScope `json:"scope,omitempty"`
|
||||
Language string `json:"language_code,omitempty"`
|
||||
Scope *BotCommandScope `json:"scope,omitempty"`
|
||||
Language string `json:"language_code,omitempty"`
|
||||
}
|
||||
|
||||
func (api *Api) GetMyCommands(p GetMyCommands) ([]BotCommand, error) {
|
||||
@@ -88,15 +88,11 @@ func (api *Api) GetMyShortDescription(p GetMyShortDescription) (BotShortDescript
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
type SetMyProfilePhotoP[T InputProfilePhoto] struct {
|
||||
Photo T `json:"photo"`
|
||||
type SetMyProfilePhotoP struct {
|
||||
Photo InputProfilePhoto `json:"photo"`
|
||||
}
|
||||
|
||||
func (api *Api) SetMyProfilePhotoStatic(p SetMyProfilePhotoP[InputProfilePhotoStatic]) (bool, error) {
|
||||
req := NewRequest[bool]("setMyProfilePhoto", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
func (api *Api) SetMyProfilePhotoAnimated(p SetMyProfilePhotoP[InputProfilePhotoAnimated]) (bool, error) {
|
||||
func (api *Api) SetMyProfilePhoto(p SetMyProfilePhotoP) (bool, error) {
|
||||
req := NewRequest[bool]("setMyProfilePhoto", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
@@ -105,20 +101,12 @@ func (api *Api) RemoveMyProfilePhoto() (bool, error) {
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
type SetChatMenuButtonP[T MenuButton] struct {
|
||||
ChatID int `json:"chat_id"`
|
||||
MenuButton T `json:"menu_button"`
|
||||
type SetChatMenuButtonP struct {
|
||||
ChatID int `json:"chat_id"`
|
||||
MenuButton MenuButtonType `json:"menu_button"`
|
||||
}
|
||||
|
||||
func (api *Api) SetChatMenuButtonCommands(p SetChatMenuButtonP[MenuButtonCommands]) (bool, error) {
|
||||
req := NewRequest[bool]("setChatMenuButton", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
func (api *Api) SetChatMenuButtonWebApp(p SetChatMenuButtonP[MenuButtonWebApp]) (bool, error) {
|
||||
req := NewRequest[bool]("setChatMenuButton", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
func (api *Api) SetChatMenuButtonDefault(p SetChatMenuButtonP[MenuButtonDefault]) (bool, error) {
|
||||
func (api *Api) SetChatMenuButton(p SetChatMenuButtonP) (bool, error) {
|
||||
req := NewRequest[bool]("setChatMenuButton", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
@@ -16,33 +16,10 @@ const (
|
||||
BotCommandScopeChatMemberType BotCommandScopeType = "chat_member"
|
||||
)
|
||||
|
||||
type BaseBotCommandScope struct {
|
||||
Type BotCommandScopeType `json:"type"`
|
||||
}
|
||||
type BotCommandScopeDefault struct {
|
||||
BaseBotCommandScope
|
||||
}
|
||||
type BotCommandScopePrivateChats struct {
|
||||
BaseBotCommandScope
|
||||
}
|
||||
type BotCommandScopeAllGroupChats struct {
|
||||
BaseBotCommandScope
|
||||
}
|
||||
type BotCommandScopeAllChatAdministrators struct {
|
||||
BaseBotCommandScope
|
||||
}
|
||||
type BotCommandScopeChat struct {
|
||||
BaseBotCommandScope
|
||||
ChatID int `json:"chat_id"`
|
||||
}
|
||||
type BotCommandScopeChatAdministrators struct {
|
||||
BaseBotCommandScope
|
||||
ChatID int `json:"chat_id"`
|
||||
}
|
||||
type BotCommandScopeChatMember struct {
|
||||
BaseBotCommandScope
|
||||
ChatID int `json:"chat_id"`
|
||||
UserID int `json:"user_id"`
|
||||
type BotCommandScope struct {
|
||||
Type BotCommandScopeType `json:"type"`
|
||||
ChatID *int `json:"chat_id,omitempty"`
|
||||
UserID *int `json:"user_id,omitempty"`
|
||||
}
|
||||
|
||||
type BotName struct {
|
||||
@@ -61,20 +38,15 @@ const (
|
||||
)
|
||||
|
||||
type InputProfilePhotoType string
|
||||
type InputProfilePhoto interface {
|
||||
InputProfilePhotoStatic | InputProfilePhotoAnimated
|
||||
}
|
||||
type BaseInputProfilePhoto struct {
|
||||
type InputProfilePhoto struct {
|
||||
Type InputProfilePhotoType `json:"type"`
|
||||
}
|
||||
type InputProfilePhotoStatic struct {
|
||||
BaseInputProfilePhoto
|
||||
Photo string `json:"photo"`
|
||||
}
|
||||
type InputProfilePhotoAnimated struct {
|
||||
BaseInputProfilePhoto
|
||||
Animation string `json:"animation"`
|
||||
MainFrameTimestamp float64 `json:"main_frame_timestamp"`
|
||||
|
||||
// Static
|
||||
Photo *string `json:"photo,omitempty"`
|
||||
|
||||
// Animated
|
||||
Animation *string `json:"animation,omitempty"`
|
||||
MainFrameTimestamp *float64 `json:"main_frame_timestamp,omitempty"`
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -84,16 +56,9 @@ const (
|
||||
)
|
||||
|
||||
type MenuButtonType string
|
||||
type MenuButton interface {
|
||||
MenuButtonCommands | MenuButtonDefault | MenuButtonWebApp
|
||||
}
|
||||
type BaseMenuButton struct {
|
||||
Type MenuButtonType `json:"type"`
|
||||
}
|
||||
type MenuButtonCommands struct{ BaseMenuButton }
|
||||
type MenuButtonDefault struct{ BaseMenuButton }
|
||||
type MenuButtonWebApp struct {
|
||||
BaseMenuButton
|
||||
// WebApp
|
||||
Text string `json:"text"`
|
||||
WebApp WebAppInfo `json:"web_app"`
|
||||
}
|
||||
|
||||
@@ -90,17 +90,13 @@ func (api *Api) SetBusinessAccountBio(p SetBusinessAccountBioP) (bool, error) {
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
type SetBusinessAccountProfilePhoto[T InputProfilePhoto] struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
Photo T `json:"photo,omitempty"`
|
||||
IsPublic bool `json:"is_public,omitempty"`
|
||||
type SetBusinessAccountProfilePhoto struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
Photo InputProfilePhoto `json:"photo,omitempty"`
|
||||
IsPublic bool `json:"is_public,omitempty"`
|
||||
}
|
||||
|
||||
func (api *Api) SetBusinessAccountProfilePhotoStatic(p SetMyProfilePhotoP[InputProfilePhotoStatic]) (bool, error) {
|
||||
req := NewRequest[bool]("setBusinessAccountProfilePhoto", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
func (api *Api) SetBusinessAccountProfilePhotoAnimated(p SetMyProfilePhotoP[InputProfilePhotoAnimated]) (bool, error) {
|
||||
func (api *Api) SetBusinessAccountProfilePhoto(p SetBusinessAccountProfilePhoto) (bool, error) {
|
||||
req := NewRequest[bool]("setBusinessAccountProfilePhoto", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
@@ -163,3 +159,100 @@ func (api *Api) GetBusinessAccountGifts(p GetBusinessAccountGiftsP) (OwnedGifts,
|
||||
req := NewRequest[OwnedGifts]("getBusinessAccountGifts", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
type ConvertGiftToStarsP struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
OwnedGiftID string `json:"owned_gift_id"`
|
||||
}
|
||||
|
||||
func (api *Api) ConvertGiftToStars(p ConvertGiftToStarsP) (bool, error) {
|
||||
req := NewRequest[bool]("convertGiftToStars", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
type UpgradeGiftP struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
OwnedGiftID string `json:"owned_gift_id"`
|
||||
KeepOriginalDetails bool `json:"keep_original_details,omitempty"`
|
||||
StarCount int `json:"star_count,omitempty"`
|
||||
}
|
||||
|
||||
func (api *Api) UpgradeGift(p UpgradeGiftP) (bool, error) {
|
||||
req := NewRequest[bool]("upgradeGift", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
type TransferGiftP struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
OwnedGiftID string `json:"owned_gift_id"`
|
||||
NewOwnerChatID int `json:"new_owner_chat_id"`
|
||||
StarCount int `json:"star_count,omitempty"`
|
||||
}
|
||||
|
||||
func (api *Api) TransferGift(p TransferGiftP) (bool, error) {
|
||||
req := NewRequest[bool]("transferGift", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
type PostStoryP struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
Content InputStoryContent `json:"content"`
|
||||
ActivePeriod int `json:"active_period"`
|
||||
|
||||
Caption string `json:"caption,omitempty"`
|
||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
|
||||
Areas []StoryArea `json:"areas"`
|
||||
|
||||
PostToChatPage bool `json:"post_to_chat_page,omitempty"`
|
||||
ProtectContent bool `json:"protect_content,omitempty"`
|
||||
}
|
||||
|
||||
func (api *Api) PostStoryPhoto(p PostStoryP) (Story, error) {
|
||||
req := NewRequest[Story]("postStory", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
func (api *Api) PostStoryVideo(p PostStoryP) (Story, error) {
|
||||
req := NewRequest[Story]("postStory", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
type RepostStoryP struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
FromChatID int `json:"from_chat_id"`
|
||||
FromStoryID int `json:"from_story_id"`
|
||||
ActivePeriod int `json:"active_period"`
|
||||
PostToChatPage bool `json:"post_to_chat_page,omitempty"`
|
||||
ProtectContent bool `json:"protect_content,omitempty"`
|
||||
}
|
||||
|
||||
func (api *Api) RepostStory(p RepostStoryP) (Story, error) {
|
||||
req := NewRequest[Story]("repostStory", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
type EditStoryP struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
StoryID int `json:"story_id"`
|
||||
Content InputStoryContent `json:"content"`
|
||||
|
||||
Caption string `json:"caption,omitempty"`
|
||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
|
||||
Areas []StoryArea `json:"areas,omitempty"`
|
||||
}
|
||||
|
||||
func (api *Api) EditStory(p EditStoryP) (Story, error) {
|
||||
req := NewRequest[Story]("editStory", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
type DeleteStoryP struct {
|
||||
BusinessConnectionID string `json:"business_connection_id"`
|
||||
StoryID int `json:"story_id"`
|
||||
}
|
||||
|
||||
func (api *Api) DeleteStory(p DeleteStoryP) (bool, error) {
|
||||
req := NewRequest[bool]("deleteStory", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
@@ -42,3 +42,63 @@ type BusinessConnection struct {
|
||||
Rights *BusinessBotRights `json:"rights,omitempty"`
|
||||
IsEnabled bool `json:"id_enabled"`
|
||||
}
|
||||
|
||||
const (
|
||||
InputStoryContentPhotoType InputStoryContentType = "photo"
|
||||
InputStoryContentVideoType InputStoryContentType = "video"
|
||||
)
|
||||
|
||||
type InputStoryContentType string
|
||||
type InputStoryContent struct {
|
||||
Type InputStoryContentType `json:"type"`
|
||||
// Photo
|
||||
Photo *string `json:"photo,omitempty"`
|
||||
|
||||
// Video
|
||||
Video *string `json:"video,omitempty"`
|
||||
Duration *float64 `json:"duration,omitempty"`
|
||||
CoverFrameTimestamp *float64 `json:"cover_frame_timestamp,omitempty"`
|
||||
IsAnimation *bool `json:"is_animation,omitempty"`
|
||||
}
|
||||
|
||||
type StoryAreaPosition struct {
|
||||
XPercentage float64 `json:"x_percentage"`
|
||||
YPercentage float64 `json:"y_percentage"`
|
||||
WidthPercentage float64 `json:"width_percentage"`
|
||||
HeightPercentage float64 `json:"height_percentage"`
|
||||
RotationAngle float64 `json:"rotation_angle"`
|
||||
CornerRadiusPercentage float64 `json:"corner_radius_percentage"`
|
||||
}
|
||||
|
||||
const (
|
||||
StoryAreaTypeLocationType StoryAreaTypeType = "location"
|
||||
StoryAreaTypeReactionType StoryAreaTypeType = "suggested_reaction"
|
||||
StoryAreaTypeLinkType StoryAreaTypeType = "link"
|
||||
StoryAreaTypeWeatherType StoryAreaTypeType = "weather"
|
||||
StoryAreaTypeUniqueGiftType StoryAreaTypeType = "unique_gift"
|
||||
)
|
||||
|
||||
type StoryAreaTypeType string
|
||||
type StoryAreaType struct {
|
||||
Type StoryAreaTypeType `json:"type"`
|
||||
|
||||
Latitude *float64 `json:"latitude,omitempty"`
|
||||
Longitude *float64 `json:"longitude,omitempty"`
|
||||
Address *LocationAddress `json:"address,omitempty"`
|
||||
|
||||
ReactionType *ReactionType `json:"reaction_type,omitempty"`
|
||||
IsDark *bool `json:"is_dark,omitempty"`
|
||||
IsFlipped *bool `json:"is_flipped,omitempty"`
|
||||
|
||||
URL *string `json:"url,omitempty"`
|
||||
|
||||
Temperature *float64 `json:"temperature,omitempty"`
|
||||
Emoji *string `json:"emoji"`
|
||||
BackgroundColor *int `json:"background_color"`
|
||||
|
||||
Name *string `json:"name,omitempty"`
|
||||
}
|
||||
type StoryArea struct {
|
||||
Position StoryAreaPosition `json:"position"`
|
||||
Type StoryAreaType `json:"type"`
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package tgapi
|
||||
|
||||
type BanChatMemberP struct {
|
||||
ChatID int `json:"chat_id"`
|
||||
UserID int `json:"user_id"`
|
||||
UntilDate int64 `json:"until_date,omitempty"`
|
||||
RevokeMessages bool `json:"revoke_messages,omitempty"`
|
||||
ChatID int `json:"chat_id"`
|
||||
UserID int `json:"user_id"`
|
||||
UntilDate int `json:"until_date,omitempty"`
|
||||
RevokeMessages bool `json:"revoke_messages,omitempty"`
|
||||
}
|
||||
|
||||
func (api *Api) BanChatMember(p BanChatMemberP) (bool, error) {
|
||||
@@ -115,11 +115,11 @@ func (api *Api) ExportChatInviteLink(p ExportChatInviteLinkP) (string, error) {
|
||||
}
|
||||
|
||||
type CreateChatInviteLinkP struct {
|
||||
ChatID int `json:"chat_id"`
|
||||
Name string `json:"name,omitempty"`
|
||||
ExpireDate int `json:"expire_date,omitempty"`
|
||||
MemberLimit int `json:"member_limit,omitempty"`
|
||||
CreatesJoinRequest int `json:"creates_join_request,omitempty"`
|
||||
ChatID int `json:"chat_id"`
|
||||
Name *string `json:"name,omitempty"`
|
||||
ExpireDate int `json:"expire_date,omitempty"`
|
||||
MemberLimit int `json:"member_limit,omitempty"`
|
||||
CreatesJoinRequest int `json:"creates_join_request,omitempty"`
|
||||
}
|
||||
|
||||
func (api *Api) CreateChatInviteLink(p CreateChatInviteLinkP) (ChatInviteLink, error) {
|
||||
@@ -230,10 +230,10 @@ func (api *Api) SetChatDescription(p SetChatDescriptionP) (bool, error) {
|
||||
}
|
||||
|
||||
type PinChatMessageP struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
ChatID int `json:"chat_id"`
|
||||
MessageID int `json:"message_id"`
|
||||
DisableNotification bool `json:"disable_notification,omitempty"`
|
||||
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
|
||||
ChatID int `json:"chat_id"`
|
||||
MessageID int `json:"message_id"`
|
||||
DisableNotification bool `json:"disable_notification,omitempty"`
|
||||
}
|
||||
|
||||
func (api *Api) PinChatMessage(p PinChatMessageP) (bool, error) {
|
||||
@@ -242,9 +242,9 @@ func (api *Api) PinChatMessage(p PinChatMessageP) (bool, error) {
|
||||
}
|
||||
|
||||
type UnpinChatMessageP struct {
|
||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||
ChatID int `json:"chat_id"`
|
||||
MessageID int `json:"message_id"`
|
||||
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
|
||||
ChatID int `json:"chat_id"`
|
||||
MessageID int `json:"message_id"`
|
||||
}
|
||||
|
||||
func (api *Api) UnpinChatMessage(p UnpinChatMessageP) (bool, error) {
|
||||
@@ -283,8 +283,8 @@ type GetChatAdministratorsP struct {
|
||||
ChatID int `json:"chat_id"`
|
||||
}
|
||||
|
||||
func (api *Api) GetChatAdministrators(p GetChatAdministratorsP) ([]BaseChatMember, error) {
|
||||
req := NewRequest[[]BaseChatMember]("getChatAdministrators", p)
|
||||
func (api *Api) GetChatAdministrators(p GetChatAdministratorsP) ([]ChatMember, error) {
|
||||
req := NewRequest[[]ChatMember]("getChatAdministrators", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
@@ -302,8 +302,8 @@ type GetChatMemberP struct {
|
||||
UserID int `json:"user_id"`
|
||||
}
|
||||
|
||||
func (api *Api) GetChatMember(p GetChatMemberP) (BaseChatMember, error) {
|
||||
req := NewRequest[BaseChatMember]("getChatMember", p)
|
||||
func (api *Api) GetChatMember(p GetChatMemberP) (ChatMember, error) {
|
||||
req := NewRequest[ChatMember]("getChatMember", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
@@ -335,3 +335,22 @@ func (api *Api) GetUserChatBoosts(p GetUserChatBoostsP) (UserChatBoosts, error)
|
||||
req := NewRequest[UserChatBoosts]("getUserChatBoosts", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
type GetChatGiftsP struct {
|
||||
ChatID int `json:"chat_id"`
|
||||
ExcludeUnsaved bool `json:"exclude_unsaved,omitempty"`
|
||||
ExcludeSaved bool `json:"exclude_saved,omitempty"`
|
||||
ExcludeUnlimited bool `json:"exclude_unlimited,omitempty"`
|
||||
ExcludeLimitedUpgradable bool `json:"exclude_limited_upgradable,omitempty"`
|
||||
ExcludeLimitedNonUpgradable bool `json:"exclude_limited_non_upgradable,omitempty"`
|
||||
ExcludeUnique bool `json:"exclude_unique,omitempty"`
|
||||
ExcludeFromBlockchain bool `json:"exclude_from_blockchain,omitempty"`
|
||||
SortByPrice bool `json:"sort_by_price,omitempty"`
|
||||
Offset string `json:"offset,omitempty"`
|
||||
Limit int `json:"limit,omitempty"`
|
||||
}
|
||||
|
||||
func (api *Api) GetChatGifts(p GetChatGiftsP) (OwnedGifts, error) {
|
||||
req := NewRequest[OwnedGifts]("getChatGifts", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ type ChatFullInfo struct {
|
||||
PersonalChat *Chat `json:"personal_chat,omitempty"`
|
||||
ParentChat *Chat `json:"parent_chat,omitempty"`
|
||||
|
||||
AvailableReaction []BaseReaction `json:"available_reaction,omitempty"`
|
||||
AvailableReaction []ReactionType `json:"available_reaction,omitempty"`
|
||||
|
||||
BackgroundCustomEmojiID *string `json:"background_custom_emoji_id,omitempty"`
|
||||
ProfileAccentColorID *int `json:"profile_accent_color_id,omitempty"`
|
||||
@@ -134,69 +134,47 @@ const (
|
||||
ChatMemberStatusBanned ChatMemberStatusType = "kicked"
|
||||
)
|
||||
|
||||
type ChatMember interface {
|
||||
ChatMemberOwner | ChatMemberAdministrator | ChatMemberMember | ChatMemberRestricted | ChatMemberLeft | ChatMemberBanned
|
||||
}
|
||||
type BaseChatMember struct {
|
||||
type ChatMember struct {
|
||||
Status ChatMemberStatusType `json:"status"`
|
||||
User User `json:"user"`
|
||||
}
|
||||
type ChatMemberOwner struct {
|
||||
BaseChatMember
|
||||
|
||||
IsAnonymous bool `json:"is_anonymous"`
|
||||
// Owner
|
||||
IsAnonymous *bool `json:"is_anonymous"`
|
||||
CustomTitle *string `json:"custom_title,omitempty"`
|
||||
}
|
||||
type ChatMemberAdministrator struct {
|
||||
BaseChatMember
|
||||
CanBeEdited bool `json:"can_be_edited"`
|
||||
IsAnonymous bool `json:"is_anonymous"`
|
||||
CanManageChat bool `json:"can_manage_chat"`
|
||||
CanDeleteMessages bool `json:"can_delete_messages"`
|
||||
CanManageVideoChats bool `json:"can_manage_video_chats"`
|
||||
CanRestrictMembers bool `json:"can_restrict_members"`
|
||||
CanPromoteMembers bool `json:"can_promote_members"`
|
||||
CanChangeInfo bool `json:"can_change_info"`
|
||||
CanInviteUsers bool `json:"can_invite_users"`
|
||||
CanPostStories bool `json:"can_post_stories"`
|
||||
CanEditStories bool `json:"can_edit_stories"`
|
||||
CanDeleteStories bool `json:"can_delete_stories"`
|
||||
|
||||
CanPostMessages *bool `json:"can_post_messages,omitempty"`
|
||||
CanEditMessages *bool `json:"can_edit_messages,omitempty"`
|
||||
CanPinMessages *bool `json:"can_pin_messages,omitempty"`
|
||||
CanManageTopics *bool `json:"can_manage_topics,omitempty"`
|
||||
CanManageDirectMessages *bool `json:"can_manage_direct_messages,omitempty"`
|
||||
CustomTitle *string `json:"custom_title,omitempty"`
|
||||
}
|
||||
type ChatMemberMember struct {
|
||||
BaseChatMember
|
||||
// Administrator
|
||||
CanBeEdited *bool `json:"can_be_edited,omitempty"`
|
||||
CanManageChat *bool `json:"can_manage_chat,omitempty"`
|
||||
CanDeleteMessages *bool `json:"can_delete_messages,omitempty"`
|
||||
CanManageVideoChats *bool `json:"can_manage_video_chats,omitempty"`
|
||||
CanRestrictMembers *bool `json:"can_restrict_members,omitempty"`
|
||||
CanPromoteMembers *bool `json:"can_promote_members,omitempty"`
|
||||
CanChangeInfo *bool `json:"can_change_info,omitempty"`
|
||||
CanInviteUsers *bool `json:"can_invite_users,omitempty"`
|
||||
CanPostStories *bool `json:"can_post_stories,omitempty"`
|
||||
CanEditStories *bool `json:"can_edit_stories,omitempty"`
|
||||
CanDeleteStories *bool `json:"can_delete_stories,omitempty"`
|
||||
|
||||
CanPostMessages *bool `json:"can_post_messages,omitempty"`
|
||||
CanEditMessages *bool `json:"can_edit_messages,omitempty"`
|
||||
CanPinMessages *bool `json:"can_pin_messages,omitempty"`
|
||||
CanManageTopics *bool `json:"can_manage_topics,omitempty"`
|
||||
CanManageDirectMessages *bool `json:"can_manage_direct_messages,omitempty"`
|
||||
|
||||
// Member
|
||||
UntilDate *int `json:"until_date,omitempty"`
|
||||
}
|
||||
type ChatMemberRestricted struct {
|
||||
BaseChatMember
|
||||
IsMember bool `json:"is_member"`
|
||||
CanSendMessages bool `json:"can_send_messages"`
|
||||
CanSendAudios bool `json:"can_send_audios"`
|
||||
CanSendDocuments bool `json:"can_send_documents"`
|
||||
CanSendVideos bool `json:"can_send_videos"`
|
||||
CanSendVideoNotes bool `json:"can_send_video_notes"`
|
||||
CanSendVoiceNotes bool `json:"can_send_voice_notes"`
|
||||
CanSendPolls bool `json:"can_send_polls"`
|
||||
CanSendOtherMessages bool `json:"can_send_other_messages"`
|
||||
CanAddWebPagePreview bool `json:"can_add_web_page_preview"`
|
||||
CanChangeInfo bool `json:"can_change_info"`
|
||||
CanInviteUsers bool `json:"can_invite_users"`
|
||||
CanPinMessages bool `json:"can_pin_messages"`
|
||||
CanManageTopics bool `json:"can_manage_topics"`
|
||||
UntilDate int `json:"until_date"`
|
||||
}
|
||||
type ChatMemberLeft struct {
|
||||
BaseChatMember
|
||||
}
|
||||
type ChatMemberBanned struct {
|
||||
BaseChatMember
|
||||
UntilDate int `json:"until_date"`
|
||||
|
||||
// Restricted
|
||||
IsMember *bool `json:"is_member,omitempty"`
|
||||
CanSendMessages *bool `json:"can_send_messages,omitempty"`
|
||||
CanSendAudios *bool `json:"can_send_audios,omitempty"`
|
||||
CanSendDocuments *bool `json:"can_send_documents,omitempty"`
|
||||
CanSendVideos *bool `json:"can_send_videos,omitempty"`
|
||||
CanSendVideoNotes *bool `json:"can_send_video_notes,omitempty"`
|
||||
CanSendVoiceNotes *bool `json:"can_send_voice_notes,omitempty"`
|
||||
CanSendPolls *bool `json:"can_send_polls,omitempty"`
|
||||
CanSendOtherMessages *bool `json:"can_send_other_messages,omitempty"`
|
||||
CanAddWebPagePreview *bool `json:"can_add_web_page_preview,omitempty"`
|
||||
}
|
||||
|
||||
type BaseChatBoostSource struct {
|
||||
|
||||
@@ -8,7 +8,7 @@ type SendMessageP struct {
|
||||
|
||||
Text string `json:"text"`
|
||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||
Entities []*MessageEntity `json:"entities,omitempty"`
|
||||
Entities []MessageEntity `json:"entities,omitempty"`
|
||||
LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`
|
||||
DisableNotifications bool `json:"disable_notifications,omitempty"`
|
||||
ProtectContent bool `json:"protect_content,omitempty"`
|
||||
@@ -72,12 +72,12 @@ type CopyMessageP struct {
|
||||
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"`
|
||||
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"`
|
||||
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
|
||||
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"`
|
||||
MessageEffectID string `json:"message_effect_id,omitempty"`
|
||||
|
||||
SuggestedPostParameters *SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
|
||||
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
|
||||
@@ -197,7 +197,7 @@ type SendPollP struct {
|
||||
|
||||
Question string `json:"question"`
|
||||
QuestionParseMode ParseMode `json:"question_mode,omitempty"`
|
||||
QuestionEntities []*MessageEntity `json:"question_entities,omitempty"`
|
||||
QuestionEntities []MessageEntity `json:"question_entities,omitempty"`
|
||||
Options []InputPollOption `json:"options"`
|
||||
IsAnonymous bool `json:"is_anonymous,omitempty"`
|
||||
Type PollType `json:"type"`
|
||||
@@ -205,7 +205,7 @@ type SendPollP struct {
|
||||
CorrectOptionID int `json:"correct_option_id,omitempty"`
|
||||
Explanation string `json:"explanation,omitempty"`
|
||||
ExplanationParseMode ParseMode `json:"explanation_parse_mode,omitempty"`
|
||||
ExplanationEntities []*MessageEntity `json:"explanation_entities,omitempty"`
|
||||
ExplanationEntities []MessageEntity `json:"explanation_entities,omitempty"`
|
||||
OpenPeriod int `json:"open_period,omitempty"`
|
||||
CloseDate int `json:"close_date"`
|
||||
IsClosed bool `json:"is_closed,omitempty"`
|
||||
@@ -266,12 +266,12 @@ func (api *Api) SendDice(params SendDiceP) (Message, error) {
|
||||
}
|
||||
|
||||
type SendMessageDraftP struct {
|
||||
ChatID int `json:"chat_id"`
|
||||
MessageThreadID int `json:"message_thread_id,omitempty"`
|
||||
DraftID int `json:"draft_id"`
|
||||
Text string `json:"text"`
|
||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||
Entities []*MessageEntity `json:"entities,omitempty"`
|
||||
ChatID int `json:"chat_id"`
|
||||
MessageThreadID int `json:"message_thread_id,omitempty"`
|
||||
DraftID int `json:"draft_id"`
|
||||
Text string `json:"text"`
|
||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||
Entities []MessageEntity `json:"entities,omitempty"`
|
||||
}
|
||||
|
||||
func (api *Api) SendMessageDraft(params SendMessageDraftP) (bool, error) {
|
||||
@@ -291,22 +291,14 @@ func (api *Api) SendChatAction(params SendChatActionP) (bool, error) {
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
type SetMessageReactionP[T ReactionType] struct {
|
||||
ChatId int `json:"chat_id"`
|
||||
MessageId int `json:"message_id"`
|
||||
Reaction []T `json:"reaction"`
|
||||
IsBig bool `json:"is_big,omitempty"`
|
||||
type SetMessageReactionP struct {
|
||||
ChatId int `json:"chat_id"`
|
||||
MessageId int `json:"message_id"`
|
||||
Reaction []ReactionType `json:"reaction"`
|
||||
IsBig bool `json:"is_big,omitempty"`
|
||||
}
|
||||
|
||||
func (api *Api) SetMessageReactionEmoji(params SetMessageReactionP[ReactionTypeEmoji]) (bool, error) {
|
||||
req := NewRequest[bool]("setMessageReaction", params)
|
||||
return req.Do(api)
|
||||
}
|
||||
func (api *Api) SetMessageReactionCustom(params SetMessageReactionP[ReactionTypeCustomEmoji]) (bool, error) {
|
||||
req := NewRequest[bool]("setMessageReaction", params)
|
||||
return req.Do(api)
|
||||
}
|
||||
func (api *Api) SetMessageReactionPaid(params SetMessageReactionP[ReactionTypePaid]) (bool, error) {
|
||||
func (api *Api) SetMessageReaction(params SetMessageReactionP) (bool, error) {
|
||||
req := NewRequest[bool]("setMessageReaction", params)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
@@ -190,8 +190,8 @@ type MessageReactionUpdated struct {
|
||||
User *User `json:"user,omitempty"`
|
||||
ActorChat *Chat `json:"actor_chat"`
|
||||
Date int `json:"date"`
|
||||
OldReaction []BaseReaction `json:"old_reaction"`
|
||||
NewReaction []BaseReaction `json:"new_reaction"`
|
||||
OldReaction []ReactionType `json:"old_reaction"`
|
||||
NewReaction []ReactionType `json:"new_reaction"`
|
||||
}
|
||||
|
||||
type MessageReactionCountUpdated struct {
|
||||
@@ -200,26 +200,15 @@ type MessageReactionCountUpdated struct {
|
||||
Date int `json:"date"`
|
||||
Reactions []*ReactionCount `json:"reactions"`
|
||||
}
|
||||
|
||||
type ReactionType interface {
|
||||
ReactionTypeEmoji | ReactionTypeCustomEmoji | ReactionTypePaid
|
||||
}
|
||||
type BaseReaction struct {
|
||||
Type string `json:"type"`
|
||||
}
|
||||
type ReactionTypeEmoji struct {
|
||||
Type string `json:"type"`
|
||||
Emoji string `json:"emoji"`
|
||||
}
|
||||
type ReactionTypeCustomEmoji struct {
|
||||
Type string `json:"type"`
|
||||
CustomEmojiID string `json:"custom_emoji_id"`
|
||||
}
|
||||
type ReactionTypePaid struct {
|
||||
type ReactionType struct {
|
||||
Type string `json:"type"`
|
||||
// ReactionTypeEmoji
|
||||
Emoji *string `json:"emoji,omitempty"`
|
||||
// ReactionTypeCustomEmoji
|
||||
CustomEmojiID *string `json:"custom_emoji_id,omitempty"`
|
||||
}
|
||||
type ReactionCount struct {
|
||||
Type BaseReaction `json:"type"`
|
||||
Type ReactionType `json:"type"`
|
||||
TotalCount int `json:"total_count"`
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +1,85 @@
|
||||
package tgapi
|
||||
|
||||
type Update struct {
|
||||
UpdateID int `json:"update_id"`
|
||||
Message *Message `json:"message"`
|
||||
EditedMessage *Message `json:"edited_message,omitempty"`
|
||||
ChannelPost *Message `json:"channel_post,omitempty"`
|
||||
EditedChannelPost *Message `json:"edited_channel_post,omitempty"`
|
||||
UpdateID int `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"`
|
||||
DeletedBusinessMessage *Message `json:"deleted_business_messages,omitempty"`
|
||||
MessageReaction *MessageReactionUpdated `json:"message_reaction,omitempty"`
|
||||
MessageReactionCount *MessageReactionCountUpdated `json:"message_reaction_count,omitempty"`
|
||||
CallbackQuery *CallbackQuery `json:"callback_query,omitempty"`
|
||||
InlineQuery int
|
||||
ChosenInlineResult int
|
||||
|
||||
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"`
|
||||
PurchasedPaidMedia *PaidMediaPurchased `json:"purchased_paid_media,omitempty"`
|
||||
|
||||
Poll any `json:"poll,omitempty"`
|
||||
PollAnswer any `json:"poll_answer,omitempty"`
|
||||
MyChatMember any `json:"my_chat_member,omitempty"`
|
||||
ChatMember any `json:"chat_member,omitempty"`
|
||||
ChatJoinRequest any `json:"chat_join_request,omitempty"`
|
||||
ChatBoost any `json:"chat_boost,omitempty"`
|
||||
RemovedChatBoost any `json:"removed_chat_boost,omitempty"`
|
||||
}
|
||||
|
||||
type InlineQuery struct {
|
||||
ID string `json:"id"`
|
||||
From User `json:"from"`
|
||||
Query string `json:"query"`
|
||||
Offset string `json:"offset"`
|
||||
ChatType *ChatType `json:"chat_type,omitempty"`
|
||||
Location *Location `json:"location,omitempty"`
|
||||
}
|
||||
type ChosenInlineResult struct {
|
||||
ResultID string `json:"result_id"`
|
||||
From User `json:"from"`
|
||||
Location *Location `json:"location,omitempty"`
|
||||
InlineMessageID string `json:"inline_message_id"`
|
||||
Query string `json:"query"`
|
||||
}
|
||||
|
||||
type ShippingQuery struct {
|
||||
ID string `json:"id"`
|
||||
From User `json:"from"`
|
||||
InvoicePayload string `json:"invoice_payload"`
|
||||
ShippingAddress ShippingAddress `json:"shipping_address"`
|
||||
}
|
||||
type ShippingAddress struct {
|
||||
CountryCode string `json:"country_code"`
|
||||
State string `json:"state"`
|
||||
City string `json:"city"`
|
||||
StreetLine1 string `json:"street_line1"`
|
||||
StreetLine2 string `json:"street_line2"`
|
||||
PostCode string `json:"post_code"`
|
||||
}
|
||||
|
||||
type OrderInfo struct {
|
||||
Name string `json:"name"`
|
||||
PhoneNumber string `json:"phone_number"`
|
||||
Email string `json:"email"`
|
||||
ShippingAddress ShippingAddress `json:"shipping_address"`
|
||||
}
|
||||
type PreCheckoutQuery struct {
|
||||
ID string `json:"id"`
|
||||
From User `json:"from"`
|
||||
Currency string `json:"currency"`
|
||||
TotalAmount int `json:"total_amount"`
|
||||
InvoicePayload string `json:"invoice_payload"`
|
||||
ShippingOptionID string `json:"shipping_option_id"`
|
||||
OrderInfo *OrderInfo `json:"order_info,omitempty"`
|
||||
}
|
||||
|
||||
type PaidMediaPurchased struct {
|
||||
From User `json:"from"`
|
||||
PaidMediaPayload string `json:"paid_media_payload"`
|
||||
}
|
||||
|
||||
type File struct {
|
||||
@@ -45,6 +110,12 @@ type Location struct {
|
||||
Heading int `json:"heading"`
|
||||
ProximityAlertRadius int `json:"proximity_alert_radius"`
|
||||
}
|
||||
type LocationAddress struct {
|
||||
CountryCode string `json:"country_code"`
|
||||
State *string `json:"state,omitempty"`
|
||||
City *string `json:"city,omitempty"`
|
||||
Street *string `json:"street,omitempty"`
|
||||
}
|
||||
type Venue struct {
|
||||
Location Location `json:"location"`
|
||||
Title string `json:"title"`
|
||||
@@ -64,6 +135,11 @@ type StarAmount struct {
|
||||
NanostarAmount int `json:"nanostar_amount"`
|
||||
}
|
||||
|
||||
type Story struct {
|
||||
Chat Chat `json:"chat"`
|
||||
ID int `json:"id"`
|
||||
}
|
||||
|
||||
// Gifts
|
||||
|
||||
type AcceptedGiftTypes struct {
|
||||
|
||||
@@ -32,3 +32,20 @@ func (api *Api) SetUserEmojiStatus(p SetUserEmojiStatusP) (bool, error) {
|
||||
req := NewRequest[bool]("setUserEmojiStatus", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
type GetUserGiftsP struct {
|
||||
UserID int `json:"user_id"`
|
||||
ExcludeUnlimited bool `json:"exclude_unlimited,omitempty"`
|
||||
ExcludeLimitedUpgradable bool `json:"exclude_limited_upgradable,omitempty"`
|
||||
ExcludeLimitedNonUpgradable bool `json:"exclude_limited_non_upgradable,omitempty"`
|
||||
ExcludeUnique bool `json:"exclude_unique,omitempty"`
|
||||
ExcludeFromBlockchain bool `json:"exclude_from_blockchain,omitempty"`
|
||||
SortByPrice bool `json:"sort_by_price,omitempty"`
|
||||
Offset string `json:"offset,omitempty"`
|
||||
Limit int `json:"limit,omitempty"`
|
||||
}
|
||||
|
||||
func (api *Api) GetUserGifts(p GetUserGiftsP) (OwnedGifts, error) {
|
||||
req := NewRequest[OwnedGifts]("getUserGifts", p)
|
||||
return req.Do(api)
|
||||
}
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
package tgapi
|
||||
|
||||
type User struct {
|
||||
ID int `json:"id"`
|
||||
IsBot bool `json:"is_bot"`
|
||||
FirstName string `json:"first_name"`
|
||||
LastName string `json:"last_name,omitempty"`
|
||||
Username string `json:"username,omitempty"`
|
||||
LanguageCode string `json:"language_code,omitempty"`
|
||||
IsPremium bool `json:"is_premium,omitempty"`
|
||||
AddedToAttachmentMenu bool `json:"added_to_attachment_menu,omitempty"`
|
||||
CanJoinGroups bool `json:"can_join_groups,omitempty"`
|
||||
CanReadAllGroupMessages bool `json:"can_read_all_group_messages,omitempty"`
|
||||
SupportsInlineQueries bool `json:"supports_inline_queries,omitempty"`
|
||||
CanConnectToBusiness bool `json:"can_connect_to_business,omitempty"`
|
||||
HasMainWebApp bool `json:"has_main_web_app,omitempty"`
|
||||
HasTopicsEnabled bool `json:"has_topics_enabled,omitempty"`
|
||||
AllowsUsersToCreateTopics bool `json:"allows_users_to_create_topics,omitempty"`
|
||||
ID int `json:"id"`
|
||||
IsBot bool `json:"is_bot"`
|
||||
FirstName string `json:"first_name"`
|
||||
LastName *string `json:"last_name,omitempty"`
|
||||
Username *string `json:"username,omitempty"`
|
||||
LanguageCode *string `json:"language_code,omitempty"`
|
||||
IsPremium *bool `json:"is_premium,omitempty"`
|
||||
AddedToAttachmentMenu *bool `json:"added_to_attachment_menu,omitempty"`
|
||||
CanJoinGroups *bool `json:"can_join_groups,omitempty"`
|
||||
CanReadAllGroupMessages *bool `json:"can_read_all_group_messages,omitempty"`
|
||||
SupportsInlineQueries *bool `json:"supports_inline_queries,omitempty"`
|
||||
CanConnectToBusiness *bool `json:"can_connect_to_business,omitempty"`
|
||||
HasMainWebApp *bool `json:"has_main_web_app,omitempty"`
|
||||
HasTopicsEnabled *bool `json:"has_topics_enabled,omitempty"`
|
||||
AllowsUsersToCreateTopics *bool `json:"allows_users_to_create_topics,omitempty"`
|
||||
}
|
||||
|
||||
type UserProfilePhotos struct {
|
||||
|
||||
Reference in New Issue
Block a user