feat(commands/utils): updating the ping to be on help menu

This commit is contained in:
Raphael 2026-02-16 15:26:46 +01:00
parent e2c98386db
commit 5cd072e0e7
No known key found for this signature in database

View file

@ -1,7 +1,16 @@
use std::time::Instant; use std::{
sync::atomic::{
AtomicU64,
},
time::Instant,
};
use crate::commands::{CommandEntry, SlashCommand}; use crate::{
use crate::config::EmojiConfig; commands::{
CommandCategory, CommandEntry, SlashCommand
},
config::EmojiConfig,
};
use serenity::all::{ use serenity::all::{
CommandInteraction, Context, CreateCommand, CreateInteractionResponse, CommandInteraction, Context, CreateCommand, CreateInteractionResponse,
@ -9,7 +18,17 @@ use serenity::all::{
}; };
use sqlx::PgPool; use sqlx::PgPool;
pub struct Ping; pub struct Ping {
pub command_id: AtomicU64,
}
impl Ping {
pub fn new() -> Self {
Self {
command_id: AtomicU64::new(0),
}
}
}
#[serenity::async_trait] #[serenity::async_trait]
impl SlashCommand for Ping { impl SlashCommand for Ping {
@ -21,6 +40,14 @@ impl SlashCommand for Ping {
"Show the Discord API latency" "Show the Discord API latency"
} }
fn category(&self) -> &'static CommandCategory {
&CommandCategory::Utils
}
fn command_id_ref(&self) -> &AtomicU64 {
&self.command_id
}
fn register(&self) -> CreateCommand { fn register(&self) -> CreateCommand {
println!("\t✅ | {}", self.name()); println!("\t✅ | {}", self.name());
CreateCommand::new(self.name()).description(self.description()) CreateCommand::new(self.name()).description(self.description())
@ -53,5 +80,5 @@ impl SlashCommand for Ping {
} }
inventory::submit! { inventory::submit! {
CommandEntry { create: || Box::new(Ping) } CommandEntry { create: || Box::new(Ping::new()) }
} }