From 021b2e0dc503f7b4c23bee2ce42058c552645284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20Ro=C3=9Fbacher?= Date: Tue, 24 Oct 2023 15:10:24 +0200 Subject: [PATCH] fixed: @everyone ping bypass --- Cargo.lock | 1 + Cargo.toml | 1 + src/commands/lfg.rs | 8 +++++++- src/main.rs | 5 ++++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 179dcf3..b20330f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2853,6 +2853,7 @@ dependencies = [ "anyhow", "env_logger", "poise", + "regex", "serenity", "shuttle-poise", "shuttle-runtime", diff --git a/Cargo.toml b/Cargo.toml index 6da8f31..efcaf12 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,3 +15,4 @@ shuttle-poise = "0.30.0" shuttle-runtime = "0.30.0" anyhow = "1.0.75" tracing = "0.1.40" +regex = "1.10.2" diff --git a/src/commands/lfg.rs b/src/commands/lfg.rs index 3c1cb2d..aa4c2cc 100644 --- a/src/commands/lfg.rs +++ b/src/commands/lfg.rs @@ -96,7 +96,13 @@ pub(crate) async fn lfg( } ); if note.is_some() { - reply.push_str(format!("\nNote: {}", note.unwrap()).as_str()) + let t = note.unwrap(); + let regex = regex::Regex::new("(<@&?[0-9]*>)|(@everyone|@here)").unwrap(); + if regex.is_match(&t) { + reply = String::from("Your Note seems to match a ping <:Maark:1128577127931985950>"); + } else { + reply.push_str(format!("\nNote: `{}`", t).as_str()); + } } if let Err(why) = ctx diff --git a/src/main.rs b/src/main.rs index f6b096f..e799e6a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -31,8 +31,11 @@ async fn poise( ) -> ShuttlePoise { let options = poise::FrameworkOptions { +/* +COMMANDS: +*/ commands: vec![ - commands::lfg::lfg(), + commands::lfg::lfg() ], prefix_options: poise::PrefixFrameworkOptions { prefix: Some("~".into()),