diff --git a/methods.go b/methods.go index e75389d..d4055dd 100644 --- a/methods.go +++ b/methods.go @@ -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 +} diff --git a/types.go b/types.go index 69f2a35..4902e0e 100644 --- a/types.go +++ b/types.go @@ -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"`