sendphoto

This commit is contained in:
ScuroNeko 2024-12-18 11:46:02 +03:00
parent c5b7ca8ae8
commit 7b418559dd
2 changed files with 40 additions and 1 deletions

View File

@ -79,3 +79,33 @@ func (b *Bot) SendMessage(params *SendMessageP) (*Message, error) {
err = MapToStruct(data, message)
return message, err
}
type SendPhotoP struct {
BusinessConnectionID string `json:"business_connection_id,omitempty"`
ChatID int `json:"chat_id"`
MessageThreadID int `json:"message_thread_id,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"`
HasSpoiler bool `json:"has_spoiler"`
DisableNotifications bool `json:"disable_notifications,omitempty"`
ProtectContent bool `json:"protect_content,omitempty"`
AllowPaidBroadcast bool `json:"allow_paid_broadcast,omitempty"`
MessageEffectID string `json:"message_effect_id,omitempty"`
}
func (b *Bot) SendPhoto(params *SendPhotoP) (*Message, error) {
dataP, err := StructToMap(params)
if err != nil {
return nil, err
}
data, err := b.request("sendPhoto", dataP)
if err != nil {
return nil, err
}
message := new(Message)
err = MapToStruct(data, message)
return message, err
}

View File

@ -50,7 +50,8 @@ type Message struct {
Chat *Chat `json:"chat,omitempty"`
Text string `json:"text"`
ReplyToMessage *Message `json:"reply_to_message"`
Photo []*PhotoSize `json:"photo,omitempty"`
ReplyToMessage *Message `json:"reply_to_message"`
}
type InaccessableMessage struct {
@ -84,6 +85,14 @@ type ReplyParameters struct {
QuotePosition int `json:"quote_postigin,omitempty"`
}
type PhotoSize struct {
FileID string `json:"file_id"`
FileUniqueID string `json:"file_unique_id"`
Width int `json:"width"`
Height int `json:"height"`
FileSize int `json:"file_size,omitempty"`
}
type LinkPreviewOptions struct {
IsDisabled bool `json:"is_disabled,omitempty"`
URL string `json:"url,omitempty"`