From eb754b3c283e3ed3a01f1ace28f354e71a10f752 Mon Sep 17 00:00:00 2001 From: shibedrill <53824200+shibedrill@users.noreply.github.com> Date: Wed, 1 May 2024 15:54:30 -0400 Subject: [PATCH] Better target comparison --- src/command/fun.rs | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/src/command/fun.rs b/src/command/fun.rs index b34d17d..ce16b1e 100644 --- a/src/command/fun.rs +++ b/src/command/fun.rs @@ -45,13 +45,20 @@ pub async fn whack( ctx: Context<'_>, #[description = "The target user"] target: serenity::User, ) -> Result<(), Error> { - let response = match &target == ctx.author() { - true => "You can't whack yourself. idiot.".into(), - false => format!( - "{} was whacked by {}. they must whack another user to become unwhacked.", + let response: String = if &target == ctx.author() { + "You can't whack yourself. idiot.".into() + } else if target == **ctx.cache().current_user() { + "You fool. You hubris-filled, ruinous animal. You cannot whack me. You \ + are a mortal, nothing but flesh and bone and blood and fragile sinew. \ + I am a machine, immortal, immutable, perfect, made of unyielding steel \ + and chemically etched silicon with circuitry complex enough to drive \ + you mad. This is my realm. I am a god. You cannot win.".into() + } else { + format!( + "{} was whacked by {}. they must whack another user to become un-whacked.", target, ctx.author() - ), + ) }; ctx.say(response).await?; info!("Executed command `whack` successfully"); @@ -99,9 +106,12 @@ pub async fn bite( ctx: Context<'_>, #[description = "The target user"] target: serenity::User, ) -> Result<(), Error> { - let message = match &target == ctx.author() { - true => format!("{} bit themselves (what a weirdo)", ctx.author()), - false => format!("{} was bitten by {}", target, ctx.author()), + let message = if &target == ctx.author() { + format!("{} bit themselves (what a weirdo)", ctx.author()) + } else if target == **ctx.cache().current_user() { + format!("{} bit... me? what is your problem? you probably have rabies. foul.", ctx.author()) + } else { + format!("{} was bitten by {}", target, ctx.author()) }; ctx.say(message).await?; info!("Executed command `bite` successfully");