feat(commands/utils): adding the anyhow result return

This commit is contained in:
Raphael 2026-02-25 21:53:36 +01:00
parent 37eac33485
commit c3161ab949
No known key found for this signature in database

View file

@ -1,7 +1,4 @@
use std::{ use std::{
sync::atomic::{
AtomicU64,
},
time::Instant, time::Instant,
}; };
@ -17,19 +14,10 @@ use serenity::all::{
CreateInteractionResponseMessage, EditInteractionResponse, CreateInteractionResponseMessage, EditInteractionResponse,
}; };
use sqlx::PgPool; use sqlx::PgPool;
use tracing::info; use tracing::{debug, info};
use anyhow::Result;
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 {
@ -45,10 +33,6 @@ impl SlashCommand for Ping {
&CommandCategory::Utils &CommandCategory::Utils
} }
fn command_id_ref(&self) -> &AtomicU64 {
&self.command_id
}
fn register(&self) -> CreateCommand { fn register(&self) -> CreateCommand {
info!("\t✅ | {}", self.name()); info!("\t✅ | {}", self.name());
CreateCommand::new(self.name()).description(self.description()) CreateCommand::new(self.name()).description(self.description())
@ -60,7 +44,8 @@ impl SlashCommand for Ping {
command: &CommandInteraction, command: &CommandInteraction,
_database: &PgPool, _database: &PgPool,
_emoji: &EmojiConfig, _emoji: &EmojiConfig,
) -> Result<(), serenity::Error> { ) -> Result<()> {
debug!("Ping command called");
let message: CreateInteractionResponseMessage = CreateInteractionResponseMessage::new() let message: CreateInteractionResponseMessage = CreateInteractionResponseMessage::new()
.content("🏓 | Pong!") .content("🏓 | Pong!")
.ephemeral(true); .ephemeral(true);
@ -81,5 +66,5 @@ impl SlashCommand for Ping {
} }
inventory::submit! { inventory::submit! {
CommandEntry { create: || Box::new(Ping::new()) } CommandEntry { create: || Box::new(Ping) }
} }