UNPKG

3.3 kBMarkdownView Raw
1# hubot-scripts
2
3These are a collection of community scripts for [hubot][hubot], a chat bot for
4your company.
5
6
7## Discovering
8
9Check out the [hubot-script-catalog][script-catalog] for a list and description
10of all the available scripts.
11
12## Installing
13
14Once you have Hubot installed, you should already have `hubot-scripts`
15installed. Check `package.json` to be sure. If that is the case, you update
16`hubot-scripts.json` to list any scripts from this repository you want to load.
17The default `hubot-scripts.json` looks like:
18
19 ["redis-brain.coffee", "tweet.coffee", "shipit.coffee"]
20
21If you update `hubot-scripts` in `package.json`, you will automatically get
22updates to your scripts listed here.
23
24Alternatively, you can copy files from this repository into your `scripts`
25directory. Note that you would not get updates from the `hubot-scripts`
26repository unless you copy them yourself.
27
28Any third-party dependencies for scripts need the addition of your
29`package.json` otherwise a lot of errors will be thrown during the start up of
30your hubot. You can find a list of dependencies for a script in the
31documentation header at the top of the script.
32
33Restart your robot, and you're good to go.
34
35All the scripts in this repository are located in [`src/scripts`][src-scripts].
36
37## Writing
38
39Want to write your own Hubot script? The best way is to take a look at an
40[existing script][example-script] and see how things are set up. Hubot scripts
41are written in CoffeeScript, a higher-level implementation of JavaScript.
42
43Additionally, it's extremely helpful to add [TomDoc][tomdoc] to the top of each
44file. (Check out [an example][example-script-doc]). We'll pull out the commands
45from those lines and display them in the generic, robot-wide `hubot help`
46command.
47
48Please note we're no longer including external dependencies in the
49`package.json`, so should you wish to include them please include the package
50name and required version in the TomDoc comments at the top of your script.
51
52## Documentation
53
54We're now requiring all scripts in hubot-scripts to contain a documentation
55header so people know every thing about the script.
56
57```coffeescript
58# Description
59# <description of the scripts functionality>
60#
61# Dependencies:
62# "<module name>": "<module version>"
63#
64# Configuration:
65# LIST_OF_ENV_VARS_TO_SET
66#
67# Commands:
68# hubot <trigger> - <what the respond trigger does>
69# <trigger> - <what the hear trigger does>
70#
71# Notes:
72# <optional notes required for the script>
73#
74# Author:
75# <github username of the original script author>
76```
77
78If you have nothing to fill in for a section you should include `None` in that
79section. Empty sections which are optional should be left blank. A script will
80be required to fill out the documentation before being merged into the
81repository.
82
83[hubot]: https://github.com/github/hubot
84[script-catalog]: http://hubot-script-catalog.herokuapp.com
85[src-scripts]: https://github.com/github/hubot-scripts/tree/master/src/scripts
86[tomdoc]: http://tomdoc.org
87[example-script]: https://github.com/github/hubot-scripts/blob/master/src/scripts/tweet.coffee
88[hubot-script-tests]: https://github.com/github/hubot-scripts/blob/master/test/tests.coffee
89[example-script-doc]: https://github.com/github/hubot-scripts/blob/master/src/scripts/speak.coffee#L1-5