onBeforeRun<O extends OptionDefinition, T> static method
CommandMiddleware<O, T>
onBeforeRun<O extends OptionDefinition, T>(
- FutureOr<
void> onRun(- CommandContext<
O, T>
- CommandContext<
Creates a CommandMiddleware with a variant of onRun that does not
return a value, intended for use before the command is run but no need to
change the context.
Implementation
static CommandMiddleware<O, T> onBeforeRun<O extends OptionDefinition, T>(
final FutureOr<void> Function(CommandContext<O, T>) onRun,
) {
return withHooks(
onRun: (final ctx) async {
await onRun(ctx);
return ctx;
},
);
}