feat(commands/mod): adding the anyhow result return
This commit is contained in:
parent
c3161ab949
commit
b82199dab1
1 changed files with 5 additions and 12 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
use std::sync::atomic::{AtomicU64, Ordering};
|
use anyhow::Result;
|
||||||
|
|
||||||
use serenity::all::{CommandInteraction, Context, CreateCommand};
|
use serenity::all::{CommandInteraction, Context, CreateCommand};
|
||||||
use sqlx::PgPool;
|
use sqlx::PgPool;
|
||||||
|
|
||||||
|
|
@ -11,6 +10,7 @@ include!("./mod_gen.rs");
|
||||||
pub enum CommandCategory {
|
pub enum CommandCategory {
|
||||||
Moderation,
|
Moderation,
|
||||||
Utils,
|
Utils,
|
||||||
|
Gestion,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CommandCategory {
|
impl CommandCategory {
|
||||||
|
|
@ -18,6 +18,7 @@ impl CommandCategory {
|
||||||
match self {
|
match self {
|
||||||
Self::Utils => "🌐",
|
Self::Utils => "🌐",
|
||||||
Self::Moderation => "🛡️",
|
Self::Moderation => "🛡️",
|
||||||
|
Self::Gestion => "👑",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -25,6 +26,7 @@ impl CommandCategory {
|
||||||
match self {
|
match self {
|
||||||
Self::Utils => "Utils",
|
Self::Utils => "Utils",
|
||||||
Self::Moderation => "Moderation",
|
Self::Moderation => "Moderation",
|
||||||
|
Self::Gestion => "Gestion",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -34,15 +36,6 @@ pub trait SlashCommand: Send + Sync {
|
||||||
fn name(&self) -> &'static str;
|
fn name(&self) -> &'static str;
|
||||||
fn description(&self) -> &'static str;
|
fn description(&self) -> &'static str;
|
||||||
fn category(&self) -> &'static CommandCategory;
|
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;
|
fn register(&self) -> CreateCommand;
|
||||||
|
|
||||||
|
|
@ -52,7 +45,7 @@ pub trait SlashCommand: Send + Sync {
|
||||||
command: &CommandInteraction,
|
command: &CommandInteraction,
|
||||||
database: &PgPool,
|
database: &PgPool,
|
||||||
_emoji: &EmojiConfig,
|
_emoji: &EmojiConfig,
|
||||||
) -> Result<(), serenity::Error>;
|
) -> Result<()>;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct CommandEntry {
|
pub struct CommandEntry {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue