Currently supported hooks are function based hooks.
It could make sense to support OOP, where some business logic might be in a certain class
Consider the approach like below
# example.hooks.todo.py
class ToDo(AbstractHookArgCls):
# overriden to initiate current user arg
def setup_args(self, arg: HookArg):
self.arg = arg
def save_todo(self):
todo = self.arg.user_input
self.db.save(todo)
return self.arg
# ..
Calling the hook in template
"SAVE-TODO-STAGE":
type: text
message: Enter the new todo
on-receive: example.hooks.todo:ToDo.save_todo
routes:
"re:.*": "VIEW-TODOS-STAGE"
Currently supported hooks are function based hooks.
It could make sense to support OOP, where some business logic might be in a certain class
Consider the approach like below
Calling the hook in template