diff --git a/channel.go b/channel.go index 1f0b23eb..64b14357 100644 --- a/channel.go +++ b/channel.go @@ -283,10 +283,15 @@ func (c *Channel) SendMsg(client MessageSender, message *Message) (msg *Message, err = newErrorMissingSnowflake("snowflake ID not set for channel") return } + nonce := fmt.Sprint(message.Nonce) + if len(nonce) > 25 { + return nil, errors.New("nonce can not be longer than 25 characters") + } + message.RLock() params := &CreateMessageParams{ Content: message.Content, - Nonce: message.Nonce, // THIS IS A STRING. NOT A SNOWFLAKE! DONT TOUCH! + Nonce: nonce, // THIS IS A STRING. NOT A SNOWFLAKE! DONT TOUCH! Tts: message.Tts, // File: ... // Embed: ... diff --git a/iface_reseter_gen.go b/iface_reseter_gen.go index 2f350a68..f0bd9668 100644 --- a/iface_reseter_gen.go +++ b/iface_reseter_gen.go @@ -114,7 +114,7 @@ func (m *Message) Reset() { m.Attachments = nil m.Embeds = nil m.Reactions = nil - m.Nonce = "" + m.Nonce = nil m.Pinned = false m.WebhookID = 0 m.Type = 0 diff --git a/internal/constant/version.go b/internal/constant/version.go index 39253d63..52dd05eb 100644 --- a/internal/constant/version.go +++ b/internal/constant/version.go @@ -1,3 +1,3 @@ package constant -const Version = "v0.13.0" +const Version = "v0.14.0" diff --git a/message.go b/message.go index 80f320d2..3920a8f9 100644 --- a/message.go +++ b/message.go @@ -122,7 +122,7 @@ type Message struct { Attachments []*Attachment `json:"attachments"` Embeds []*Embed `json:"embeds"` Reactions []*Reaction `json:"reactions"` // ? - Nonce string `json:"nonce"` // THIS IS A STRING. NOT A SNOWFLAKE! DONT TOUCH! + Nonce interface{} `json:"nonce"` // NOT A SNOWFLAKE! DONT TOUCH! Pinned bool `json:"pinned"` WebhookID Snowflake `json:"webhook_id"` // ? Type MessageType `json:"type"` @@ -312,11 +312,16 @@ func (m *Message) Send(client MessageSender, flags ...Flag) (msg *Message, err e if constant.LockedMethods { m.RLock() } + nonce := fmt.Sprint(m.Nonce) + if len(nonce) > 25 { + return nil, errors.New("nonce can not be more than 25 characters") + } + // TODO: attachments params := &CreateMessageParams{ Content: m.Content, Tts: m.Tts, - Nonce: m.Nonce, + Nonce: nonce, // File: ... // Embed: ... }