diff options
| author | acdenisSK <[email protected]> | 2017-07-26 03:57:16 +0200 |
|---|---|---|
| committer | acdenisSK <[email protected]> | 2017-07-26 03:58:32 +0200 |
| commit | 5a967241efabd49116a6d6d5a6eeb95d3281d93b (patch) | |
| tree | 2d5ab01f5bd56d3c3c68d2244b6351918c5cd9de /src/model | |
| parent | Remove the code meant for debugging (diff) | |
| download | serenity-5a967241efabd49116a6d6d5a6eeb95d3281d93b.tar.xz serenity-5a967241efabd49116a6d6d5a6eeb95d3281d93b.zip | |
Add a util function for checking if a message was sent by the bot or someone else
Diffstat (limited to 'src/model')
| -rw-r--r-- | src/model/channel/message.rs | 6 |
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 |