Creating a new module

Hello!
I’m trying to create a new module. Reading up the documentation at : https://botpress.github.io/en/docs/modules/ helped a bit, but I’m stuck.
botpress install no longer seems to work (at least, the install method is not reported in the --help documentation).
I’m guessing I need to open data/global/botpress.config.json, add the path of my module (which is unpacked? is this gonna work? Do I need to pack it everytime I test something?), but now I’m getting the error:

VError: Fatal error loading module "/home/xxxxx/Workbench/botpress-fixrs": regeneratorRuntime is not defined

I’m guessing it’s related to babel-polyfill, but I don’t see it listed in either my bot or my module (using botpress init and botpress create).

I would gladly fix the documentation (and the --help), if you can give me some pointers.

@PierrePaul: Thanks for this link, so far I did not know that we could create a module by just running botpress create.

I only followed this link for creating a custom module and did everything manually to create my custom module. Understanding this pain I started my blog and wrote a few how to guides and will continue to write as I progress.

There is one post specially on How to create a custom module in Botpress? topic. Let me know if this helps.

You’re probably referring to those commands that were available in botpress 10. I imagine you migrated from 10 to 11 or 12 and those aren’t working anymore. Check the new doc and @abhisheksimon resources and let us know if you’re still experiencing issues with module development.

Would you feel more comfortable using similar commands for module management in future releases of botpress 12 ?

@abhisheksimon thanks for your guide. Even though we didnt reply, we have been going over it for the past few days.
It’s a nice guide to understand the different part of the bot, but in our case, our issue was to get the module running.

@EFF we were able to create + install our new custom module by doing :

  • git clone the botpress repository
  • yarn build the botpress project
  • copy the example complete-module inside our bot (our-bot/modules/)
  • copy the build folder at the root of our bot. Tthe example module references the module-builder which seems to be a private package and the path would be wrong once our example module has moved. It took us waayy too much time to understand the botpress project needed to be yarn build before copying into our bot.
  • go back to custom module and then yarn && yarn install.

Would you feel more comfortable using similar commands for module management in future releases of botpress 12 ?

Yes, but I actually don’t care. I just need updated docs. If the procedure is right, I can submit a PR if you want.

That brings another question though, if we bring another developer into our project, he will need the build folder. So I guess we should also add the build folder (the one compiled from the yarn build on the botpress folder) to git? How do you guys do it internally?

Yes, your other developer will need the module-builder dependency. This dependency is standalone and is located here: https://github.com/botpress/botpress/tree/master/build/module-builder

We’d appreciate a PR with updated docs, also I think publishing the module-builder to NPM would be a good idea.

3 Likes