|
|
@ -29,7 +29,6 @@ func (p *Photo) Send(b *Bot, to Recipient, opt *SendOptions) (*Message, error) {
|
|
|
|
"chat_id": to.Recipient(),
|
|
|
|
"chat_id": to.Recipient(),
|
|
|
|
"caption": p.Caption,
|
|
|
|
"caption": p.Caption,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
b.embedSendOptions(params, opt)
|
|
|
|
b.embedSendOptions(params, opt)
|
|
|
|
|
|
|
|
|
|
|
|
msg, err := b.sendObject(&p.File, "photo", params, nil)
|
|
|
|
msg, err := b.sendObject(&p.File, "photo", params, nil)
|
|
|
@ -53,13 +52,12 @@ func (a *Audio) Send(b *Bot, to Recipient, opt *SendOptions) (*Message, error) {
|
|
|
|
"title": a.Title,
|
|
|
|
"title": a.Title,
|
|
|
|
"file_name": a.FileName,
|
|
|
|
"file_name": a.FileName,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
b.embedSendOptions(params, opt)
|
|
|
|
|
|
|
|
|
|
|
|
if a.Duration != 0 {
|
|
|
|
if a.Duration != 0 {
|
|
|
|
params["duration"] = strconv.Itoa(a.Duration)
|
|
|
|
params["duration"] = strconv.Itoa(a.Duration)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
b.embedSendOptions(params, opt)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
msg, err := b.sendObject(&a.File, "audio", params, thumbnailToFilemap(a.Thumbnail))
|
|
|
|
msg, err := b.sendObject(&a.File, "audio", params, thumbnailToFilemap(a.Thumbnail))
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
@ -86,13 +84,12 @@ func (d *Document) Send(b *Bot, to Recipient, opt *SendOptions) (*Message, error
|
|
|
|
"caption": d.Caption,
|
|
|
|
"caption": d.Caption,
|
|
|
|
"file_name": d.FileName,
|
|
|
|
"file_name": d.FileName,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
b.embedSendOptions(params, opt)
|
|
|
|
|
|
|
|
|
|
|
|
if d.FileSize != 0 {
|
|
|
|
if d.FileSize != 0 {
|
|
|
|
params["file_size"] = strconv.Itoa(d.FileSize)
|
|
|
|
params["file_size"] = strconv.Itoa(d.FileSize)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
b.embedSendOptions(params, opt)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
msg, err := b.sendObject(&d.File, "document", params, thumbnailToFilemap(d.Thumbnail))
|
|
|
|
msg, err := b.sendObject(&d.File, "document", params, thumbnailToFilemap(d.Thumbnail))
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
@ -130,6 +127,7 @@ func (v *Video) Send(b *Bot, to Recipient, opt *SendOptions) (*Message, error) {
|
|
|
|
"caption": v.Caption,
|
|
|
|
"caption": v.Caption,
|
|
|
|
"file_name": v.FileName,
|
|
|
|
"file_name": v.FileName,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
b.embedSendOptions(params, opt)
|
|
|
|
|
|
|
|
|
|
|
|
if v.Duration != 0 {
|
|
|
|
if v.Duration != 0 {
|
|
|
|
params["duration"] = strconv.Itoa(v.Duration)
|
|
|
|
params["duration"] = strconv.Itoa(v.Duration)
|
|
|
@ -144,8 +142,6 @@ func (v *Video) Send(b *Bot, to Recipient, opt *SendOptions) (*Message, error) {
|
|
|
|
params["supports_streaming"] = "true"
|
|
|
|
params["supports_streaming"] = "true"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
b.embedSendOptions(params, opt)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
msg, err := b.sendObject(&v.File, "video", params, thumbnailToFilemap(v.Thumbnail))
|
|
|
|
msg, err := b.sendObject(&v.File, "video", params, thumbnailToFilemap(v.Thumbnail))
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
@ -175,6 +171,7 @@ func (a *Animation) Send(b *Bot, to Recipient, opt *SendOptions) (*Message, erro
|
|
|
|
"caption": a.Caption,
|
|
|
|
"caption": a.Caption,
|
|
|
|
"file_name": a.FileName,
|
|
|
|
"file_name": a.FileName,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
b.embedSendOptions(params, opt)
|
|
|
|
|
|
|
|
|
|
|
|
if a.Duration != 0 {
|
|
|
|
if a.Duration != 0 {
|
|
|
|
params["duration"] = strconv.Itoa(a.Duration)
|
|
|
|
params["duration"] = strconv.Itoa(a.Duration)
|
|
|
@ -191,8 +188,6 @@ func (a *Animation) Send(b *Bot, to Recipient, opt *SendOptions) (*Message, erro
|
|
|
|
params["file_name"] = filepath.Base(a.File.FileLocal)
|
|
|
|
params["file_name"] = filepath.Base(a.File.FileLocal)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
b.embedSendOptions(params, opt)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
msg, err := b.sendObject(&a.File, "animation", params, nil)
|
|
|
|
msg, err := b.sendObject(&a.File, "animation", params, nil)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
@ -210,13 +205,12 @@ func (v *Voice) Send(b *Bot, to Recipient, opt *SendOptions) (*Message, error) {
|
|
|
|
params := map[string]string{
|
|
|
|
params := map[string]string{
|
|
|
|
"chat_id": to.Recipient(),
|
|
|
|
"chat_id": to.Recipient(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
b.embedSendOptions(params, opt)
|
|
|
|
|
|
|
|
|
|
|
|
if v.Duration != 0 {
|
|
|
|
if v.Duration != 0 {
|
|
|
|
params["duration"] = strconv.Itoa(v.Duration)
|
|
|
|
params["duration"] = strconv.Itoa(v.Duration)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
b.embedSendOptions(params, opt)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
msg, err := b.sendObject(&v.File, "voice", params, nil)
|
|
|
|
msg, err := b.sendObject(&v.File, "voice", params, nil)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
@ -233,6 +227,7 @@ func (v *VideoNote) Send(b *Bot, to Recipient, opt *SendOptions) (*Message, erro
|
|
|
|
params := map[string]string{
|
|
|
|
params := map[string]string{
|
|
|
|
"chat_id": to.Recipient(),
|
|
|
|
"chat_id": to.Recipient(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
b.embedSendOptions(params, opt)
|
|
|
|
|
|
|
|
|
|
|
|
if v.Duration != 0 {
|
|
|
|
if v.Duration != 0 {
|
|
|
|
params["duration"] = strconv.Itoa(v.Duration)
|
|
|
|
params["duration"] = strconv.Itoa(v.Duration)
|
|
|
@ -241,8 +236,6 @@ func (v *VideoNote) Send(b *Bot, to Recipient, opt *SendOptions) (*Message, erro
|
|
|
|
params["length"] = strconv.Itoa(v.Length)
|
|
|
|
params["length"] = strconv.Itoa(v.Length)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
b.embedSendOptions(params, opt)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
msg, err := b.sendObject(&v.File, "videoNote", params, thumbnailToFilemap(v.Thumbnail))
|
|
|
|
msg, err := b.sendObject(&v.File, "videoNote", params, thumbnailToFilemap(v.Thumbnail))
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
return nil, err
|
|
|
|