diff options
| author | Maiddog <[email protected]> | 2017-08-26 17:55:43 -0500 |
|---|---|---|
| committer | alex <[email protected]> | 2017-08-27 00:55:43 +0200 |
| commit | 3e0b1032d80a1847558a752e8316d97f9ae58f04 (patch) | |
| tree | ca65390091cb3c0ab98b6497a1447ba69df3d20d /src/model/channel/message.rs | |
| parent | Use `$crate` for `Args` (diff) | |
| download | serenity-3e0b1032d80a1847558a752e8316d97f9ae58f04.tar.xz serenity-3e0b1032d80a1847558a752e8316d97f9ae58f04.zip | |
Add ability to play DCA and Opus files. (#148)
Diffstat (limited to 'src/model/channel/message.rs')
| -rw-r--r-- | src/model/channel/message.rs | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/model/channel/message.rs b/src/model/channel/message.rs index 399d351..27f4e31 100644 --- a/src/model/channel/message.rs +++ b/src/model/channel/message.rs @@ -291,9 +291,10 @@ impl Message { } // And finally replace everyone and here mentions. - result - .replace("@everyone", "@\u{200B}everyone") - .replace("@here", "@\u{200B}here") + result.replace("@everyone", "@\u{200B}everyone").replace( + "@here", + "@\u{200B}here", + ) } /// Gets the list of [`User`]s who have reacted to a [`Message`] with a @@ -319,8 +320,12 @@ impl Message { after: Option<U>) -> Result<Vec<User>> where R: Into<ReactionType>, U: Into<UserId> { - self.channel_id - .reaction_users(self.id, reaction_type, limit, after) + self.channel_id.reaction_users( + self.id, + reaction_type, + limit, + after, + ) } /// Returns the associated `Guild` for the message if one is in the cache. @@ -333,8 +338,9 @@ impl Message { /// [`guild_id`]: #method.guild_id #[cfg(feature = "cache")] pub fn guild(&self) -> Option<Arc<RwLock<Guild>>> { - self.guild_id() - .and_then(|guild_id| CACHE.read().unwrap().guild(guild_id)) + self.guild_id().and_then(|guild_id| { + CACHE.read().unwrap().guild(guild_id) + }) } /// Retrieves the Id of the guild that the message was sent in, if sent in @@ -354,7 +360,8 @@ impl Message { #[cfg(feature = "cache")] pub fn is_private(&self) -> bool { match CACHE.read().unwrap().channel(self.channel_id) { - Some(Channel::Group(_)) | Some(Channel::Private(_)) => true, + Some(Channel::Group(_)) | + Some(Channel::Private(_)) => true, _ => false, } } @@ -371,11 +378,7 @@ impl Message { let count = content.chars().count() as i64; let diff = count - (constants::MESSAGE_CODE_LIMIT as i64); - if diff > 0 { - Some(diff as u64) - } else { - None - } + if diff > 0 { Some(diff as u64) } else { None } } /// Pins this message to its channel. |