Finish refactoring

This commit is contained in:
2025-08-10 21:15:53 -03:00
parent f123282699
commit a004fe2308
50 changed files with 2639 additions and 587 deletions
+11 -2
View File
@@ -1,3 +1,5 @@
use std::fmt::Debug;
use async_trait::async_trait;
use thiserror::Error;
@@ -6,15 +8,22 @@ use crate::framework::commands::{arguments::Argument, context::CommandContext};
pub mod arguments;
pub mod context;
pub mod messages;
pub mod runner;
#[derive(Debug, Error)]
pub enum CommandError {
#[error("A message was attempted to be sent but it failed")]
MessageSendingFailed,
#[error("A database query failed")]
DatabaseQueryFailed,
#[error("A database operation failed due to an inconsistent state")]
DatabaseInconsistentState,
}
#[async_trait]
pub trait Command: Send + Sync {
pub trait Command<T>: Send + Sync + Debug {
fn name(&self) -> &'static str;
fn aliases(&self) -> &'static [&'static str] {
&[]
@@ -36,7 +45,7 @@ pub trait Command: Send + Sync {
all
}
async fn execute(&self, ctx: &CommandContext, args: &str) -> Result<(), CommandError>;
async fn execute(&self, ctx: CommandContext<'_, T>, args: &str) -> Result<(), CommandError>;
}
pub struct CommandParts<'a> {