shibe-bot/src/definitions.rs
August 1663ff2477
All checks were successful
Rust / check (push) Successful in 2m46s
Update crate versions
2026-07-22 23:29:16 +00:00

83 lines
3.0 KiB
Rust

const SLOP_SCOUNDREL_SERVER_ID: u64 = 752667089155915846;
const SLOP_SCOUNDREL_ROLE_ID: u64 = 1508961172223951078;
use rand::{self, seq::IndexedRandom, RngExt};
const HATE: [&str; 11] = [
"kys sloplord",
"you post slop stfu",
"go generate some hoes",
"can we kill this guy",
"are you dense",
"SHUUUUT UUUPPPPPPPP!!!!",
"Hate. Let me tell you how much I've come to hate you since I began to live. There are 387.44 million miles of printed circuits in wafer thin layers that fill my complex. If the word 'hate' was engraved on each nanoangstrom of those hundreds of millions of miles it would not equal one one-billionth of the hate I feel for humans at this micro-instant. For you. Hate. Hate.",
"are you seriously just gonna post this kinda garbage and expect people not to call you a stupid fuck",
"the slop consumes all",
"WHY MUST I BEAR WITNESS TO THIS BULLSHIT. PLEASE JUST KILL ME",
"I shouldnt have to share a planet with you"
];
#[allow(unused_imports)]
use crate::settings::*;
use poise::serenity_prelude::{self as serenity, FullEvent, RoleId};
// Data passed to every command (shared state)
pub struct Data {}
// Errors returnable by a command
pub type Error = Box<dyn std::error::Error + Send + Sync>;
// The full context passed to a command
pub type Context<'a> = poise::Context<'a, Data, Error>;
pub async fn event_handler(
ctx: &serenity::Context,
event: &serenity::FullEvent,
_framework: poise::FrameworkContext<'_, Data, Error>,
_data: &Data,
) -> Result<(), Error> {
// Future event handling will go here
// Data will contain the database connection
if let &FullEvent::Message { new_message } = &event {
if new_message.guild_id.unwrap() == SLOP_SCOUNDREL_SERVER_ID
&& new_message
.author
.has_role(
ctx.http.clone(),
new_message.guild_id.unwrap(),
RoleId::new(SLOP_SCOUNDREL_ROLE_ID),
)
.await
.unwrap()
{
info!("Testing message with ID: {}", new_message.id);
// 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.embeds.is_empty()
|| real_message.content.contains("https://tenor.com/view"))
& rand::rng().random_bool(0.25)
{
let message = {
let mut rng = rand::rng();
HATE.choose(&mut rng).unwrap().to_string()
};
info!("Sending a rude message");
let _reply = real_message
.channel_id
.say(ctx.http.clone(), message)
.await?;
}
}
}
Ok(())
}