pub trait Command<S>: CommandDefinition {
// Required method
fn invoke(
invocation: Invocation<'_, S>,
) -> impl Future<Output = Result<InteractionResponse, HandlerError>> + Send;
// Provided method
fn autocomplete(
_invocation: Invocation<'_, S>,
) -> impl Future<Output = Option<Result<InteractionResponse, HandlerError>>> + Send { ... }
}Expand description
Runs a Command for an Interaction. Implemented by #[command] and #[group]; Groups route to
the subcommand that was invoked.
Required Methods§
Sourcefn invoke(
invocation: Invocation<'_, S>,
) -> impl Future<Output = Result<InteractionResponse, HandlerError>> + Send
fn invoke( invocation: Invocation<'_, S>, ) -> impl Future<Output = Result<InteractionResponse, HandlerError>> + Send
Reads the Options, runs the handler, and turns its output into the Response
Provided Methods§
Sourcefn autocomplete(
_invocation: Invocation<'_, S>,
) -> impl Future<Output = Option<Result<InteractionResponse, HandlerError>>> + Send
fn autocomplete( _invocation: Invocation<'_, S>, ) -> impl Future<Output = Option<Result<InteractionResponse, HandlerError>>> + Send
Suggestions for the Option being typed, or None if it has no Autocomplete Handler
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".