aboutsummaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2018-04-27 08:05:56 -0700
committerZeyla Hellyer <[email protected]>2018-05-27 19:40:36 -0700
commitd94f6bd13fed8275c9c0c75b3a5d651e79365b95 (patch)
tree836f8c169174b709af34e132e84da8ae8eeb14fe /src/model
parentMake builders mutably borrowed (diff)
downloadserenity-d94f6bd13fed8275c9c0c75b3a5d651e79365b95.tar.xz
serenity-d94f6bd13fed8275c9c0c75b3a5d651e79365b95.zip
Add Rich Presence parsing support
Adds support for parsing Rich Presences. This can not be used for setting activities with bots. Upgrade path: Basically change your import and usage from `serenity::model::gateway::Game` to `serenity::model::gateway::Activity`.
Diffstat (limited to 'src/model')
-rw-r--r--src/model/gateway.rs21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/model/gateway.rs b/src/model/gateway.rs
index 1584633..385902a 100644
--- a/src/model/gateway.rs
+++ b/src/model/gateway.rs
@@ -295,14 +295,15 @@ pub struct ActivitySecrets {
pub spectate: Option<String>,
}
-#[derive(Clone, Copy, Debug)]
+/// The type of an activity.
+#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
pub enum ActivityType {
/// An indicator that the user is playing a game.
- Playing = 0,
+ Playing,
/// An indicator that the user is streaming to a service.
- Streaming = 1,
+ Streaming,
/// An indicator that the user is listening to something.
- Listening = 2,
+ Listening,
}
enum_number!(
@@ -405,12 +406,12 @@ impl<'de> Deserialize<'de> for Presence {
.map_err(DeError::custom)?;
Ok(Presence {
- activity: activity,
- last_modified: last_modified,
- nick: nick,
- status: status,
- user: user,
- user_id: user_id,
+ activity,
+ last_modified,
+ nick,
+ status,
+ user,
+ user_id,
})
}
}