Added stickers to type MessageSend (#1340)
* Added stickers to type MessageSend * Update restapi.go Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com> * Update message.go Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com> --------- Co-authored-by: Fedor Lapshin <fe.lap.prog@gmail.com>
This commit is contained in:
parent
cd4f875097
commit
b7c431c368
2 changed files with 8 additions and 1 deletions
|
@ -233,6 +233,7 @@ type MessageSend struct {
|
|||
Files []*File `json:"-"`
|
||||
AllowedMentions *MessageAllowedMentions `json:"allowed_mentions,omitempty"`
|
||||
Reference *MessageReference `json:"message_reference,omitempty"`
|
||||
StickerIDs []string `json:"sticker_ids"`
|
||||
|
||||
// TODO: Remove this when compatibility is not required.
|
||||
File *File `json:"-"`
|
||||
|
|
|
@ -1700,13 +1700,19 @@ func (s *Session) ChannelMessageSendComplex(channelID string, data *MessageSend,
|
|||
}
|
||||
}
|
||||
|
||||
if data.StickerIDs != nil {
|
||||
if len(data.StickerIDs) > 3 {
|
||||
err = fmt.Errorf("cannot send more than 3 stickers")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
var response []byte
|
||||
if len(files) > 0 {
|
||||
contentType, body, encodeErr := MultipartBodyWithJSON(data, files)
|
||||
if encodeErr != nil {
|
||||
return st, encodeErr
|
||||
}
|
||||
|
||||
response, err = s.request("POST", endpoint, contentType, body, endpoint, 0, options...)
|
||||
} else {
|
||||
response, err = s.RequestWithBucketID("POST", endpoint, data, endpoint, options...)
|
||||
|
|
Loading…
Reference in a new issue