How to store data into hooks

#1

Hello, I need to store some functions into the variable “bp”. I really can do it in “actions” inside mybot. But when I try to do this in “global/hooks/after_bot_mount” the functions just disappear.

into mybot/actions: bp.myfunction = () => {console.log(“whatever”);}

still persistent between the dialogs

into global/hooks/after_bot_mount: bp.myfunction = () => {console.log(“whatever”);}

don’t persist between the dialogs

Does anyone knows how to do this?

Obs: don’t tell me to use kvs.storage because serialization is cleaning the functions.

#2

Hi @arnaldobadin, you can’t declare functions like that. bp is a SDK and is not mutable like it was in v10. I’m not sure what you want to achieve but I could help you if you provide more details. Also, please refer to this section of the documentation for further details on actions and hooks.