#[cfg(feature = "registry")]
mod registry;
use async_trait::async_trait;
#[cfg(feature = "registry")]
pub use registry::CommandRegistry;
mod types;
#[doc(inline)]
pub use types::*;
use puniyu_context::MessageContext;
#[async_trait]
pub trait Command: Send + Sync + 'static {
fn name(&self) -> &str;
fn description(&self) -> Option<&str> {
None
}
fn args(&self) -> Vec<Arg<'_>> {
Vec::new()
}
fn priority(&self) -> u32 {
500
}
fn alias(&self) -> Vec<&str> {
Vec::new()
}
fn permission(&self) -> Permission {
Permission::All
}
async fn execute(&self, ctx: &MessageContext) -> puniyu_error::Result<CommandAction>;
}
impl PartialEq for dyn Command {
fn eq(&self, other: &Self) -> bool {
self.name() == other.name()
&& self.description() == other.description()
&& self.args() == other.args()
&& self.priority() == other.priority()
&& self.alias() == other.alias()
&& self.permission() == other.permission()
}
}