diff options
| author | Fuwn <[email protected]> | 2020-11-05 10:39:57 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2020-11-05 10:39:57 -0800 |
| commit | 47187c8b34a9b0035a6b9d39a70959793aa6cf10 (patch) | |
| tree | c45a006e7886db00c00c06bfd248793e7acd9cc2 /src | |
| parent | fix: mention handling where it should be handled (diff) | |
| download | dep-core-next-47187c8b34a9b0035a6b9d39a70959793aa6cf10.tar.xz dep-core-next-47187c8b34a9b0035a6b9d39a70959793aa6cf10.zip | |
fix: mention parsing
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/utils.rs | 6 | ||||
| -rw-r--r-- | src/modules/commands/general/fun.rs | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/core/utils.rs b/src/core/utils.rs index 2a79366..88b6197 100644 --- a/src/core/utils.rs +++ b/src/core/utils.rs @@ -159,10 +159,14 @@ pub fn check_rank<T: AsRef<Vec<RoleId>>>(roles: Vec<i64>, member: T) -> bool { false } +/// Check if the passed message mentions someone other than the bot. +/// If multiple mentions occur, return `true`. pub fn check_mentions(message: &Message) -> bool { // Result<(), CommandError> + if message.content.contains("@everyone") + || message.content.contains("@here") { return true } if message.mentions.len() >= 1 { if message.mentions.len() == 1 { - if !message.mentions_user_id(BOT_ID) { return true } + if !message.mentions_user_id(BOT_BETA_ID) { return true } } else { return true } } false diff --git a/src/modules/commands/general/fun.rs b/src/modules/commands/general/fun.rs index eb3c1e1..fbcd7d5 100644 --- a/src/modules/commands/general/fun.rs +++ b/src/modules/commands/general/fun.rs @@ -34,6 +34,8 @@ impl Command for Clapify { message.channel_id.say(MENTION_FAIL)?; return Ok(()) } + // let mentions = message.mentions.len().to_owned(); + // println!("Mentions: {:?}, Content: {:?}", mentions, message.content); let to_say = args; let clapped = to_say.replace(" ", "🙏"); |