aboutsummaryrefslogtreecommitdiff
path: root/src/model/channel
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-06-23 11:15:46 -0700
committerZeyla Hellyer <[email protected]>2017-06-23 11:15:46 -0700
commitc832009eae235881815186f740b716e0b7e63951 (patch)
tree72e0c4398935e9be9e6b8485bc28a496a5a076b2 /src/model/channel
parentUpdate max embed length (diff)
downloadserenity-c832009eae235881815186f740b716e0b7e63951.tar.xz
serenity-c832009eae235881815186f740b716e0b7e63951.zip
Make Message::nonce a serde_json::Value
Nonces can actually be almost anything - including booleans - so just use a Value to represent it since very few users will need it. This fixes errors like: ``` WARN:serenity::internal::ws_impl: (╯°□°)╯︵ ┻━┻ Error decoding: {"t":"MESSAGE_CREATE","s":12187872,"op":0,"d":{"type":0,"tts":false,"timestamp":"2017-06-01T01:00:00.000000+00:00","pinned":false,"nonce":"","mentions":[{"username":"redacted","id":"redacted","discriminator":"redacted","avatar":"redacted"}],"mention_roles":[],"mention_everyone":false,"id":"redacted","embeds":[],"edited_timestamp":null,"content":"redacted","channel_id":"redacted","author":{"username":"redacted","id":"redacted","discriminator":"redacted","bot":true,"avatar":"redacted"},"attachments":[]}} ERROR:serenity::client: Shard handler received err: Json(ErrorImpl { code: Message("Unknown i64 value: "), line: 0, column: 0 }) ``` and: ``` WARN:serenity::internal::ws_impl: (╯°□°)╯︵ ┻━┻ Error decoding: {"t":"MESSAGE_CREATE","s":1001192,"op":0,"d":{"type":0,"tts":false,"timestamp":"2017-06-01T01:01:01.000000+00:00","pinned":false,"nonce":true,"mentions":[],"mention_roles":[],"mention_everyone":false,"id":"redacted","embeds":[],"edited_timestamp":null,"content":"bork","channel_id":"redacted","author":{"username":"redacted","id":"redacted","discriminator":"redacted","bot":true,"avatar":"redacted"},"attachments":[]}} ERROR:serenity::client: Shard handler received err: Json(ErrorImpl { code: Message("invalid type: boolean `true`, expected identifier"), line: 0, column: 0 }) ```
Diffstat (limited to 'src/model/channel')
-rw-r--r--src/model/channel/message.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/model/channel/message.rs b/src/model/channel/message.rs
index 15200fe..89973d0 100644
--- a/src/model/channel/message.rs
+++ b/src/model/channel/message.rs
@@ -1,4 +1,5 @@
use chrono::{DateTime, FixedOffset};
+use serde_json::Value;
use ::model::*;
#[cfg(feature="cache")]
@@ -48,7 +49,8 @@ pub struct Message {
/// Array of users mentioned in the message.
pub mentions: Vec<User>,
/// Non-repeating number used for ensuring message order.
- pub nonce: Option<Snowflake>,
+ #[serde(default)]
+ pub nonce: Value,
/// Indicator of whether the message is pinned.
pub pinned: bool,
/// Array of reactions performed on the message.