Skip to main content

PrefixedCommandHandler

Trait PrefixedCommandHandler 

Source
pub trait PrefixedCommandHandler<State, Args>: Send + Sync
where 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§

Source

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.

Implementors§

Source§

impl<State, F, Fut, Res> PrefixedCommandHandler<State, ()> for F
where F: Fn(PrefixedContext<State>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Res> + Send + 'static, Res: IntoCommandResult + Send + 'static, State: StateBound,

Source§

impl<State, Func, Fut, A, B, C, D, E, F, Res> PrefixedCommandHandler<State, (A, B, C, D, E, F)> for Func
where Func: Fn(PrefixedContext<State>, A, B, C, D, E, F) -> Fut + Send + Sync + 'static, Fut: Future<Output = Res> + Send + 'static, Res: IntoCommandResult + Send + 'static, State: StateBound, A: IntoArgument<State> + 'static, B: IntoArgument<State> + 'static, C: IntoArgument<State> + 'static, D: IntoArgument<State> + 'static, E: IntoArgument<State> + 'static, F: IntoArgument<State> + 'static,

Source§

impl<State, Func, Fut, A, B, C, D, E, Res> PrefixedCommandHandler<State, (A, B, C, D, E)> for Func
where Func: Fn(PrefixedContext<State>, A, B, C, D, E) -> Fut + Send + Sync + 'static, Fut: Future<Output = Res> + Send + 'static, Res: IntoCommandResult + Send + 'static, State: StateBound, A: IntoArgument<State> + 'static, B: IntoArgument<State> + 'static, C: IntoArgument<State> + 'static, D: IntoArgument<State> + 'static, E: IntoArgument<State> + 'static,

Source§

impl<State, Func, Fut, A, B, C, D, Res> PrefixedCommandHandler<State, (A, B, C, D)> for Func
where Func: Fn(PrefixedContext<State>, A, B, C, D) -> Fut + Send + Sync + 'static, Fut: Future<Output = Res> + Send + 'static, Res: IntoCommandResult + Send + 'static, State: StateBound, A: IntoArgument<State> + 'static, B: IntoArgument<State> + 'static, C: IntoArgument<State> + 'static, D: IntoArgument<State> + 'static,

Source§

impl<State, Func, Fut, A, B, C, Res> PrefixedCommandHandler<State, (A, B, C)> for Func
where Func: Fn(PrefixedContext<State>, A, B, C) -> Fut + Send + Sync + 'static, Fut: Future<Output = Res> + Send + 'static, Res: IntoCommandResult + Send + 'static, State: StateBound, A: IntoArgument<State> + 'static, B: IntoArgument<State> + 'static, C: IntoArgument<State> + 'static,

Source§

impl<State, Func, Fut, A, B, Res> PrefixedCommandHandler<State, (A, B)> for Func
where Func: Fn(PrefixedContext<State>, A, B) -> Fut + Send + Sync + 'static, Fut: Future<Output = Res> + Send + 'static, Res: IntoCommandResult + Send + 'static, State: StateBound, A: IntoArgument<State> + 'static, B: IntoArgument<State> + 'static,

Source§

impl<State, Func, Fut, A, Res> PrefixedCommandHandler<State, (A,)> for Func
where Func: Fn(PrefixedContext<State>, A) -> Fut + Send + Sync + 'static, Fut: Future<Output = Res> + Send + 'static, Res: IntoCommandResult + Send + 'static, State: StateBound, A: IntoArgument<State> + 'static,