mirror of
https://github.com/diamondburned/arikawa.git
synced 2024-11-27 17:23:00 +00:00
API: verify Embed and AllowedMentions on message edit
This commit is contained in:
parent
55e9c28d37
commit
6c3b1e0c56
|
@ -1,6 +1,8 @@
|
||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"github.com/diamondburned/arikawa/discord"
|
"github.com/diamondburned/arikawa/discord"
|
||||||
"github.com/diamondburned/arikawa/utils/httputil"
|
"github.com/diamondburned/arikawa/utils/httputil"
|
||||||
"github.com/diamondburned/arikawa/utils/json/option"
|
"github.com/diamondburned/arikawa/utils/json/option"
|
||||||
|
@ -258,6 +260,18 @@ func (c *Client) EditMessage(
|
||||||
func (c *Client) EditMessageComplex(
|
func (c *Client) EditMessageComplex(
|
||||||
channelID, messageID discord.Snowflake, data EditMessageData) (*discord.Message, error) {
|
channelID, messageID discord.Snowflake, data EditMessageData) (*discord.Message, error) {
|
||||||
|
|
||||||
|
if data.AllowedMentions != nil {
|
||||||
|
if err := data.AllowedMentions.Verify(); err != nil {
|
||||||
|
return nil, errors.Wrap(err, "allowedMentions error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if data.Embed != nil {
|
||||||
|
if err := data.Embed.Validate(); err != nil {
|
||||||
|
return nil, errors.Wrap(err, "embed error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var msg *discord.Message
|
var msg *discord.Message
|
||||||
return msg, c.RequestJSON(
|
return msg, c.RequestJSON(
|
||||||
&msg, "PATCH",
|
&msg, "PATCH",
|
||||||
|
|
Loading…
Reference in a new issue