Skip to content

Commit

Permalink
Add a util function for checking if a message was sent by the bot or …
Browse files Browse the repository at this point in the history
…someone else
  • Loading branch information
arqunis committed Jul 26, 2017
1 parent bd05bda commit 5a96724
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/model/channel/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ impl Message {
CACHE.read().unwrap().channel(self.channel_id)
}

/// A util function for determining whether this message was sent by someone else, or the bot.
#[cfg(all(feature="cache", feature="utils"))]
pub fn is_current_user(&self) -> bool {
self.author.id == CACHE.read().unwrap().id
}

/// Deletes the message.
///
/// **Note**: The logged in user must either be the author of the message or
Expand Down

0 comments on commit 5a96724

Please sign in to comment.