aboutsummaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-12-15 14:33:21 -0800
committerZeyla Hellyer <[email protected]>2017-12-15 14:34:10 -0800
commit99d17d2975143b0d588c969f7ae6f8d11e62a9e1 (patch)
tree74ea2a369180ee343b285cb1c0394f1c8161313a /src/model
parentChange type of a couple Guild/PartialGuild fields (diff)
downloadserenity-99d17d2975143b0d588c969f7ae6f8d11e62a9e1.tar.xz
serenity-99d17d2975143b0d588c969f7ae6f8d11e62a9e1.zip
Fix deserialization of `Guild::application_id`
Fix the deserialization of the `Guild::application_id` structfield. Additionally, create a new ID type for it. A test has been added for this.
Diffstat (limited to 'src/model')
-rw-r--r--src/model/guild/mod.rs4
-rw-r--r--src/model/mod.rs2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/model/guild/mod.rs b/src/model/guild/mod.rs
index b50988b..32b5ee2 100644
--- a/src/model/guild/mod.rs
+++ b/src/model/guild/mod.rs
@@ -49,7 +49,7 @@ pub struct Guild {
/// channel before being moved to an AFK channel -- if one exists.
pub afk_timeout: u64,
/// Application ID of the guild creator if it is bot-created.
- pub application_id: Option<u64>,
+ pub application_id: Option<ApplicationId>,
/// All voice and text channels contained within a guild.
///
/// This contains all channels regardless of permissions (i.e. the ability
@@ -1427,7 +1427,7 @@ impl<'de> Deserialize<'de> for Guild {
.and_then(u64::deserialize)
.map_err(DeError::custom)?;
let application_id = match map.remove("application_id") {
- Some(v) => serde_json::from_value::<Option<u64>>(v)
+ Some(v) => serde_json::from_value::<Option<ApplicationId>>(v)
.map_err(DeError::custom)?,
None => None,
};
diff --git a/src/model/mod.rs b/src/model/mod.rs
index 7a7a007..1dd5192 100644
--- a/src/model/mod.rs
+++ b/src/model/mod.rs
@@ -105,6 +105,8 @@ macro_rules! id_u64 {
}
id_u64! {
+ /// An identifier for an Application.
+ ApplicationId;
/// An identifier for a Channel
ChannelId;
/// An identifier for an Emoji