fixed: @everyone ping bypass

This commit is contained in:
Moritz Roßbacher 2023-10-24 15:10:24 +02:00
parent 3938c1f257
commit 021b2e0dc5
4 changed files with 13 additions and 2 deletions

1
Cargo.lock generated
View file

@ -2853,6 +2853,7 @@ dependencies = [
"anyhow", "anyhow",
"env_logger", "env_logger",
"poise", "poise",
"regex",
"serenity", "serenity",
"shuttle-poise", "shuttle-poise",
"shuttle-runtime", "shuttle-runtime",

View file

@ -15,3 +15,4 @@ shuttle-poise = "0.30.0"
shuttle-runtime = "0.30.0" shuttle-runtime = "0.30.0"
anyhow = "1.0.75" anyhow = "1.0.75"
tracing = "0.1.40" tracing = "0.1.40"
regex = "1.10.2"

View file

@ -96,7 +96,13 @@ pub(crate) async fn lfg(
} }
); );
if note.is_some() { 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 if let Err(why) = ctx

View file

@ -31,8 +31,11 @@ async fn poise(
) -> ShuttlePoise<Data, Error> { ) -> ShuttlePoise<Data, Error> {
let options = poise::FrameworkOptions { let options = poise::FrameworkOptions {
/*
COMMANDS:
*/
commands: vec![ commands: vec![
commands::lfg::lfg(), commands::lfg::lfg()
], ],
prefix_options: poise::PrefixFrameworkOptions { prefix_options: poise::PrefixFrameworkOptions {
prefix: Some("~".into()), prefix: Some("~".into()),