Skip to content

Hooks

Hook #

Represents a hook.

callback instance-attribute #
callback: HookCallbackT

Callback of hook.

HookResult #

The result of a hook callback.

stop class-attribute instance-attribute #
stop: bool = attrs.field(default=False, eq=False)

Will hook stop execution or not.

hook #

hook() -> Callable[[HookCallbackT], Hook]

Decorator for defining a hook.

Example
@hook
async def stop_hook(context: InteractionContext) -> HookResult:
    await context.create_response("No one will execute this command.")
    return HookResult(stop=True)