|
|
@ -1,6 +1,9 @@
|
|
|
|
package telebot
|
|
|
|
package telebot
|
|
|
|
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
import (
|
|
|
|
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"strconv"
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// Recipient is any possible endpoint you can send
|
|
|
|
// Recipient is any possible endpoint you can send
|
|
|
|
// messages to: either user, group or a channel.
|
|
|
|
// messages to: either user, group or a channel.
|
|
|
@ -43,7 +46,14 @@ func (a *Audio) 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(),
|
|
|
|
"caption": a.Caption,
|
|
|
|
"caption": a.Caption,
|
|
|
|
|
|
|
|
"performer": a.Performer,
|
|
|
|
|
|
|
|
"title": a.Title,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if a.Duration != 0 {
|
|
|
|
|
|
|
|
params["duration"] = strconv.Itoa(a.Duration)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
embedSendOptions(params, opt)
|
|
|
|
embedSendOptions(params, opt)
|
|
|
|
|
|
|
|
|
|
|
|
msg, err := b.sendObject(&a.File, "audio", params)
|
|
|
|
msg, err := b.sendObject(&a.File, "audio", params)
|
|
|
@ -62,7 +72,13 @@ func (d *Document) 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(),
|
|
|
|
"caption": d.Caption,
|
|
|
|
"caption": d.Caption,
|
|
|
|
|
|
|
|
"file_name": d.FileName,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if d.FileSize != 0 {
|
|
|
|
|
|
|
|
params["file_size"] = strconv.Itoa(d.FileSize)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
embedSendOptions(params, opt)
|
|
|
|
embedSendOptions(params, opt)
|
|
|
|
|
|
|
|
|
|
|
|
msg, err := b.sendObject(&d.File, "document", params)
|
|
|
|
msg, err := b.sendObject(&d.File, "document", params)
|
|
|
@ -100,6 +116,20 @@ func (v *Video) Send(b *Bot, to Recipient, opt *SendOptions) (*Message, error) {
|
|
|
|
"chat_id": to.Recipient(),
|
|
|
|
"chat_id": to.Recipient(),
|
|
|
|
"caption": v.Caption,
|
|
|
|
"caption": v.Caption,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if v.Duration != 0 {
|
|
|
|
|
|
|
|
params["duration"] = strconv.Itoa(v.Duration)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if v.Width != 0 {
|
|
|
|
|
|
|
|
params["width"] = strconv.Itoa(v.Width)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if v.Height != 0 {
|
|
|
|
|
|
|
|
params["height"] = strconv.Itoa(v.Height)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if v.SupportsStreaming {
|
|
|
|
|
|
|
|
params["supports_streaming"] = "true"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
embedSendOptions(params, opt)
|
|
|
|
embedSendOptions(params, opt)
|
|
|
|
|
|
|
|
|
|
|
|
msg, err := b.sendObject(&v.File, "video", params)
|
|
|
|
msg, err := b.sendObject(&v.File, "video", params)
|
|
|
@ -127,6 +157,11 @@ 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(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if v.Duration != 0 {
|
|
|
|
|
|
|
|
params["duration"] = strconv.Itoa(v.Duration)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
embedSendOptions(params, opt)
|
|
|
|
embedSendOptions(params, opt)
|
|
|
|
|
|
|
|
|
|
|
|
msg, err := b.sendObject(&v.File, "voice", params)
|
|
|
|
msg, err := b.sendObject(&v.File, "voice", params)
|
|
|
@ -145,6 +180,14 @@ 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(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if v.Duration != 0 {
|
|
|
|
|
|
|
|
params["duration"] = strconv.Itoa(v.Duration)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if v.Length != 0 {
|
|
|
|
|
|
|
|
params["length"] = strconv.Itoa(v.Length)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
embedSendOptions(params, opt)
|
|
|
|
embedSendOptions(params, opt)
|
|
|
|
|
|
|
|
|
|
|
|
msg, err := b.sendObject(&v.File, "videoNote", params)
|
|
|
|
msg, err := b.sendObject(&v.File, "videoNote", params)
|
|
|
@ -185,6 +228,7 @@ func (v *Venue) Send(b *Bot, to Recipient, opt *SendOptions) (*Message, error) {
|
|
|
|
"title": v.Title,
|
|
|
|
"title": v.Title,
|
|
|
|
"address": v.Address,
|
|
|
|
"address": v.Address,
|
|
|
|
"foursquare_id": v.FoursquareID,
|
|
|
|
"foursquare_id": v.FoursquareID,
|
|
|
|
|
|
|
|
"foursquare_type": v.FoursquareType,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
embedSendOptions(params, opt)
|
|
|
|
embedSendOptions(params, opt)
|
|
|
|
|
|
|
|
|
|
|
|