Skip to content

JustinMorgan/hubot-newbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hubot-newbot

A Hubot script that spawns new Hubot scripts on the fly.

Yo dawg.

Installation

  1. Run npm install --save hubot-newbot (the --save is optional).
  2. Add hubot-newbot to your Hubot's external-scripts.json.

NewBot anatomy

NewBots are named, temporary, in-memory mini-bots that work just like a permanent Hubot script. You create them with three ingredients:

  • A unique name,
  • A regex to listen for,
  • A CoffeeScript function literal.

They last until you kill them or your Hubot app restarts; then they're gone forever. They're a good way to try out a Hubot script idea without saving it to a file and restarting Hubot.

NewBots and ListenBots

There are two kinds of bots you can create: standard NewBots and ListenBots. Standard NewBots respond only to direct commands, so they'll only go off when a chat message starts with hubot <command>. ListenBots look for keywords embedded anywhere in a chat message.

Hubot chat commands

hubot newbot FooBot /foo/i (msg) -> msg.send "bar"    # Creates a NewBot named FooBot that responds "bar" to the command "hubot foo".
hubot listenbot FooBot /foo/i (msg) -> msg.send "bar" # Creates a ListenBot named FooBot that responds "bar" to any chat message that includes the string "foo".
hubot killbot FooBot                                  # Deletes FooBot by name.
hubot list newbots                                    # Lists names of running newbots.
hubot showbot FooBot                                  # Shows the regex and CoffeeScript body of FooBot.
hubot showbot FooBot --debug                          # Debug mode: Shows the regex and compiled JavaScript for FooBot.

About

About

A Hubot script that spawns new Hubot scripts on the fly.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published