WIP v0.5.0
This commit is contained in:
@@ -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