WIP v0.5.0
This commit is contained in:
9
go.mod
9
go.mod
@@ -17,13 +17,14 @@ require (
|
|||||||
github.com/klauspost/compress v1.18.4 // indirect
|
github.com/klauspost/compress v1.18.4 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // 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/pbkdf2 v1.0.0 // indirect
|
||||||
github.com/xdg-go/scram v1.2.0 // indirect
|
github.com/xdg-go/scram v1.2.0 // indirect
|
||||||
github.com/xdg-go/stringprep v1.0.4 // indirect
|
github.com/xdg-go/stringprep v1.0.4 // indirect
|
||||||
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // 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/sync v0.19.0 // indirect
|
||||||
golang.org/x/sys v0.40.0 // indirect
|
golang.org/x/sys v0.41.0 // indirect
|
||||||
golang.org/x/text v0.33.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-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 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y=
|
||||||
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
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 h1:19KvJrCj9aOMfU921hjnizWPlQmPTe+tb36zupOY2FA=
|
||||||
github.com/muir/sqltoken v0.2.1/go.mod h1:sSlj5M0VqQ4OuedmxwWs1TmzzRXaH3DLf5ukzg6meIo=
|
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 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/redis/go-redis/v9 v9.17.3 h1:fN29NdNrE17KttK5Ndf20buqfDZwGNgoUr9qjl1DQx4=
|
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.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 h1:V6e3FRj+n4dbpw86FJ8Fv7XVOql7TEwpHapKoMJ/GO8=
|
||||||
golang.org/x/crypto v0.47.0/go.mod h1:ff3Y9VzzKbwSSEzWqJsJVBnWmRwRSHt/6Op5n9bQc4A=
|
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/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-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
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.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ=
|
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.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-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
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=
|
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.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
||||||
golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE=
|
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.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-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.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
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"`
|
MessageThreadID int `json:"message_thread_id,omitempty"`
|
||||||
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
||||||
|
|
||||||
Photo string `json:"photo"`
|
Photo string `json:"photo"`
|
||||||
Caption string `json:"caption,omitempty"`
|
Caption string `json:"caption,omitempty"`
|
||||||
ParseMode ParseMode `json:"parse_mode,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"`
|
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
|
||||||
HasSpoiler bool `json:"has_spoiler,omitempty"`
|
HasSpoiler bool `json:"has_spoiler,omitempty"`
|
||||||
@@ -34,13 +34,13 @@ type SendAudioP struct {
|
|||||||
MessageThreadID int `json:"message_thread_id,omitempty"`
|
MessageThreadID int `json:"message_thread_id,omitempty"`
|
||||||
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
||||||
|
|
||||||
Audio string `json:"audio"`
|
Audio string `json:"audio"`
|
||||||
Caption string `json:"caption,omitempty"`
|
Caption string `json:"caption,omitempty"`
|
||||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||||
CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`
|
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
|
||||||
Duration int `json:"duration,omitempty"`
|
Duration int `json:"duration,omitempty"`
|
||||||
Performer string `json:"performer,omitempty"`
|
Performer string `json:"performer,omitempty"`
|
||||||
Title string `json:"title,omitempty"`
|
Title string `json:"title,omitempty"`
|
||||||
|
|
||||||
DisableNotification bool `json:"disable_notification,omitempty"`
|
DisableNotification bool `json:"disable_notification,omitempty"`
|
||||||
ProtectContent bool `json:"protect_content,omitempty"`
|
ProtectContent bool `json:"protect_content,omitempty"`
|
||||||
@@ -63,10 +63,10 @@ type SendDocumentP struct {
|
|||||||
MessageThreadID int `json:"message_thread_id,omitempty"`
|
MessageThreadID int `json:"message_thread_id,omitempty"`
|
||||||
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
||||||
|
|
||||||
Document string `json:"document"`
|
Document string `json:"document"`
|
||||||
Caption string `json:"caption,omitempty"`
|
Caption string `json:"caption,omitempty"`
|
||||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||||
CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`
|
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
|
||||||
|
|
||||||
DisableNotification bool `json:"disable_notification,omitempty"`
|
DisableNotification bool `json:"disable_notification,omitempty"`
|
||||||
ProtectContent bool `json:"protect_content,omitempty"`
|
ProtectContent bool `json:"protect_content,omitempty"`
|
||||||
@@ -93,12 +93,12 @@ type SendVideoP struct {
|
|||||||
Duration int `json:"duration,omitempty"`
|
Duration int `json:"duration,omitempty"`
|
||||||
Width int `json:"width,omitempty"`
|
Width int `json:"width,omitempty"`
|
||||||
Height int `json:"height,omitempty"`
|
Height int `json:"height,omitempty"`
|
||||||
Cover string `json:"cover,omitempty"`
|
Cover int `json:"cover,omitempty"`
|
||||||
|
|
||||||
StartTimestamp int `json:"start_timestamp,omitempty"`
|
StartTimestamp int `json:"start_timestamp,omitempty"`
|
||||||
Caption string `json:"caption,omitempty"`
|
Caption string `json:"caption,omitempty"`
|
||||||
ParseMode ParseMode `json:"parse_mode,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"`
|
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
|
||||||
HasSpoiler bool `json:"has_spoiler,omitempty"`
|
HasSpoiler bool `json:"has_spoiler,omitempty"`
|
||||||
@@ -129,15 +129,15 @@ type SendAnimationP struct {
|
|||||||
Width int `json:"width,omitempty"`
|
Width int `json:"width,omitempty"`
|
||||||
Height int `json:"height,omitempty"`
|
Height int `json:"height,omitempty"`
|
||||||
|
|
||||||
Caption string `json:"caption,omitempty"`
|
Caption string `json:"caption,omitempty"`
|
||||||
ParseMode ParseMode `json:"parse_mode,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"`
|
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
|
||||||
HasSpoiler bool `json:"has_spoiler,omitempty"`
|
HasSpoiler bool `json:"has_spoiler,omitempty"`
|
||||||
DisableNotification bool `json:"disable_notification,omitempty"`
|
DisableNotification bool `json:"disable_notification,omitempty"`
|
||||||
ProtectContent bool `json:"protect_content,omitempty"`
|
ProtectContent bool `json:"protect_content,omitempty"`
|
||||||
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
|
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
|
||||||
MessageEffectID string `json:"message_effect_id,omitempty"`
|
MessageEffectID string `json:"message_effect_id,omitempty"`
|
||||||
|
|
||||||
SuggestedPostParameters *SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
|
SuggestedPostParameters *SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
|
||||||
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
|
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
|
||||||
@@ -155,15 +155,15 @@ type SendVoiceP struct {
|
|||||||
MessageThreadID int `json:"message_thread_id,omitempty"`
|
MessageThreadID int `json:"message_thread_id,omitempty"`
|
||||||
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
||||||
|
|
||||||
Voice string `json:"voice"`
|
Voice string `json:"voice"`
|
||||||
Caption string `json:"caption,omitempty"`
|
Caption string `json:"caption,omitempty"`
|
||||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||||
CaptionEntities []*MessageEntity `json:"caption_entities,omitempty"`
|
CaptionEntities []MessageEntity `json:"caption_entities,omitempty"`
|
||||||
Duration int `json:"duration,omitempty"`
|
Duration int `json:"duration,omitempty"`
|
||||||
DisableNotification bool `json:"disable_notification,omitempty"`
|
DisableNotification bool `json:"disable_notification,omitempty"`
|
||||||
ProtectContent bool `json:"protect_content,omitempty"`
|
ProtectContent bool `json:"protect_content,omitempty"`
|
||||||
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
|
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
|
||||||
MessageEffectID string `json:"message_effect_id,omitempty"`
|
MessageEffectID string `json:"message_effect_id,omitempty"`
|
||||||
|
|
||||||
SuggestedPostParameters *SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
|
SuggestedPostParameters *SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
|
||||||
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
|
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
|
||||||
@@ -199,18 +199,18 @@ func (api *Api) SendVideoNote(params SendVideoNoteP) (Message, error) {
|
|||||||
return req.Do(api)
|
return req.Do(api)
|
||||||
}
|
}
|
||||||
|
|
||||||
type SendPaidMediaP[T InputPaidMedia] struct {
|
type SendPaidMediaP struct {
|
||||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||||
ChatID int `json:"chat_id"`
|
ChatID int `json:"chat_id"`
|
||||||
MessageThreadID int `json:"message_thread_id,omitempty"`
|
MessageThreadID int `json:"message_thread_id,omitempty"`
|
||||||
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
||||||
StarCount int `json:"star_count,omitempty"`
|
StarCount int `json:"star_count,omitempty"`
|
||||||
|
|
||||||
Media []T `json:"media"`
|
Media []InputPaidMedia `json:"media"`
|
||||||
Payload string `json:"payload,omitempty"`
|
Payload string `json:"payload,omitempty"`
|
||||||
Caption string `json:"caption,omitempty"`
|
Caption string `json:"caption,omitempty"`
|
||||||
ParseMode ParseMode `json:"parse_mode,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"`
|
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
|
||||||
DisableNotification bool `json:"disable_notification,omitempty"`
|
DisableNotification bool `json:"disable_notification,omitempty"`
|
||||||
ProtectContent bool `json:"protect_content,omitempty"`
|
ProtectContent bool `json:"protect_content,omitempty"`
|
||||||
@@ -221,22 +221,18 @@ type SendPaidMediaP[T InputPaidMedia] struct {
|
|||||||
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
|
ReplyMarkup *ReplyMarkup `json:"reply_markup,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *Api) SendPaidMediaPhoto(params SendPaidMediaP[InputPaidMediaPhoto]) (Message, error) {
|
func (api *Api) SendPaidMedia(params SendPaidMediaP) (Message, error) {
|
||||||
req := NewRequest[Message]("sendPaidMedia", params)
|
|
||||||
return req.Do(api)
|
|
||||||
}
|
|
||||||
func (api *Api) SendPaidMediaVideo(params SendPaidMediaP[InputPaidMediaVideo]) (Message, error) {
|
|
||||||
req := NewRequest[Message]("sendPaidMedia", params)
|
req := NewRequest[Message]("sendPaidMedia", params)
|
||||||
return req.Do(api)
|
return req.Do(api)
|
||||||
}
|
}
|
||||||
|
|
||||||
type SendMediaGroupP[T InputMedia] struct {
|
type SendMediaGroupP struct {
|
||||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
||||||
ChatID int `json:"chat_id"`
|
ChatID int `json:"chat_id"`
|
||||||
MessageThreadID int `json:"message_thread_id,omitempty"`
|
MessageThreadID int `json:"message_thread_id,omitempty"`
|
||||||
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
DirectMessagesTopicID int `json:"direct_messages_topic_id,omitempty"`
|
||||||
|
|
||||||
Media []T `json:"media"`
|
Media []InputMedia `json:"media"`
|
||||||
DisableNotification bool `json:"disable_notification,omitempty"`
|
DisableNotification bool `json:"disable_notification,omitempty"`
|
||||||
ProtectContent bool `json:"protect_content,omitempty"`
|
ProtectContent bool `json:"protect_content,omitempty"`
|
||||||
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
|
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
|
||||||
@@ -244,19 +240,7 @@ type SendMediaGroupP[T InputMedia] struct {
|
|||||||
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
|
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *Api) SendMediaGroupAudio(p SendMediaGroupP[InputMediaAudio]) (Message, error) {
|
func (api *Api) SendMediaGroup(p SendMediaGroupP) (Message, error) {
|
||||||
req := NewRequest[Message]("sendMediaGroupAudio", p)
|
req := NewRequest[Message]("sendMediaGroup", 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)
|
|
||||||
return req.Do(api)
|
return req.Do(api)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,24 @@
|
|||||||
package tgapi
|
package tgapi
|
||||||
|
|
||||||
type InputMedia interface {
|
type InputMedia struct {
|
||||||
InputMediaPhoto | InputMediaVideo | InputMediaAudio | InputMediaDocument
|
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
|
type InputMediaType string
|
||||||
@@ -14,66 +31,6 @@ const (
|
|||||||
InputMediaTypeAudio InputMediaType = "audio"
|
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
|
type InputPaidMediaType string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -81,14 +38,7 @@ const (
|
|||||||
InputPaidMediaTypePhoto InputPaidMediaType = "photo"
|
InputPaidMediaTypePhoto InputPaidMediaType = "photo"
|
||||||
)
|
)
|
||||||
|
|
||||||
type InputPaidMedia interface {
|
type InputPaidMedia struct {
|
||||||
InputPaidMediaVideo | InputPaidMediaPhoto
|
|
||||||
}
|
|
||||||
type InputPaidMediaPhoto struct {
|
|
||||||
Type InputPaidMediaType `json:"type"`
|
|
||||||
Media string `json:"media"`
|
|
||||||
}
|
|
||||||
type InputPaidMediaVideo struct {
|
|
||||||
Type InputPaidMediaType `json:"type"`
|
Type InputPaidMediaType `json:"type"`
|
||||||
Media string `json:"media"`
|
Media string `json:"media"`
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package tgapi
|
package tgapi
|
||||||
|
|
||||||
type SetMyCommandsP struct {
|
type SetMyCommandsP struct {
|
||||||
Commands []BotCommand `json:"commands"`
|
Commands []BotCommand `json:"commands"`
|
||||||
Scope *BaseBotCommandScope `json:"scope,omitempty"`
|
Scope *BotCommandScope `json:"scope,omitempty"`
|
||||||
Language string `json:"language_code,omitempty"`
|
Language string `json:"language_code,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *Api) SetMyCommands(p SetMyCommandsP) (bool, error) {
|
func (api *Api) SetMyCommands(p SetMyCommandsP) (bool, error) {
|
||||||
@@ -12,8 +12,8 @@ func (api *Api) SetMyCommands(p SetMyCommandsP) (bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DeleteMyCommandsP struct {
|
type DeleteMyCommandsP struct {
|
||||||
Scope *BaseBotCommandScope `json:"scope,omitempty"`
|
Scope *BotCommandScope `json:"scope,omitempty"`
|
||||||
Language string `json:"language_code,omitempty"`
|
Language string `json:"language_code,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *Api) DeleteMyCommands(p DeleteMyCommandsP) (bool, error) {
|
func (api *Api) DeleteMyCommands(p DeleteMyCommandsP) (bool, error) {
|
||||||
@@ -22,8 +22,8 @@ func (api *Api) DeleteMyCommands(p DeleteMyCommandsP) (bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type GetMyCommands struct {
|
type GetMyCommands struct {
|
||||||
Scope *BaseBotCommandScope `json:"scope,omitempty"`
|
Scope *BotCommandScope `json:"scope,omitempty"`
|
||||||
Language string `json:"language_code,omitempty"`
|
Language string `json:"language_code,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *Api) GetMyCommands(p GetMyCommands) ([]BotCommand, error) {
|
func (api *Api) GetMyCommands(p GetMyCommands) ([]BotCommand, error) {
|
||||||
@@ -88,15 +88,11 @@ func (api *Api) GetMyShortDescription(p GetMyShortDescription) (BotShortDescript
|
|||||||
return req.Do(api)
|
return req.Do(api)
|
||||||
}
|
}
|
||||||
|
|
||||||
type SetMyProfilePhotoP[T InputProfilePhoto] struct {
|
type SetMyProfilePhotoP struct {
|
||||||
Photo T `json:"photo"`
|
Photo InputProfilePhoto `json:"photo"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *Api) SetMyProfilePhotoStatic(p SetMyProfilePhotoP[InputProfilePhotoStatic]) (bool, error) {
|
func (api *Api) SetMyProfilePhoto(p SetMyProfilePhotoP) (bool, error) {
|
||||||
req := NewRequest[bool]("setMyProfilePhoto", p)
|
|
||||||
return req.Do(api)
|
|
||||||
}
|
|
||||||
func (api *Api) SetMyProfilePhotoAnimated(p SetMyProfilePhotoP[InputProfilePhotoAnimated]) (bool, error) {
|
|
||||||
req := NewRequest[bool]("setMyProfilePhoto", p)
|
req := NewRequest[bool]("setMyProfilePhoto", p)
|
||||||
return req.Do(api)
|
return req.Do(api)
|
||||||
}
|
}
|
||||||
@@ -105,20 +101,12 @@ func (api *Api) RemoveMyProfilePhoto() (bool, error) {
|
|||||||
return req.Do(api)
|
return req.Do(api)
|
||||||
}
|
}
|
||||||
|
|
||||||
type SetChatMenuButtonP[T MenuButton] struct {
|
type SetChatMenuButtonP struct {
|
||||||
ChatID int `json:"chat_id"`
|
ChatID int `json:"chat_id"`
|
||||||
MenuButton T `json:"menu_button"`
|
MenuButton MenuButtonType `json:"menu_button"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *Api) SetChatMenuButtonCommands(p SetChatMenuButtonP[MenuButtonCommands]) (bool, error) {
|
func (api *Api) SetChatMenuButton(p SetChatMenuButtonP) (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) {
|
|
||||||
req := NewRequest[bool]("setChatMenuButton", p)
|
req := NewRequest[bool]("setChatMenuButton", p)
|
||||||
return req.Do(api)
|
return req.Do(api)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,33 +16,10 @@ const (
|
|||||||
BotCommandScopeChatMemberType BotCommandScopeType = "chat_member"
|
BotCommandScopeChatMemberType BotCommandScopeType = "chat_member"
|
||||||
)
|
)
|
||||||
|
|
||||||
type BaseBotCommandScope struct {
|
type BotCommandScope struct {
|
||||||
Type BotCommandScopeType `json:"type"`
|
Type BotCommandScopeType `json:"type"`
|
||||||
}
|
ChatID *int `json:"chat_id,omitempty"`
|
||||||
type BotCommandScopeDefault struct {
|
UserID *int `json:"user_id,omitempty"`
|
||||||
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 BotName struct {
|
type BotName struct {
|
||||||
@@ -61,20 +38,15 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type InputProfilePhotoType string
|
type InputProfilePhotoType string
|
||||||
type InputProfilePhoto interface {
|
type InputProfilePhoto struct {
|
||||||
InputProfilePhotoStatic | InputProfilePhotoAnimated
|
|
||||||
}
|
|
||||||
type BaseInputProfilePhoto struct {
|
|
||||||
Type InputProfilePhotoType `json:"type"`
|
Type InputProfilePhotoType `json:"type"`
|
||||||
}
|
|
||||||
type InputProfilePhotoStatic struct {
|
// Static
|
||||||
BaseInputProfilePhoto
|
Photo *string `json:"photo,omitempty"`
|
||||||
Photo string `json:"photo"`
|
|
||||||
}
|
// Animated
|
||||||
type InputProfilePhotoAnimated struct {
|
Animation *string `json:"animation,omitempty"`
|
||||||
BaseInputProfilePhoto
|
MainFrameTimestamp *float64 `json:"main_frame_timestamp,omitempty"`
|
||||||
Animation string `json:"animation"`
|
|
||||||
MainFrameTimestamp float64 `json:"main_frame_timestamp"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -84,16 +56,9 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type MenuButtonType string
|
type MenuButtonType string
|
||||||
type MenuButton interface {
|
|
||||||
MenuButtonCommands | MenuButtonDefault | MenuButtonWebApp
|
|
||||||
}
|
|
||||||
type BaseMenuButton struct {
|
type BaseMenuButton struct {
|
||||||
Type MenuButtonType `json:"type"`
|
Type MenuButtonType `json:"type"`
|
||||||
}
|
// WebApp
|
||||||
type MenuButtonCommands struct{ BaseMenuButton }
|
|
||||||
type MenuButtonDefault struct{ BaseMenuButton }
|
|
||||||
type MenuButtonWebApp struct {
|
|
||||||
BaseMenuButton
|
|
||||||
Text string `json:"text"`
|
Text string `json:"text"`
|
||||||
WebApp WebAppInfo `json:"web_app"`
|
WebApp WebAppInfo `json:"web_app"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,17 +90,13 @@ func (api *Api) SetBusinessAccountBio(p SetBusinessAccountBioP) (bool, error) {
|
|||||||
return req.Do(api)
|
return req.Do(api)
|
||||||
}
|
}
|
||||||
|
|
||||||
type SetBusinessAccountProfilePhoto[T InputProfilePhoto] struct {
|
type SetBusinessAccountProfilePhoto struct {
|
||||||
BusinessConnectionID string `json:"business_connection_id"`
|
BusinessConnectionID string `json:"business_connection_id"`
|
||||||
Photo T `json:"photo,omitempty"`
|
Photo InputProfilePhoto `json:"photo,omitempty"`
|
||||||
IsPublic bool `json:"is_public,omitempty"`
|
IsPublic bool `json:"is_public,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *Api) SetBusinessAccountProfilePhotoStatic(p SetMyProfilePhotoP[InputProfilePhotoStatic]) (bool, error) {
|
func (api *Api) SetBusinessAccountProfilePhoto(p SetBusinessAccountProfilePhoto) (bool, error) {
|
||||||
req := NewRequest[bool]("setBusinessAccountProfilePhoto", p)
|
|
||||||
return req.Do(api)
|
|
||||||
}
|
|
||||||
func (api *Api) SetBusinessAccountProfilePhotoAnimated(p SetMyProfilePhotoP[InputProfilePhotoAnimated]) (bool, error) {
|
|
||||||
req := NewRequest[bool]("setBusinessAccountProfilePhoto", p)
|
req := NewRequest[bool]("setBusinessAccountProfilePhoto", p)
|
||||||
return req.Do(api)
|
return req.Do(api)
|
||||||
}
|
}
|
||||||
@@ -163,3 +159,100 @@ func (api *Api) GetBusinessAccountGifts(p GetBusinessAccountGiftsP) (OwnedGifts,
|
|||||||
req := NewRequest[OwnedGifts]("getBusinessAccountGifts", p)
|
req := NewRequest[OwnedGifts]("getBusinessAccountGifts", p)
|
||||||
return req.Do(api)
|
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"`
|
Rights *BusinessBotRights `json:"rights,omitempty"`
|
||||||
IsEnabled bool `json:"id_enabled"`
|
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
|
package tgapi
|
||||||
|
|
||||||
type BanChatMemberP struct {
|
type BanChatMemberP struct {
|
||||||
ChatID int `json:"chat_id"`
|
ChatID int `json:"chat_id"`
|
||||||
UserID int `json:"user_id"`
|
UserID int `json:"user_id"`
|
||||||
UntilDate int64 `json:"until_date,omitempty"`
|
UntilDate int `json:"until_date,omitempty"`
|
||||||
RevokeMessages bool `json:"revoke_messages,omitempty"`
|
RevokeMessages bool `json:"revoke_messages,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *Api) BanChatMember(p BanChatMemberP) (bool, error) {
|
func (api *Api) BanChatMember(p BanChatMemberP) (bool, error) {
|
||||||
@@ -115,11 +115,11 @@ func (api *Api) ExportChatInviteLink(p ExportChatInviteLinkP) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CreateChatInviteLinkP struct {
|
type CreateChatInviteLinkP struct {
|
||||||
ChatID int `json:"chat_id"`
|
ChatID int `json:"chat_id"`
|
||||||
Name string `json:"name,omitempty"`
|
Name *string `json:"name,omitempty"`
|
||||||
ExpireDate int `json:"expire_date,omitempty"`
|
ExpireDate int `json:"expire_date,omitempty"`
|
||||||
MemberLimit int `json:"member_limit,omitempty"`
|
MemberLimit int `json:"member_limit,omitempty"`
|
||||||
CreatesJoinRequest int `json:"creates_join_request,omitempty"`
|
CreatesJoinRequest int `json:"creates_join_request,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *Api) CreateChatInviteLink(p CreateChatInviteLinkP) (ChatInviteLink, error) {
|
func (api *Api) CreateChatInviteLink(p CreateChatInviteLinkP) (ChatInviteLink, error) {
|
||||||
@@ -230,10 +230,10 @@ func (api *Api) SetChatDescription(p SetChatDescriptionP) (bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PinChatMessageP struct {
|
type PinChatMessageP struct {
|
||||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
|
||||||
ChatID int `json:"chat_id"`
|
ChatID int `json:"chat_id"`
|
||||||
MessageID int `json:"message_id"`
|
MessageID int `json:"message_id"`
|
||||||
DisableNotification bool `json:"disable_notification,omitempty"`
|
DisableNotification bool `json:"disable_notification,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *Api) PinChatMessage(p PinChatMessageP) (bool, error) {
|
func (api *Api) PinChatMessage(p PinChatMessageP) (bool, error) {
|
||||||
@@ -242,9 +242,9 @@ func (api *Api) PinChatMessage(p PinChatMessageP) (bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type UnpinChatMessageP struct {
|
type UnpinChatMessageP struct {
|
||||||
BusinessConnectionID string `json:"business_connection_id,omitempty"`
|
BusinessConnectionID *string `json:"business_connection_id,omitempty"`
|
||||||
ChatID int `json:"chat_id"`
|
ChatID int `json:"chat_id"`
|
||||||
MessageID int `json:"message_id"`
|
MessageID int `json:"message_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *Api) UnpinChatMessage(p UnpinChatMessageP) (bool, error) {
|
func (api *Api) UnpinChatMessage(p UnpinChatMessageP) (bool, error) {
|
||||||
@@ -283,8 +283,8 @@ type GetChatAdministratorsP struct {
|
|||||||
ChatID int `json:"chat_id"`
|
ChatID int `json:"chat_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *Api) GetChatAdministrators(p GetChatAdministratorsP) ([]BaseChatMember, error) {
|
func (api *Api) GetChatAdministrators(p GetChatAdministratorsP) ([]ChatMember, error) {
|
||||||
req := NewRequest[[]BaseChatMember]("getChatAdministrators", p)
|
req := NewRequest[[]ChatMember]("getChatAdministrators", p)
|
||||||
return req.Do(api)
|
return req.Do(api)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,8 +302,8 @@ type GetChatMemberP struct {
|
|||||||
UserID int `json:"user_id"`
|
UserID int `json:"user_id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *Api) GetChatMember(p GetChatMemberP) (BaseChatMember, error) {
|
func (api *Api) GetChatMember(p GetChatMemberP) (ChatMember, error) {
|
||||||
req := NewRequest[BaseChatMember]("getChatMember", p)
|
req := NewRequest[ChatMember]("getChatMember", p)
|
||||||
return req.Do(api)
|
return req.Do(api)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,3 +335,22 @@ func (api *Api) GetUserChatBoosts(p GetUserChatBoostsP) (UserChatBoosts, error)
|
|||||||
req := NewRequest[UserChatBoosts]("getUserChatBoosts", p)
|
req := NewRequest[UserChatBoosts]("getUserChatBoosts", p)
|
||||||
return req.Do(api)
|
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"`
|
PersonalChat *Chat `json:"personal_chat,omitempty"`
|
||||||
ParentChat *Chat `json:"parent_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"`
|
BackgroundCustomEmojiID *string `json:"background_custom_emoji_id,omitempty"`
|
||||||
ProfileAccentColorID *int `json:"profile_accent_color_id,omitempty"`
|
ProfileAccentColorID *int `json:"profile_accent_color_id,omitempty"`
|
||||||
@@ -134,69 +134,47 @@ const (
|
|||||||
ChatMemberStatusBanned ChatMemberStatusType = "kicked"
|
ChatMemberStatusBanned ChatMemberStatusType = "kicked"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ChatMember interface {
|
type ChatMember struct {
|
||||||
ChatMemberOwner | ChatMemberAdministrator | ChatMemberMember | ChatMemberRestricted | ChatMemberLeft | ChatMemberBanned
|
|
||||||
}
|
|
||||||
type BaseChatMember struct {
|
|
||||||
Status ChatMemberStatusType `json:"status"`
|
Status ChatMemberStatusType `json:"status"`
|
||||||
User User `json:"user"`
|
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"`
|
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"`
|
// Administrator
|
||||||
CanEditMessages *bool `json:"can_edit_messages,omitempty"`
|
CanBeEdited *bool `json:"can_be_edited,omitempty"`
|
||||||
CanPinMessages *bool `json:"can_pin_messages,omitempty"`
|
CanManageChat *bool `json:"can_manage_chat,omitempty"`
|
||||||
CanManageTopics *bool `json:"can_manage_topics,omitempty"`
|
CanDeleteMessages *bool `json:"can_delete_messages,omitempty"`
|
||||||
CanManageDirectMessages *bool `json:"can_manage_direct_messages,omitempty"`
|
CanManageVideoChats *bool `json:"can_manage_video_chats,omitempty"`
|
||||||
CustomTitle *string `json:"custom_title,omitempty"`
|
CanRestrictMembers *bool `json:"can_restrict_members,omitempty"`
|
||||||
}
|
CanPromoteMembers *bool `json:"can_promote_members,omitempty"`
|
||||||
type ChatMemberMember struct {
|
CanChangeInfo *bool `json:"can_change_info,omitempty"`
|
||||||
BaseChatMember
|
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"`
|
UntilDate *int `json:"until_date,omitempty"`
|
||||||
}
|
|
||||||
type ChatMemberRestricted struct {
|
// Restricted
|
||||||
BaseChatMember
|
IsMember *bool `json:"is_member,omitempty"`
|
||||||
IsMember bool `json:"is_member"`
|
CanSendMessages *bool `json:"can_send_messages,omitempty"`
|
||||||
CanSendMessages bool `json:"can_send_messages"`
|
CanSendAudios *bool `json:"can_send_audios,omitempty"`
|
||||||
CanSendAudios bool `json:"can_send_audios"`
|
CanSendDocuments *bool `json:"can_send_documents,omitempty"`
|
||||||
CanSendDocuments bool `json:"can_send_documents"`
|
CanSendVideos *bool `json:"can_send_videos,omitempty"`
|
||||||
CanSendVideos bool `json:"can_send_videos"`
|
CanSendVideoNotes *bool `json:"can_send_video_notes,omitempty"`
|
||||||
CanSendVideoNotes bool `json:"can_send_video_notes"`
|
CanSendVoiceNotes *bool `json:"can_send_voice_notes,omitempty"`
|
||||||
CanSendVoiceNotes bool `json:"can_send_voice_notes"`
|
CanSendPolls *bool `json:"can_send_polls,omitempty"`
|
||||||
CanSendPolls bool `json:"can_send_polls"`
|
CanSendOtherMessages *bool `json:"can_send_other_messages,omitempty"`
|
||||||
CanSendOtherMessages bool `json:"can_send_other_messages"`
|
CanAddWebPagePreview *bool `json:"can_add_web_page_preview,omitempty"`
|
||||||
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"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type BaseChatBoostSource struct {
|
type BaseChatBoostSource struct {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ type SendMessageP struct {
|
|||||||
|
|
||||||
Text string `json:"text"`
|
Text string `json:"text"`
|
||||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||||
Entities []*MessageEntity `json:"entities,omitempty"`
|
Entities []MessageEntity `json:"entities,omitempty"`
|
||||||
LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`
|
LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options,omitempty"`
|
||||||
DisableNotifications bool `json:"disable_notifications,omitempty"`
|
DisableNotifications bool `json:"disable_notifications,omitempty"`
|
||||||
ProtectContent bool `json:"protect_content,omitempty"`
|
ProtectContent bool `json:"protect_content,omitempty"`
|
||||||
@@ -72,12 +72,12 @@ type CopyMessageP struct {
|
|||||||
Caption string `json:"caption,omitempty"`
|
Caption string `json:"caption,omitempty"`
|
||||||
ParseMode ParseMode `json:"parse_mode,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"`
|
ShowCaptionAboveMedia bool `json:"show_caption_above_media,omitempty"`
|
||||||
DisableNotification bool `json:"disable_notification,omitempty"`
|
DisableNotification bool `json:"disable_notification,omitempty"`
|
||||||
ProtectContent bool `json:"protect_content,omitempty"`
|
ProtectContent bool `json:"protect_content,omitempty"`
|
||||||
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
|
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
|
||||||
MessageEffectID string `json:"message_effect_id,omitempty"`
|
MessageEffectID string `json:"message_effect_id,omitempty"`
|
||||||
|
|
||||||
SuggestedPostParameters *SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
|
SuggestedPostParameters *SuggestedPostParameters `json:"suggested_post_parameters,omitempty"`
|
||||||
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
|
ReplyParameters *ReplyParameters `json:"reply_parameters,omitempty"`
|
||||||
@@ -197,7 +197,7 @@ type SendPollP struct {
|
|||||||
|
|
||||||
Question string `json:"question"`
|
Question string `json:"question"`
|
||||||
QuestionParseMode ParseMode `json:"question_mode,omitempty"`
|
QuestionParseMode ParseMode `json:"question_mode,omitempty"`
|
||||||
QuestionEntities []*MessageEntity `json:"question_entities,omitempty"`
|
QuestionEntities []MessageEntity `json:"question_entities,omitempty"`
|
||||||
Options []InputPollOption `json:"options"`
|
Options []InputPollOption `json:"options"`
|
||||||
IsAnonymous bool `json:"is_anonymous,omitempty"`
|
IsAnonymous bool `json:"is_anonymous,omitempty"`
|
||||||
Type PollType `json:"type"`
|
Type PollType `json:"type"`
|
||||||
@@ -205,7 +205,7 @@ type SendPollP struct {
|
|||||||
CorrectOptionID int `json:"correct_option_id,omitempty"`
|
CorrectOptionID int `json:"correct_option_id,omitempty"`
|
||||||
Explanation string `json:"explanation,omitempty"`
|
Explanation string `json:"explanation,omitempty"`
|
||||||
ExplanationParseMode ParseMode `json:"explanation_parse_mode,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"`
|
OpenPeriod int `json:"open_period,omitempty"`
|
||||||
CloseDate int `json:"close_date"`
|
CloseDate int `json:"close_date"`
|
||||||
IsClosed bool `json:"is_closed,omitempty"`
|
IsClosed bool `json:"is_closed,omitempty"`
|
||||||
@@ -266,12 +266,12 @@ func (api *Api) SendDice(params SendDiceP) (Message, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SendMessageDraftP struct {
|
type SendMessageDraftP struct {
|
||||||
ChatID int `json:"chat_id"`
|
ChatID int `json:"chat_id"`
|
||||||
MessageThreadID int `json:"message_thread_id,omitempty"`
|
MessageThreadID int `json:"message_thread_id,omitempty"`
|
||||||
DraftID int `json:"draft_id"`
|
DraftID int `json:"draft_id"`
|
||||||
Text string `json:"text"`
|
Text string `json:"text"`
|
||||||
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
ParseMode ParseMode `json:"parse_mode,omitempty"`
|
||||||
Entities []*MessageEntity `json:"entities,omitempty"`
|
Entities []MessageEntity `json:"entities,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *Api) SendMessageDraft(params SendMessageDraftP) (bool, error) {
|
func (api *Api) SendMessageDraft(params SendMessageDraftP) (bool, error) {
|
||||||
@@ -291,22 +291,14 @@ func (api *Api) SendChatAction(params SendChatActionP) (bool, error) {
|
|||||||
return req.Do(api)
|
return req.Do(api)
|
||||||
}
|
}
|
||||||
|
|
||||||
type SetMessageReactionP[T ReactionType] struct {
|
type SetMessageReactionP struct {
|
||||||
ChatId int `json:"chat_id"`
|
ChatId int `json:"chat_id"`
|
||||||
MessageId int `json:"message_id"`
|
MessageId int `json:"message_id"`
|
||||||
Reaction []T `json:"reaction"`
|
Reaction []ReactionType `json:"reaction"`
|
||||||
IsBig bool `json:"is_big,omitempty"`
|
IsBig bool `json:"is_big,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *Api) SetMessageReactionEmoji(params SetMessageReactionP[ReactionTypeEmoji]) (bool, error) {
|
func (api *Api) SetMessageReaction(params SetMessageReactionP) (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) {
|
|
||||||
req := NewRequest[bool]("setMessageReaction", params)
|
req := NewRequest[bool]("setMessageReaction", params)
|
||||||
return req.Do(api)
|
return req.Do(api)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -190,8 +190,8 @@ type MessageReactionUpdated struct {
|
|||||||
User *User `json:"user,omitempty"`
|
User *User `json:"user,omitempty"`
|
||||||
ActorChat *Chat `json:"actor_chat"`
|
ActorChat *Chat `json:"actor_chat"`
|
||||||
Date int `json:"date"`
|
Date int `json:"date"`
|
||||||
OldReaction []BaseReaction `json:"old_reaction"`
|
OldReaction []ReactionType `json:"old_reaction"`
|
||||||
NewReaction []BaseReaction `json:"new_reaction"`
|
NewReaction []ReactionType `json:"new_reaction"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type MessageReactionCountUpdated struct {
|
type MessageReactionCountUpdated struct {
|
||||||
@@ -200,26 +200,15 @@ type MessageReactionCountUpdated struct {
|
|||||||
Date int `json:"date"`
|
Date int `json:"date"`
|
||||||
Reactions []*ReactionCount `json:"reactions"`
|
Reactions []*ReactionCount `json:"reactions"`
|
||||||
}
|
}
|
||||||
|
type ReactionType struct {
|
||||||
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 string `json:"type"`
|
Type string `json:"type"`
|
||||||
|
// ReactionTypeEmoji
|
||||||
|
Emoji *string `json:"emoji,omitempty"`
|
||||||
|
// ReactionTypeCustomEmoji
|
||||||
|
CustomEmojiID *string `json:"custom_emoji_id,omitempty"`
|
||||||
}
|
}
|
||||||
type ReactionCount struct {
|
type ReactionCount struct {
|
||||||
Type BaseReaction `json:"type"`
|
Type ReactionType `json:"type"`
|
||||||
TotalCount int `json:"total_count"`
|
TotalCount int `json:"total_count"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,85 @@
|
|||||||
package tgapi
|
package tgapi
|
||||||
|
|
||||||
type Update struct {
|
type Update struct {
|
||||||
UpdateID int `json:"update_id"`
|
UpdateID int `json:"update_id"`
|
||||||
Message *Message `json:"message"`
|
Message *Message `json:"message,omitempty"`
|
||||||
EditedMessage *Message `json:"edited_message,omitempty"`
|
EditedMessage *Message `json:"edited_message,omitempty"`
|
||||||
ChannelPost *Message `json:"channel_post,omitempty"`
|
ChannelPost *Message `json:"channel_post,omitempty"`
|
||||||
EditedChannelPost *Message `json:"edited_channel_post,omitempty"`
|
EditedChannelPost *Message `json:"edited_channel_post,omitempty"`
|
||||||
|
|
||||||
BusinessConnection *BusinessConnection `json:"business_connection,omitempty"`
|
BusinessConnection *BusinessConnection `json:"business_connection,omitempty"`
|
||||||
BusinessMessage *Message `json:"business_message,omitempty"`
|
BusinessMessage *Message `json:"business_message,omitempty"`
|
||||||
EditedBusinessMessage *Message `json:"edited_business_message,omitempty"`
|
EditedBusinessMessage *Message `json:"edited_business_message,omitempty"`
|
||||||
DeletedBusinessMessage *Message `json:"deleted_business_messages,omitempty"`
|
DeletedBusinessMessage *Message `json:"deleted_business_messages,omitempty"`
|
||||||
MessageReaction *MessageReactionUpdated `json:"message_reaction,omitempty"`
|
MessageReaction *MessageReactionUpdated `json:"message_reaction,omitempty"`
|
||||||
MessageReactionCount *MessageReactionCountUpdated `json:"message_reaction_count,omitempty"`
|
MessageReactionCount *MessageReactionCountUpdated `json:"message_reaction_count,omitempty"`
|
||||||
CallbackQuery *CallbackQuery `json:"callback_query,omitempty"`
|
|
||||||
InlineQuery int
|
InlineQuery *InlineQuery `json:"inline_query,omitempty"`
|
||||||
ChosenInlineResult int
|
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 {
|
type File struct {
|
||||||
@@ -45,6 +110,12 @@ type Location struct {
|
|||||||
Heading int `json:"heading"`
|
Heading int `json:"heading"`
|
||||||
ProximityAlertRadius int `json:"proximity_alert_radius"`
|
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 {
|
type Venue struct {
|
||||||
Location Location `json:"location"`
|
Location Location `json:"location"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
@@ -64,6 +135,11 @@ type StarAmount struct {
|
|||||||
NanostarAmount int `json:"nanostar_amount"`
|
NanostarAmount int `json:"nanostar_amount"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Story struct {
|
||||||
|
Chat Chat `json:"chat"`
|
||||||
|
ID int `json:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
// Gifts
|
// Gifts
|
||||||
|
|
||||||
type AcceptedGiftTypes struct {
|
type AcceptedGiftTypes struct {
|
||||||
|
|||||||
@@ -32,3 +32,20 @@ func (api *Api) SetUserEmojiStatus(p SetUserEmojiStatusP) (bool, error) {
|
|||||||
req := NewRequest[bool]("setUserEmojiStatus", p)
|
req := NewRequest[bool]("setUserEmojiStatus", p)
|
||||||
return req.Do(api)
|
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
|
package tgapi
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id"`
|
||||||
IsBot bool `json:"is_bot"`
|
IsBot bool `json:"is_bot"`
|
||||||
FirstName string `json:"first_name"`
|
FirstName string `json:"first_name"`
|
||||||
LastName string `json:"last_name,omitempty"`
|
LastName *string `json:"last_name,omitempty"`
|
||||||
Username string `json:"username,omitempty"`
|
Username *string `json:"username,omitempty"`
|
||||||
LanguageCode string `json:"language_code,omitempty"`
|
LanguageCode *string `json:"language_code,omitempty"`
|
||||||
IsPremium bool `json:"is_premium,omitempty"`
|
IsPremium *bool `json:"is_premium,omitempty"`
|
||||||
AddedToAttachmentMenu bool `json:"added_to_attachment_menu,omitempty"`
|
AddedToAttachmentMenu *bool `json:"added_to_attachment_menu,omitempty"`
|
||||||
CanJoinGroups bool `json:"can_join_groups,omitempty"`
|
CanJoinGroups *bool `json:"can_join_groups,omitempty"`
|
||||||
CanReadAllGroupMessages bool `json:"can_read_all_group_messages,omitempty"`
|
CanReadAllGroupMessages *bool `json:"can_read_all_group_messages,omitempty"`
|
||||||
SupportsInlineQueries bool `json:"supports_inline_queries,omitempty"`
|
SupportsInlineQueries *bool `json:"supports_inline_queries,omitempty"`
|
||||||
CanConnectToBusiness bool `json:"can_connect_to_business,omitempty"`
|
CanConnectToBusiness *bool `json:"can_connect_to_business,omitempty"`
|
||||||
HasMainWebApp bool `json:"has_main_web_app,omitempty"`
|
HasMainWebApp *bool `json:"has_main_web_app,omitempty"`
|
||||||
HasTopicsEnabled bool `json:"has_topics_enabled,omitempty"`
|
HasTopicsEnabled *bool `json:"has_topics_enabled,omitempty"`
|
||||||
AllowsUsersToCreateTopics bool `json:"allows_users_to_create_topics,omitempty"`
|
AllowsUsersToCreateTopics *bool `json:"allows_users_to_create_topics,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserProfilePhotos struct {
|
type UserProfilePhotos struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user