1 | # hubot-scripts
|
2 |
|
3 | These are a collection of community scripts for [hubot][hubot], a chat bot for
|
4 | your company.
|
5 |
|
6 |
|
7 | ## Discovering
|
8 |
|
9 | Check out the [hubot-script-catalog][script-catalog] for a list and description
|
10 | of all the available scripts.
|
11 |
|
12 | ## Installing
|
13 |
|
14 | Once you have Hubot installed, you should already have `hubot-scripts`
|
15 | installed. 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.
|
17 | The default `hubot-scripts.json` looks like:
|
18 |
|
19 | ["redis-brain.coffee", "tweet.coffee", "shipit.coffee"]
|
20 |
|
21 | If you update `hubot-scripts` in `package.json`, you will automatically get
|
22 | updates to your scripts listed here.
|
23 |
|
24 | Alternatively, you can copy files from this repository into your `scripts`
|
25 | directory. Note that you would not get updates from the `hubot-scripts`
|
26 | repository unless you copy them yourself.
|
27 |
|
28 | Any 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
|
30 | your hubot. You can find a list of dependencies for a script in the
|
31 | documentation header at the top of the script.
|
32 |
|
33 | Restart your robot, and you're good to go.
|
34 |
|
35 | All the scripts in this repository are located in [`src/scripts`][src-scripts].
|
36 |
|
37 | ## Writing
|
38 |
|
39 | Want 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
|
41 | are written in CoffeeScript, a higher-level implementation of JavaScript.
|
42 |
|
43 | Additionally, it's extremely helpful to add [TomDoc][tomdoc] to the top of each
|
44 | file. (Check out [an example][example-script-doc]). We'll pull out the commands
|
45 | from those lines and display them in the generic, robot-wide `hubot help`
|
46 | command.
|
47 |
|
48 | Please note we're no longer including external dependencies in the
|
49 | `package.json`, so should you wish to include them please include the package
|
50 | name and required version in the TomDoc comments at the top of your script.
|
51 |
|
52 | ## Documentation
|
53 |
|
54 | We're now requiring all scripts in hubot-scripts to contain a documentation
|
55 | header 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 |
|
78 | If you have nothing to fill in for a section you should include `None` in that
|
79 | section. Empty sections which are optional should be left blank. A script will
|
80 | be required to fill out the documentation before being merged into the
|
81 | repository.
|
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
|