Skip to content

A small robot written in Javascript (He does not like coffeescript)

License

Notifications You must be signed in to change notification settings

hubot-js/hubot.js

Repository files navigation

hubot.js

Build Status npm Coverage Status Maintainability dependencies-badge devDependencies Status Docker Stars Docker Pulls image-size

A small robot written in Javascript (He doesn't like coffeescript)

Hello world

Hello! My name is Hubot. I'm a robot and my job is to do stuff in Slack chats. At first, I don't know many things, but when gears are attached everything is possible. I love new gears. Feel free to create them.

start-deploy-gif

How to turn me on?

The first step is to have a bot user in Slack. If you don't have a bot yet click here to create one. With a bot user created get the token that was generated in the bot creation and go to the next step.

npm

Very simple. Run the command below.

npm install -g hubot.js

Docker

To enable me with Docker it's a piece of cake. I have a recipe of how to build me in Dockerhub. Just run the following command:

docker run -d -e BOT_API_TOKEN=bot_token \
              -e BOT_NAME=bot_name \
              -v ~/hubot.js/data:/home/node/hubot.js/data \
              -v /var/run/docker.sock:/var/run/docker.sock \
              --group-add=$(stat -c %g /var/run/docker.sock) \
              --restart="unless-stopped" \
              --name=hubot \
              robsonbittencourt/hubot.js

Usage

After you install me through npm some commands are avaliable in your command line. If you start me with Docker these commands won't are available. Help and configure are commands exclusively for console with npm installation. The other commands can be executed with Docker commands - like docker start/stop/restart.

CLI Commands Overview

# Show the help with available commands
$ hubot help                              

# Saves the required settings. These settings are stored, so you just need to do them once.
# But if necessary can make them again.
$ hubot configure -t botToken -n botName  

# Start the hubot. To use this command, the settings must have been already set up.
$ hubot start                             

# Start the hubot. This command saves the configuration and starts. 
$ hubot start -t botToken -n botName      

# Stop the hubot.
$ hubot stop                              

# Restart the hubot.
$ hubot restart                           

First iteration

After you start me call me by my name in private chat. With this I show to you some first instructions.

first-iteraction

An important detail. To ask me things on a channel I have to be participating in it.

Database

I store my configuration data in a database. This database is set to "~ home / hubot.js / data / hubot.db". It is important that you back up this file so that I do not lose my memory.

If you run me using Docker you can map the database file as shown in the runtime sample with Docker.

Activate/Deactivate Gears

You don't want to use some gear? You can disable it. If you want to activate it again it is also possible. Use activate gear-name or deactivate gear-name.

activate-deactivate-gear

Configure Gears

Some gears need to be set up before first use. Use configure gear-name command.

configure-gear

Gears

For now, I don't know how to do many things. But I'm able to understand and to use new gears (features). You can create your own gears. If you think they can be useful for other users, please share it with the world.

Jenkins

I know how to invoke your jobs in Jenkins.

hubot start job my-deploy

start-job

More details here.

Docker

I know how to manipulate your Docker containers.

restart containerName

restart-operation

More details here.

Code Review

I know how to ask for code review.

code review

code-review

More details here.

Help

If you have doubt about the available commands, please ask me for help. I'll be glad to use my gears and knowledge to answer your questions.

hubot help

help

Development setup

  • Fork and clone this project
  • In the main directory run npm installto install dependencies.
  • Write your code
  • To run tests use npm test command

Contributors

Robson Rosa

Meta

Robson Bittencourt - @rluizv - [email protected]

Distributed under the MIT license. See LICENSE for more information.

https://github.com/hubot-js/hubot.js