aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAustin Hellyer <[email protected]>2016-12-18 12:26:50 -0800
committerAustin Hellyer <[email protected]>2016-12-18 12:26:50 -0800
commit42290348bc05c876b7e70c570a485160e594e098 (patch)
treefb36e7419e36c3ca4c8690665a9f7d77899b06e2 /src
parentDefault Framework command use_quotes to false (diff)
downloadserenity-42290348bc05c876b7e70c570a485160e594e098.tar.xz
serenity-42290348bc05c876b7e70c570a485160e594e098.zip
Fix Message::delete()
Diffstat (limited to 'src')
-rw-r--r--src/model/channel.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/model/channel.rs b/src/model/channel.rs
index d769016..90fcc50 100644
--- a/src/model/channel.rs
+++ b/src/model/channel.rs
@@ -420,12 +420,6 @@ impl Group {
}
impl Message {
- /// True only if message was sent using a webhook.
- #[cfg(feature="methods")]
- pub fn is_webhook(&self) -> bool {
- self.webhook_id.is_some()
- }
-
/// Deletes the message.
///
/// **Note**: The logged in user must either be the author of the message or
@@ -446,7 +440,7 @@ impl Message {
pub fn delete(&self) -> Result<()> {
feature_cache_enabled! {{
let req = permissions::MANAGE_MESSAGES;
- let is_author = self.author.id != CACHE.read().unwrap().user.id;
+ let is_author = self.author.id == CACHE.read().unwrap().user.id;
let has_perms = utils::user_has_perms(self.channel_id, req)?;
if !is_author && !has_perms {
@@ -578,6 +572,12 @@ impl Message {
}
}
+ /// True only if message was sent using a webhook.
+ #[cfg(feature="methods")]
+ pub fn is_webhook(&self) -> bool {
+ self.webhook_id.is_some()
+ }
+
/// Checks the length of a string to ensure that it is within Discord's
/// maximum message length limit.
///