pub trait PrefixedCommandHandler<State, Args>: Send + Syncwhere
State: StateBound,{
// Required method
fn run(
&self,
ctx: PrefixedContext<State>,
args: &str,
) -> DynFuture<'_, CommandResult>;
}Expand description
Trait for command handlers, the functions that execute when a command is run.
Required Methods§
Sourcefn run(
&self,
ctx: PrefixedContext<State>,
args: &str,
) -> DynFuture<'_, CommandResult>
fn run( &self, ctx: PrefixedContext<State>, args: &str, ) -> DynFuture<'_, CommandResult>
Runs the command handler.
Arguments:
ctx- The context of the command, which contains information about the message, channel, guild, etc.args- The raw arguments passed to the command, which can be parsed into the command’s arguments.
Returns:
CommandResult - A future that resolves when the command handler has finished executing.
This is equivalent to an asynchronous function, so you can just run .run().await.