From a45292611ef6a5811fc86ed53a0595a30545ddec Mon Sep 17 00:00:00 2001 From: August Date: Tue, 26 May 2026 22:49:41 -0400 Subject: [PATCH] Fixed AI bullying feature --- Cargo.lock | 1 + Cargo.toml | 3 ++- src/definitions.rs | 27 +++++++++++++++++++++++++-- src/event_handlers.rs | 1 - src/main.rs | 2 -- 5 files changed, 28 insertions(+), 6 deletions(-) delete mode 100644 src/event_handlers.rs diff --git a/Cargo.lock b/Cargo.lock index 334f525..4719902 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2711,6 +2711,7 @@ dependencies = [ "structstruck", "tempfile", "tokio", + "url", "vergen", "zip", ] diff --git a/Cargo.toml b/Cargo.toml index bb6b578..d83de44 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,8 @@ self-replace = { version = "1.5.0", optional = true } zip = { version = "7.2.0", optional = true } nix = { version = "0.31.1", features = ["process"], optional = true } minreq = { version = "2.14.0", features = ["https"], optional = true } +url = "2.5.8" [features] -self-update=["octocrab", "tempfile", "self-replace", "zip", "nix", "minreq"] \ No newline at end of file +self-update=["octocrab", "tempfile", "self-replace", "zip", "nix", "minreq"] diff --git a/src/definitions.rs b/src/definitions.rs index 4c6885e..85dc6d6 100644 --- a/src/definitions.rs +++ b/src/definitions.rs @@ -1,6 +1,17 @@ const SLOP_SCOUNDREL_SERVER_ID: u64 = 752667089155915846; const SLOP_SCOUNDREL_ROLE_ID: u64 = 1508961172223951078; +use rand::{self, seq::IndexedRandom}; + +const HATE: [&str; 6] = [ + "kys sloplord", + "you post slop stfu", + "go generate some hoes", + "can we kill this guy", + "are you dense", + "SHUUUUT UUUPPPPPPPP!!!!" +]; + #[allow(unused_imports)] use crate::settings::*; @@ -34,9 +45,21 @@ pub async fn event_handler( RoleId::new(SLOP_SCOUNDREL_ROLE_ID), ) .await - .unwrap() && !new_message.attachments.is_empty() + .unwrap() { - new_message.channel_id.say(ctx.http.clone(), "kys").await?; + // TODO: Find out why this is necessary + let real_message = new_message.channel(ctx.http.clone()).await.unwrap().guild().unwrap().message(ctx.http.clone(), new_message.id).await.unwrap(); + if !real_message.attachments.is_empty() + || !real_message.embeds.is_empty() + || real_message.content.contains("https://tenor.com/view") + { + + let message = { + let mut rng = rand::rng(); + HATE.choose(&mut rng).unwrap().to_string() + }; + new_message.channel_id.say(ctx.http.clone(), message).await?; + } } } } diff --git a/src/event_handlers.rs b/src/event_handlers.rs deleted file mode 100644 index 8b13789..0000000 --- a/src/event_handlers.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/main.rs b/src/main.rs index 923e9c4..554a594 100644 --- a/src/main.rs +++ b/src/main.rs @@ -40,8 +40,6 @@ use crate::command::{ util::*, }; -mod event_handlers; - // Path at which our settings are stored (currently PWD) //const SETTINGS_PATH: &str = "settings.json";