aboutsummaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2017-01-08 19:33:57 -0800
committerAustin Hellyer <[email protected]>2017-01-08 19:33:57 -0800
commit159496188b2c841a65829328cddafef620c517af (patch)
treebe6f8053b49791a05c608348958a1e08bfa92322 /src/model
parentAlphabetize model method names (diff)
downloadserenity-159496188b2c841a65829328cddafef620c517af.tar.xz
serenity-159496188b2c841a65829328cddafef620c517af.zip
Simplify Reaction::delete()
Diffstat (limited to 'src/model')
-rw-r--r--src/model/channel.rs19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/model/channel.rs b/src/model/channel.rs
index 4e1dfa6..27fac25 100644
--- a/src/model/channel.rs
+++ b/src/model/channel.rs
@@ -1212,7 +1212,7 @@ impl Reaction {
/// [permissions]: permissions
#[cfg(feature="methods")]
pub fn delete(&self) -> Result<()> {
- feature_cache! {{
+ let user_id = feature_cache! {{
let user = if self.user_id == CACHE.read().unwrap().user.id {
None
} else {
@@ -1233,16 +1233,15 @@ impl Reaction {
}
}
- rest::delete_reaction(self.channel_id.0,
- self.message_id.0,
- user,
- self.emoji.clone())
+ user
} else {
- rest::delete_reaction(self.channel_id.0,
- self.message_id.0,
- Some(self.user_id.0),
- self.emoji.clone())
- }}
+ Some(self.user_id.0)
+ }};
+
+ rest::delete_reaction(self.channel_id.0,
+ self.message_id.0,
+ user_id,
+ self.emoji.clone())
}
/// Retrieves the list of [`User`]s who have reacted to a [`Message`] with a