I've got hot reloading already set up ant working for other things.
The hooks are global, and currently added with tanjun_client.set_hooks(hooks) from a normal import.
The hooks.py file looks like this
hooks = tanjun.AnyHooks()
@hooks.with_pre_execution
async def pre_execution(ctx: tanjun.abc.SlashContext) -> None:
# stuff
pass
# more hooks
The usage guide at https://tanjun.cursed.solutions/usage/#execution-hooks mention that hooks can be in a component, but I can't quite figure out how to set it up.
I tried this in the hooks.py file. It loads and works, but it fails to reload.
component = tanjun.Component()
@tanjun.as_loader
def load(client: tanjun.Client) -> None:
client.set_hooks(hooks)
client.add_component(component)
@tanjun.as_unloader
def unload(client: tanjun.Client) -> None:
client.set_hooks(None)
client.remove_component(component)
Feels like I'm missing something.