From 51e95d3f9377a1a9e75b7e7baac2afc848a92ff0 Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 16 Feb 2026 15:29:57 +0100 Subject: [PATCH] feat(commands/mod): adding the category for help command - adding stuff to take command variable --- src/commands/mod.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/commands/mod.rs b/src/commands/mod.rs index cb6ff3c..91cb0be 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1,3 +1,5 @@ +use std::sync::atomic::{AtomicU64, Ordering}; + use serenity::all::{CommandInteraction, Context, CreateCommand}; use sqlx::PgPool; @@ -5,10 +7,42 @@ use crate::config::EmojiConfig; include!("./mod_gen.rs"); +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +pub enum CommandCategory { + Moderation, + Utils, +} + +impl CommandCategory { + pub fn emoji(&self) -> &'static str { + match self { + Self::Utils => "🌐", + Self::Moderation => "🛡️", + } + } + + pub fn name(&self) -> &'static str { + match self { + Self::Utils => "Utils", + Self::Moderation => "Moderation", + } + } +} + #[serenity::async_trait] pub trait SlashCommand: Send + Sync { fn name(&self) -> &'static str; fn description(&self) -> &'static str; + fn category(&self) -> &'static CommandCategory; + fn command_id_ref(&self) -> &AtomicU64; + + fn get_id(&self) -> u64 { + self.command_id_ref().load(Ordering::Relaxed) + } + + fn set_id(&self, id: u64) { + self.command_id_ref().store(id, Ordering::Relaxed); + } fn register(&self) -> CreateCommand;