aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/model/channel/message.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/model/channel/message.rs b/src/model/channel/message.rs
index 372c3de..3298305 100644
--- a/src/model/channel/message.rs
+++ b/src/model/channel/message.rs
@@ -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