aboutsummaryrefslogtreecommitdiff
path: root/src/modules/commands/general/fun.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/commands/general/fun.rs')
-rw-r--r--src/modules/commands/general/fun.rs26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/modules/commands/general/fun.rs b/src/modules/commands/general/fun.rs
index 31deeeb..eb3c1e1 100644
--- a/src/modules/commands/general/fun.rs
+++ b/src/modules/commands/general/fun.rs
@@ -12,6 +12,7 @@ use serenity::framework::standard::{
use serenity::model::channel::Message;
use serenity::prelude::Context;
use std::sync::Arc;
+use crate::core::utils::check_mentions;
lazy_static! {
static ref DICE_MATCH: Regex = Regex::new(r"(?P<count>\d+)d?(?P<sides>\d*)").expect("Failed to create Regex");
@@ -29,9 +30,9 @@ impl Command for Clapify {
}
fn execute(&self, _: &mut Context, message: &Message, args: Args) -> Result<(), CommandError> {
- if !message.mentions.is_empty() {
- message.channel_id.say("Sorry, but I can only clapify non-human things!")?;
- return Ok(());
+ if check_mentions(message) {
+ message.channel_id.say(MENTION_FAIL)?;
+ return Ok(())
}
let to_say = args;
@@ -190,10 +191,11 @@ impl Command for Opinion {
}
fn execute(&self, _ctx: &mut Context, message: &Message, args: Args) -> Result<(), CommandError> {
- if message.mentions.len() > 1 {
- message.channel_id.say("I can't give my opinion on everyone all at once!")?;
- return Ok(());
+ if check_mentions(message) {
+ message.channel_id.say(MENTION_FAIL)?;
+ return Ok(())
}
+
let random = thread_rng().gen_bool(5.4);
// TODO: Make this an embed eventually.
if random {
@@ -222,9 +224,9 @@ impl Command for Rate {
}
fn execute(&self, _ctx: &mut Context, message: &Message, args: Args) -> Result<(), CommandError> {
- if message.mentions.len() > 1 {
- message.channel_id.say("I can't rate everyone at once!")?;
- return Ok(());
+ if check_mentions(message) {
+ message.channel_id.say(MENTION_FAIL)?;
+ return Ok(())
}
let random = thread_rng().gen_range(1, 10);
@@ -273,9 +275,9 @@ impl Command for Uwufy {
}
fn execute(&self, _: &mut Context, message: &Message, args: Args) -> Result<(), CommandError> {
- if !message.mentions.is_empty() {
- message.channel_id.say("Try again, but next time, don't tag anyone please.")?;
- return Ok(());
+ if check_mentions(message) {
+ message.channel_id.say(MENTION_FAIL)?;
+ return Ok(())
}
let to_say = args;