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

Hi I am still confused on how we can have a new module to our bot.
If I have understood correctly if we download the version that is provided at the official site we can not add new modules on the bot??

So we have to download the botpress repository, build the botpress project and then what we have to do? @PierrePaul you say this:

copy the build folder at the root of our bot. The 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.

but I can not understand what I have to do… I am new to this so if someone could explain me more I would really appreciate it.

Also I found out that when you download and install the botpress from the official website the modules are not normal folders but .tgz files.Why is that happening and how this effect the module installation?
Thanks for your time!

The module builder is the only tool you need from the github repository. It’s a standalone tool that allows you to create and package modules (as .tgz), so that you can drag & drop them into your bot’s “modules” folder.

You can use module-builder’s build to compile it and package to create a .tgz archive.

Thank you @sylvain for your answer.
I am trying to follow the instructions of @PierrePaul but I have a problem…
I download the botpress from github, and I am trying to yarn & yarn build.
but at the yarn build I wait more than 10 minutes at Starting 'buildModuleBuilder'... but nothing…

When I run yarn I get this:

yarn install v1.17.3
[1/5] Validating package.json…
[2/5] Resolving packages…
success Already up-to-date.
Done in 1.05s.

What does it means?
Am I doing something wrong?