Skip to content

Writing Your Own Bots

Thomas Howe edited this page Apr 18, 2016 · 3 revisions

To write your own bot...

  1. Install greenbot-core, say into the "/home/thomas/greenbot-core" directory
  2. In another directory, clone whatever template bot you wish into another directory, say "/home/thomas/mybot". Good examples of templates bots are Python Bot and Coffee Bot.
  3. In the my bot directory, edit the package.json to name the bot correctly. In the end, you can publish it on NPM if you wish to. The convention is to use 'npm start' to start your bot, but not necessary.
  4. In the my bot directory, edit the bot.json file to edit the settings your bot needs, the command to start the bot, and anything else important.
  5. Test your bot with an 'npm start', it should work on the command line as you would like it to. Either set your environment variables with something like export PROMPT_1="Welcome to my bot" or use defaults in your script.
  6. In the /home/thomas/greenbot-core directory, install your bot with "npm install ../mybot" or whatever directory you wish. At this point, you should see your new bot in the Library on the server, and create new ones based on it. You can install wether or not the server is running; it should pick it up in real time.
  7. Disco!
  8. To uninstall the bot, in the /home/thomas/greenbot-core directory, "npm uninstall mybot"