✨ Added SendMediaGroup method
This commit is contained in:
parent
5728480437
commit
0a7ea40b72
34
send_media_group.go
Normal file
34
send_media_group.go
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
package telegram
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
json "github.com/pquerna/ffjson/ffjson"
|
||||||
|
http "github.com/valyala/fasthttp"
|
||||||
|
)
|
||||||
|
|
||||||
|
// SendMediaGroup send a group of photos or videos as an album. On success, an array of the sent
|
||||||
|
// Messages is returned.
|
||||||
|
func (bot *Bot) SendMediaGroup(chatID int64, media []InputFile, replyToMessageID int, disableNotification bool) ([]*Message, error) {
|
||||||
|
args := http.AcquireArgs()
|
||||||
|
args.Add("chat_id", strconv.FormatInt(chatID, 10))
|
||||||
|
args.Add("disable_notification", strconv.FormatBool(disableNotification))
|
||||||
|
|
||||||
|
if replyToMessageID != 0 {
|
||||||
|
args.Add("reply_to_message_id", strconv.Itoa(replyToMessageID))
|
||||||
|
}
|
||||||
|
|
||||||
|
dst, err := json.Marshal(media)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
resp, err := bot.request(dst, "sendMediaGroup", args)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var data []*Message
|
||||||
|
err = json.Unmarshal(*resp.Result, &data)
|
||||||
|
return data, err
|
||||||
|
}
|
2
types.go
2
types.go
|
@ -39,6 +39,8 @@ const (
|
||||||
MimePDF = "application/pdf"
|
MimePDF = "application/pdf"
|
||||||
MimeZIP = "application/zip"
|
MimeZIP = "application/zip"
|
||||||
|
|
||||||
|
PrefixAttach = "attach://"
|
||||||
|
|
||||||
StatusAdministrator = "administrator"
|
StatusAdministrator = "administrator"
|
||||||
StatusCreator = "creator"
|
StatusCreator = "creator"
|
||||||
StatusKicked = "kicked"
|
StatusKicked = "kicked"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user