silly goober bot

feat: kittysay

awesome way to abitarily inject my computor with a command to remove all
my files

+47 -6
+1
Cargo.lock
··· 114 114 "dotenv", 115 115 "humantime", 116 116 "poise", 117 + "regex", 117 118 "serenity", 118 119 "tokio", 119 120 ]
+1
Cargo.toml
··· 17 17 humantime = "2.1.0" 18 18 color-eyre = "0.6.3" 19 19 tokio = { version = "1.38.0", features = ["macros", "rt-multi-thread"] } 20 + regex = "1.10.5"
+10 -1
default.nix
··· 5 5 openssl, 6 6 darwin, 7 7 pkg-config, 8 + kittysay, 9 + makeWrapper, 8 10 rev ? "dirty", 9 11 }: 10 12 let ··· 28 30 cargoLock.lockFile = ./Cargo.lock; 29 31 30 32 buildInputs = 31 - [ openssl ] 33 + [ 34 + openssl 35 + makeWrapper 36 + ] 32 37 ++ lib.optionals stdenv.isDarwin ( 33 38 with darwin.apple_sdk.frameworks; 34 39 [ ··· 43 48 env = { 44 49 BUILD_REV = rev; 45 50 }; 51 + 52 + postInstall = '' 53 + wrapProgram "$out/bin/blahaj" --prefix PATH : "${lib.makeBinPath [ kittysay ]}" 54 + ''; 46 55 47 56 meta = { 48 57 inherit (p) description homepage;
+3 -3
flake.lock
··· 2 2 "nodes": { 3 3 "nixpkgs": { 4 4 "locked": { 5 - "lastModified": 1710795924, 6 - "narHash": "sha256-Cy5wSZkv1Ts0CD6Tk1mXMNE/Aa0+MGsKTRDak16qcoE=", 5 + "lastModified": 1717947220, 6 + "narHash": "sha256-aPidCRZUrnIGBkjlwSa8cgLvEYfWuiZXs0RkQ39hRtE=", 7 7 "owner": "NixOS", 8 8 "repo": "nixpkgs", 9 - "rev": "b081342f1c16e4cbe4f40f139bbdda1475ea306a", 9 + "rev": "926be0145878c2b29cd869b463ba1f6868f58e60", 10 10 "type": "github" 11 11 }, 12 12 "original": {
+4
shell.nix
··· 3 3 rustfmt, 4 4 callPackage, 5 5 rust-analyzer, 6 + kittysay, 6 7 }: 7 8 let 8 9 mainPkg = callPackage ./default.nix { }; ··· 13 14 clippy 14 15 rustfmt 15 16 rust-analyzer 17 + 18 + # runtime things for testing 19 + kittysay 16 20 ] ++ (oa.nativeBuildInputs or [ ]); 17 21 })
+23
src/commands/kittysay.rs
··· 1 + use color_eyre::eyre::Result; 2 + use regex::Regex; 3 + use std::process::Command; 4 + 5 + use crate::Context; 6 + 7 + /// Make the kitty say something :3 8 + #[poise::command(slash_command, guild_only)] 9 + pub async fn kittysay(ctx: Context<'_>, #[description = "speak"] input: String) -> Result<()> { 10 + print!("Please enter your message: "); 11 + 12 + let re = Regex::new(r"[^:a-zA-Z0-9\s]").unwrap(); 13 + let sanitized_input = re.replace_all(&input, "").to_string(); 14 + 15 + let output = Command::new("kittysay") 16 + .arg(&sanitized_input) 17 + .output() 18 + .expect("Failed to execute kittysay"); 19 + 20 + ctx.say(format!("```{}```", String::from_utf8_lossy(&output.stdout))) 21 + .await?; 22 + Ok(()) 23 + }
+1
src/commands/mod.rs
··· 1 1 pub mod avatar; 2 2 pub mod bot; 3 + pub mod kittysay; 3 4 pub mod ping;
+4 -2
src/main.rs
··· 26 26 27 27 let opts = poise::FrameworkOptions { 28 28 commands: vec![ 29 + commands::ping::ping(), 30 + commands::bot::botinfo(), 29 31 commands::avatar::avatar(), 30 - commands::bot::botinfo(), 31 - commands::ping::ping(), 32 + commands::kittysay::kittysay(), 32 33 ], 33 34 event_handler: |ctx, event, _, data| { 34 35 Box::pin(async move { ··· 54 55 serenity::GuildId::new(guild_id) 55 56 .set_commands(ctx, commands) 56 57 .await?; 58 + 57 59 Ok(Data {}) 58 60 }) 59 61 })