Permalink
Browse files

Merge with upstream

  • Loading branch information...
2 parents 6c0c5f5 + b07cbb3 commit 5f6d0a94c7fe42231efdb3b287f08a4205ffd7c1 @felipecsl committed Aug 1, 2012
Showing with 10,628 additions and 1,249 deletions.
  1. +3 −1 .gitignore
  2. +19 −0 CHANGELOG.md
  3. +70 −120 README.md
  4. +3 −21 package.json
  5. +99 −0 src/scripts/46elks.coffee
  6. +21 −5 src/scripts/9gag.coffee
  7. +14 −24 src/scripts/abstract.coffee
  8. +13 −1 src/scripts/achievement_unlocked.coffee
  9. +14 −4 src/scripts/ackbar.coffee
  10. +13 −5 src/scripts/adult.coffee
  11. +15 −15 src/scripts/airbrake.coffee
  12. +25 −0 src/scripts/alot.coffee
  13. +43 −0 src/scripts/ambush.coffee
  14. +14 −2 src/scripts/animal.coffee
  15. +46 −0 src/scripts/archer.coffee
  16. +90 −0 src/scripts/asana.coffee
  17. +13 −2 src/scripts/ascii.coffee
  18. +84 −0 src/scripts/auth.coffee
  19. +13 −1 src/scripts/auto-stache.coffee
  20. +65 −0 src/scripts/availability.coffee
  21. +172 −0 src/scripts/aws.coffee
  22. +32 −0 src/scripts/aww.coffee
  23. +45 −0 src/scripts/b6n.coffee
  24. +32 −0 src/scripts/bang-bang.coffee
  25. +15 −6 src/scripts/bang.coffee
  26. +54 −0 src/scripts/base36.coffee
  27. +54 −0 src/scripts/base58.coffee
  28. +21 −0 src/scripts/base64.coffee
  29. +13 −7 src/scripts/basecamp.coffee
  30. +90 −0 src/scripts/beanstalk.coffee
  31. +28 −0 src/scripts/beerme.coffee
  32. +13 −2 src/scripts/bees.coffee
  33. +12 −1 src/scripts/bij.coffee
  34. +35 −0 src/scripts/bing-images.coffee
  35. +13 −3 src/scripts/bing.coffee
  36. +29 −0 src/scripts/bitbucket.coffee
  37. +212 −0 src/scripts/bookmark.coffee
  38. +18 −0 src/scripts/botsnack.coffee
  39. +44 −0 src/scripts/brewerydb.coffee
  40. +36 −0 src/scripts/buscemi.coffee
  41. +17 −3 src/scripts/carlton.coffee
  42. +30 −0 src/scripts/cat.coffee
  43. +34 −0 src/scripts/celery-man.coffee
  44. +20 −0 src/scripts/chat.coffee
  45. +14 −2 src/scripts/cheer.coffee
  46. +16 −2 src/scripts/cheerlights.coffee
  47. +14 −2 src/scripts/chm.coffee
  48. +13 −5 src/scripts/chuck-norris.coffee
  49. +14 −1 src/scripts/clark.coffee
  50. +24 −0 src/scripts/cleverbot.coffee
  51. +33 −0 src/scripts/clojure.coffee
  52. +45 −0 src/scripts/cloudapp.coffee
  53. +20 −7 src/scripts/coderwall.coffee
  54. +12 −2 src/scripts/coin.coffee
  55. +13 −2 src/scripts/commitmessage.coffee
  56. +39 −0 src/scripts/complete.coffee
  57. +15 −3 src/scripts/conversation.coffee
  58. +28 −0 src/scripts/corgime.coffee
  59. +13 −2 src/scripts/cowsay.coffee
  60. +35 −0 src/scripts/cricket.coffee
  61. +32 −0 src/scripts/days_since.coffee
  62. +15 −8 src/scripts/deadline.coffee
  63. +27 −0 src/scripts/dealwithit.coffee
  64. +19 −0 src/scripts/decide.coffee
  65. +15 −1 src/scripts/defprogramming.coffee
  66. +16 −1 src/scripts/demolition-man.coffee
  67. +14 −3 src/scripts/destiny.coffee
  68. +14 −2 src/scripts/dialectizer.coffee
  69. +13 −3 src/scripts/dice.coffee
  70. +13 −2 src/scripts/dilbert.coffee
  71. +13 −2 src/scripts/directions.coffee
  72. +14 −1 src/scripts/disassemble.coffee
  73. +14 −4 src/scripts/dnsimple.coffee
  74. +13 −1 src/scripts/do-it-live.coffee
  75. +40 −0 src/scripts/dribbble.coffee
  76. +108 −0 src/scripts/drupalorg.coffee
  77. +12 −4 src/scripts/eight-ball.coffee
  78. +23 −0 src/scripts/eval.coffee
  79. +37 −0 src/scripts/facepalm.coffee
  80. +17 −6 src/scripts/faceup.coffee
  81. +86 −0 src/scripts/factoid.coffee
  82. +12 −3 src/scripts/fibonacci.coffee
  83. +31 −0 src/scripts/file-brain.coffee
  84. +33 −0 src/scripts/filmwise.coffee
  85. +60 −0 src/scripts/fishpun.coffee
  86. +94 −0 src/scripts/flattr.coffee
  87. +14 −0 src/scripts/flying-high.coffee
  88. +28 −0 src/scripts/fml.coffee
  89. +21 −10 src/scripts/fogbugz.coffee
  90. +13 −2 src/scripts/fortune.coffee
  91. +47 −0 src/scripts/fuck_yeah_nouns.coffee
  92. +12 −3 src/scripts/gauges.coffee
  93. +21 −8 src/scripts/gemwhois.coffee
  94. +140 −0 src/scripts/gerrit.coffee
  95. +13 −2 src/scripts/getajob.coffee
  96. +15 −4 src/scripts/gifbin.coffee
  97. +14 −2 src/scripts/giftv.coffee
  98. +42 −0 src/scripts/git-help.coffee
  99. +29 −33 src/scripts/github-activity.coffee
  100. +23 −27 src/scripts/github-commiters.coffee
  101. +18 −8 src/scripts/github-credentials.coffee
  102. +29 −0 src/scripts/github-issue-link.coffee
  103. +91 −26 src/scripts/github-issues.coffee
  104. +42 −38 src/scripts/github-pulls.coffee
  105. +48 −0 src/scripts/gob.coffee
  106. +15 −9 src/scripts/good-night.coffee
  107. +93 −0 src/scripts/goodbad.coffee
  108. +13 −3 src/scripts/google-reader.coffee
  109. +16 −6 src/scripts/google-search-api.coffee
  110. +14 −4 src/scripts/google.coffee
  111. +24 −0 src/scripts/goooood.coffee
  112. +37 −0 src/scripts/gosling.coffee
  113. +79 −0 src/scripts/graphite.coffee
  114. +51 −0 src/scripts/gtalk.coffee
  115. +16 −7 src/scripts/hackernews.coffee
  116. +16 −4 src/scripts/hangman.coffee
  117. +25 −0 src/scripts/hardradio.coffee
  118. +39 −0 src/scripts/hashing.coffee
  119. +20 −5 src/scripts/haters.coffee
  120. +61 −11 src/scripts/heroku-status.coffee
  121. +12 −2 src/scripts/hideyakids.coffee
  122. +77 −0 src/scripts/history.coffee
  123. +31 −0 src/scripts/horse.coffee
  124. +38 −0 src/scripts/http-info.coffee
  125. +31 −0 src/scripts/http-say.coffee
  126. +45 −0 src/scripts/iced-coffee-weather.coffee
  127. +29 −0 src/scripts/illogical.coffee
  128. +14 −0 src/scripts/inigo-montoya.coffee
  129. +14 −1 src/scripts/insult.coffee
  130. +42 −0 src/scripts/invalid.coffee
  131. +12 −4 src/scripts/isup.coffee
  132. +57 −0 src/scripts/itcrowd.coffee
  133. +30 −0 src/scripts/ive.coffee
  134. +41 −0 src/scripts/iwdrm.coffee
  135. +22 −6 src/scripts/janky.coffee
  136. +14 −1 src/scripts/javascript-sandbox.coffee
  137. +114 −23 src/scripts/jenkins.coffee
  138. +51 −0 src/scripts/jira-issues.coffee
  139. +121 −41 src/scripts/jira.coffee
  140. +43 −0 src/scripts/joinme-generator.coffee
  141. +14 −2 src/scripts/jordan.coffee
  142. +83 −36 src/scripts/karma.coffee
  143. +17 −21 src/scripts/keep-alive.coffee
  144. +15 −5 src/scripts/kittens.coffee
  145. +13 −2 src/scripts/lastfm_np.coffee
  146. +18 −2 src/scripts/likeaboss.coffee
  147. +34 −0 src/scripts/linsanity.coffee
  148. +18 −11 src/scripts/list-jira-bugs.coffee
  149. +21 −0 src/scripts/lmgtfy.coffee
  150. +17 −8 src/scripts/location-decision-maker.coffee
  151. +15 −1 src/scripts/lolz.coffee
  152. +13 −3 src/scripts/look-of-disapproval.coffee
  153. +14 −4 src/scripts/lyrics.coffee
  154. +39 −0 src/scripts/manatee.coffee
  155. +14 −3 src/scripts/megusta.coffee
  156. +102 −0 src/scripts/meme_captain.coffee
  157. +52 −20 src/scripts/meme_generator.coffee
  158. +99 −0 src/scripts/mitch-hedburg.coffee
  159. +14 −3 src/scripts/mite.coffee
  160. +32 −0 src/scripts/modulepuppy.coffee
  161. +12 −3 src/scripts/mta.coffee
  162. +23 −0 src/scripts/mtg.coffee
  163. +33 −0 src/scripts/myappstatus.coffee
  164. +12 −3 src/scripts/nettipot.coffee
  165. +23 −16 src/scripts/newrelic.coffee
  166. +14 −4 src/scripts/news.coffee
  167. +27 −0 src/scripts/nice.coffee
  168. +72 −0 src/scripts/notify.coffee
  169. +22 −17 src/scripts/oauth.coffee
  170. +14 −3 src/scripts/octocat.coffee
  171. +365 −0 src/scripts/octospy.coffee
  172. +323 −0 src/scripts/one_four_twentyfour.coffee
  173. +17 −5 src/scripts/penny-arcade.coffee
  174. +13 −1 src/scripts/ping.coffee
  175. +15 −10 src/scripts/pivotal.coffee
  176. +13 −5 src/scripts/pivotalstorylisten.coffee
  177. +164 −156 src/scripts/play.coffee
  178. +30 −0 src/scripts/pokefacts.coffee
  179. +26 −10 src/scripts/polite.coffee
  180. +71 −0 src/scripts/pomodoro.coffee
  181. +76 −0 src/scripts/prank-text.coffee
  182. +13 −3 src/scripts/punchfork.coffee
  183. +13 −1 src/scripts/put-it-back.coffee
  184. +24 −17 src/scripts/pypi.coffee
  185. +23 −0 src/scripts/quickmeme.coffee
  186. +15 −6 src/scripts/quote.coffee
  187. +44 −0 src/scripts/rageface.coffee
  188. +130 −0 src/scripts/rally.coffee
  189. +34 −0 src/scripts/reddit-jokes.coffee
  190. +60 −0 src/scripts/reddit-random-top.coffee
  191. +48 −0 src/scripts/reddit.coffee
  192. +16 −2 src/scripts/redis-brain.coffee
  193. +389 −0 src/scripts/redmine.coffee
  194. +13 −4 src/scripts/remind.coffee
  195. +13 −2 src/scripts/resque.coffee
  196. +12 −2 src/scripts/rimshot.coffee
  197. +14 −4 src/scripts/robot-memes.coffee
  198. +13 −10 src/scripts/roll.coffee
  199. +60 −0 src/scripts/rollout.coffee
  200. +35 −0 src/scripts/romanemperor.coffee
  201. +15 −7 src/scripts/rotten.coffee
  202. +12 −4 src/scripts/rsstodolist.coffee
  203. +33 −0 src/scripts/ruby.coffee
  204. +12 −2 src/scripts/rubygems.coffee
  205. +15 −6 src/scripts/salesforce.coffee
  206. +83 −0 src/scripts/scalarium.coffee
  207. +76 −0 src/scripts/scalr.coffee
  208. +48 −0 src/scripts/scoutapp.coffee
  209. +13 −37 src/scripts/script.coffee
  210. +164 −0 src/scripts/scrumnotes.coffee
  211. +19 −10 src/scripts/sendgrid.coffee
  212. +35 −0 src/scripts/sensitive.coffee
  213. +25 −0 src/scripts/serenity.coffee
  214. +27 −0 src/scripts/sheits.coffee
  215. +26 −3 src/scripts/shipit.coffee
  216. +15 −3 src/scripts/shorten.coffee
  217. +24 −0 src/scripts/sigh.coffee
  218. +15 −2 src/scripts/sms.coffee
  219. +51 −0 src/scripts/snow.coffee
  220. +13 −1 src/scripts/sonos.coffee
  221. +14 −4 src/scripts/sosearch.coffee
  222. +13 −4 src/scripts/speak.coffee
  223. +15 −15 src/scripts/spin.coffee
  224. +13 −3 src/scripts/spotify.coffee
  225. +173 −0 src/scripts/sprintly.coffee
  226. +126 −0 src/scripts/squeezebox.coffee
  227. +51 −0 src/scripts/stagehand.coffee
  228. +23 −0 src/scripts/stock.coffee
  229. +14 −3 src/scripts/stocks.coffee
  230. +16 −1 src/scripts/store-messages-couchdb.coffee
  231. +14 −3 src/scripts/sudo.coffee
  232. +18 −2 src/scripts/sugarcrm.coffee
  233. +38 −0 src/scripts/swanson.coffee
  234. +14 −1 src/scripts/sweetdude.coffee
  235. +15 −5 src/scripts/talkative.coffee
  236. +28 −0 src/scripts/talklikewarrenellis.coffee
  237. +14 −4 src/scripts/tasks.coffee
  238. +48 −0 src/scripts/team-city-listener.coffee
  239. +1 −1 src/scripts/teamcity.coffee
  240. +15 −3 src/scripts/tell.coffee
  241. +60 −0 src/scripts/text.coffee
  242. +23 −0 src/scripts/thebattle.coffee
  243. +227 −0 src/scripts/trac.coffee
  244. +13 −5 src/scripts/train.coffee
  245. +11 −3 src/scripts/trajectorystorylisten.coffee
  246. +12 −2 src/scripts/travis.coffee
  247. +67 −0 src/scripts/trollicon.coffee
  248. +51 −0 src/scripts/truckstopsf.coffee
  249. +25 −0 src/scripts/tryerlang.coffee
  250. +46 −0 src/scripts/tumblr.coffee
  251. +15 −0 src/scripts/tvshow.coffee
  252. +15 −2 src/scripts/tweet-content.coffee
  253. +12 −2 src/scripts/tweet.coffee
  254. +17 −3 src/scripts/twitter.coffee
  255. +14 −3 src/scripts/twss.coffee
  256. +14 −6 src/scripts/uptime-robot.coffee
  257. +14 −1 src/scripts/uptime.coffee
  258. +28 −17 src/scripts/urban.coffee
  259. +37 −0 src/scripts/url.coffee
  260. +15 −9 src/scripts/vanity.coffee
  261. +15 −4 src/scripts/walmart.coffee
  262. +21 −0 src/scripts/wat.coffee
  263. +17 −4 src/scripts/weather.coffee
  264. +33 −10 src/scripts/web.coffee
  265. +14 −2 src/scripts/webshot.coffee
  266. +40 −0 src/scripts/whatis.coffee
  267. +36 −0 src/scripts/wheninaustin.coffee
  268. +23 −0 src/scripts/which-do-you-prefer.coffee
  269. +14 −3 src/scripts/whos-turn.coffee
  270. +15 −26 src/scripts/wikipedia.coffee
  271. +35 −0 src/scripts/wits.coffee
  272. +15 −3 src/scripts/wolfram.coffee
  273. +19 −6 src/scripts/word-of-the-day.coffee
  274. +21 −4 src/scripts/wordnik.coffee
  275. +124 −0 src/scripts/wunderground.coffee
  276. +22 −14 src/scripts/wunderlist.coffee
  277. +14 −3 src/scripts/xkcd.coffee
  278. +14 −4 src/scripts/xmas.js
  279. +30 −0 src/scripts/yoda-pictures.coffee
  280. +45 −0 src/scripts/yoda-quotes.coffee
  281. +13 −2 src/scripts/yomama.coffee
  282. +36 −0 src/scripts/yuno.coffee
  283. +38 −0 test/scripts/github-issues_test.coffee
View
@@ -1,3 +1,5 @@
node_modules
npm-debug.log
-.DS_Store*
+.DS_Store*
+.idea
+
View
@@ -1,3 +1,22 @@
+v2.1.0
+======
+Massive update to every scripts documentation header.
+
+https://github.com/github/hubot-scripts/compare/v2.0.7...v2.1.0
+
+
+v2.0.6
+======
+There is a ton of new functionality. The Second laziest changelog entry in a while.
+
+https://github.com/github/hubot-scripts/compare/v2.0.5...v2.0.6
+
+v2.0.5
+======
+There is a ton of new functionality. Laziest changelog entry in a while.
+
+https://github.com/github/hubot-scripts/compare/v2.0.4...v2.0.5
+
v2.0.4
======
There is a ton of new functionality.
View
190 README.md
@@ -1,132 +1,82 @@
# hubot-scripts
-These are a collection of community scripts for
-[Hubot](https://github.com/github/hubot), a chat bot for your company.
+These are a collection of community scripts for [hubot][hubot], a chat bot for
+your company.
-## Installing
-
-Once you have Hubot installed, you can drop new scripts from this repository
-right into your generated Hubot installation. Just put them in `scripts`,
-restart your robot, and you're good to go.
-
-All the scripts in this repository are located in
-[`src/scripts`](https://github.com/github/hubot-scripts/tree/master/src/scripts).
-
-## Writing
-
-Want to write your own Hubot script? The best way is to take a look at an
-[existing script](https://github.com/github/hubot-scripts/blob/master/src/scripts/tweet.coffee)
-and see how things are set up. Hubot scripts are written in CoffeeScript, a
-higher-level implementation of JavaScript.
-
-You'll also want to [add tests](https://github.com/github/hubot-scripts/blob/master/test/tests.coffee)
-for your script; no one likes untested code. It makes Hubot sad.
-
-Additionally, it's extremely helpful to add [TomDoc](http://tomdoc.org) to the
-top of each file. (Check out [an example](https://github.com/github/hubot-scripts/blob/master/src/scripts/speak.coffee#L1-5)).
-We'll pull out the commands from those lines and display them in the generic,
-robot-wide `hubot help` command.
-
-## Scripts
-
-## spin.coffee
-
-### Spin me
-
-__Format:__
-
- (@yourbot )spin me <query> - Returns a spun version of the input.
-
-__Input:__
-
- spin me {Hi there|Greetings|Hi|Hello|Hello There}{!|,}
-
- I {really|simply|totally} {love|respect|admire} your {blog|article|post|opinion} and {will tell all my friends about it|will be back again tomorrow|also the design of your website}.
-
- {Thanks|Thank you|Cheers|Bye for now}!
-
-__Output:__
-
- Greetings!
-
- I simply admire your blog and also the design of your website.
-
- Cheers!
-
-### Spun me
-
-__Format:__
-
- (@yourbot )spun me <query> - Returns a spintax version of the input using articlemanager.us spinner API.
-
-__Input:__
-
- spun me Below it sat a wooden case of trophies and other awards. Several more were stacked into other corners, joining marble statues, weapon stands and a flat screen television. They all shined in the fire’s light. At least he knew his mother and sister, who were overseas visiting the Queen of England, would be proud. He settled on calling them later, envisioning how they would congratulate him on bringing even more fame and wealth to the family. The invention cooking up in his basement right now was going to make him bigger than the internet.
-
-__Output:__
- Below it sat {a|the} wooden case of trophies {and other|along with other|as well as other} awards. Several more {were|had been} stacked into other {corners|edges}, joining marble statues, weapon stands {and a|along with a} flat screen television. {They all|All of them} shined in the fire’s {light|lighting|mild}. At least he {knew|realized} his mother and {sister}, who were overseas {visiting|going to} the Queen of {England|Britain}, would be proud. {He|This individual|He or she} settled on calling {them|all of them} later, envisioning how {they would|they might} congratulate him on bringing {even more|much more} fame and wealth {to the|towards the} family. The invention cooking {up|upward} in his basement right now {was going to|would definitely} make him bigger {than the|compared to} internet.
+## Discovering
-### Spin the last spun
+Check out the [hubot-script-catalog][script-catalog] for a list and description
+of all the available scripts.
-__Format:__
-
- (@yourbot )spun the last spun - Returns a spun version of the input generated by the last spun me call.
-
-__Output:__
-
-After previous spun me command output could be for example:
-
- Below it sat a wooden case of trophies and other awards. Several more had been stacked into other corners, joining marble statues, weapon stands along with a flat screen television. They all shined in the fire’s mild. At least he realized his mother and sister, who were overseas visiting the Queen of Britain, would be proud. He or she settled on calling all of them later, envisioning how they would congratulate him on bringing much more fame and wealth towards the family. The invention cooking upward in his basement right now would definitely make him bigger compared to internet.
-
-Or if storage is empty: `Nothing so spin. Please use spun first.`
-
-### Spun and spin me
-
-__Format:__
-
- (@yourbot )spun and spin me <query> - Returns a spun version of the input using spun me command first.
-
-__Input:__
-
- spun and spin me And please do not expect anything like Goethe or Schiller from my work, no expect everything, everything, but please no niveau! Because I am orientating myself way more direction Charles Bukowski and Hank was according to common knowledge born in a German town on the left river bank of the Rhine. I myself do live coincidentally in a small town along the Rhine, where triumphantly wins of the Handball team and disturbances in the local chemical plants are holding each other in suspense. Happily or sadly, both of them happen rather seldom.
-
-__Output:__
-
-For example:
-
- And please do not expect anything like Goethe or Schiller from my work, no expect everything, everything, but please no niveau! Because I am orientating myself way more direction Charles Bukowski and Hank was according to common knowledge born in a German town on the left river bank of the Rhine. I myself do live coincidentally in a small town along the Rhine, where triumphantly wins of the Handball team and disturbances in the local chemical plants are holding each other in suspense. Happily or sadly, both of them happen rather seldom.
-
-## oauth.coffee
-
-__Get authorization URL__
-
- get <api> authorization url - get a link to authorization place
-
-__Set verifier__
-
- set <api> verifier <verification_code> - set verification code and access token after first step
-
-__Set access token__
-
- set <api> access token <code> - set access token manually, for OAuth 2.0 (Facebook) only
-
-__Refresh token__
-
- refresh <api> token - refresh access token if it expires, for OAuth 2.0 only
-
-__Get request token__
-
- get <api> request token - retrieves request token public value
+## Installing
-__Get access token__
+Once you have Hubot installed, you can drop new scripts from this repository
+right into your generated Hubot installation. Just put them in `scripts`, add
+the new scripts to the `hubot-scripts.json` file.
- get <api> access token - retrieves access token public value
+Any third-party dependencies for scripts need adding your your `package.json`
+otherwise a lot of errors will be thrown during the start up of your hubot. You
+can find a list of dependencies for a script in the documentation header at the
+top of the script.
-__Get verifier__
+Restart your robot, and you're good to go.
- get <api> verifier - retrieves verification code
+All the scripts in this repository are located in [`src/scripts`][src-scripts].
-__Remove authorization__
+## Writing
- remove <api> authorization - clears tokens from memory if user is same who verified the last authorization
+Want to write your own Hubot script? The best way is to take a look at an
+[existing script][example-script] and see how things are set up. Hubot scripts
+are written in CoffeeScript, a higher-level implementation of JavaScript.
+
+You'll also want to [add tests][hubot-script-tests] for your script; no one
+likes untested code. It makes Hubot sad.
+
+Additionally, it's extremely helpful to add [TomDoc][tomdoc] to the top of each
+file. (Check out [an example][example-script-doc]). We'll pull out the commands
+from those lines and display them in the generic, robot-wide `hubot help`
+command.
+
+Please note we're no longer including external dependencies in the
+`package.json`, so should you wish to include them please include the package
+name and required version in the TomDoc comments at the top of your script.
+
+## Documentation
+
+We're now requiring all scripts in hubot-scripts to contain a documentation
+header so people know every thing about the script.
+
+```coffeescript
+# Description
+# <description of the scripts functionality>
+#
+# Dependencies:
+# "<module name>": "<module version>"
+#
+# Configuration:
+# LIST_OF_ENV_VARS_TO_SET
+#
+# Commands:
+# hubot <trigger> - <what the respond trigger does>
+# <trigger> - <what the hear trigger does>
+#
+# Notes:
+# <optional notes required for the script>
+#
+# Author:
+# <github username of the original script author>
+```
+
+If you have nothing to fill in for a section you should include `None` in that
+section. Empty sections which are optional should be left blank. A script will
+be required to fill out the documentation before being merged into the
+repository.
+
+[hubot]: https://github.com/github/hubot
+[script-catalog]: http://hubot-script-catalog.herokuapp.com
+[src-scripts]: https://github.com/github/hubot-scripts/tree/master/src/scripts
+[tomdoc]: http://tomdoc.org
+[example-script]: https://github.com/github/hubot-scripts/blob/master/src/scripts/tweet.coffee
+[hubot-script-tests]: https://github.com/github/hubot-scripts/blob/master/test/tests.coffee
+[example-script-docs]: (https://github.com/github/hubot-scripts/blob/master/src/scripts/speak.coffee#L1-5
View
@@ -1,6 +1,6 @@
{
"name": "hubot-scripts",
- "version": "2.0.4",
+ "version": "2.1.1",
"author": "hubot",
"keywords": "hubot plugin scripts campfire bot robot",
"description": "Allows you to opt in to a variety of scripts",
@@ -15,26 +15,8 @@
},
"dependencies": {
- "hubot": ">= 2.0.4",
- "optparse": "1.0.3",
- "redis": "0.6.7",
- "jsdom": "==0.2.0",
- "xml2js": "0.1.x",
- "soupselect": "0.2.0",
- "htmlparser": "1.7.x",
- "sprintf": "0.1.1",
- "wwwdude": "0.1.0",
- "pypi": "0.1.0",
- "underscore": ">= 1.2.1",
- "underscore.string": ">= 1.1.6",
- "cradle": "0.5.7",
- "clark": ">= 0.0.3",
- "bang": "0.2.x",
- "shellwords": "0.0.x",
- "nodepie": "0.4.0",
- "mailer": "0.6.7",
- "scribe-node": "0.0.24",
- "sandbox": "0.8.2"
+ "hubot": ">= 2.3.0",
+ "redis": "0.7.2"
},
"directories": {
View
@@ -0,0 +1,99 @@
+# Description:
+# Allows Hubot to send text messages using 46elks.com API.
+#
+# Dependencies:
+# None
+#
+# Configuration:
+# HUBOT_46ELKS_USERNAME
+# HUBOT_46ELKS_PASSWORD
+#
+# Commands:
+# hubot sms <user> <message> - Sends <message> to the number <to>
+# hubot <user> has phone number <phone> - Sets the phone number of <user> to <phone>
+# hubot give me the phone number to <user> - Gets the phone number of <user>
+#
+# Author:
+# kimf
+
+QS = require "querystring"
+module.exports = (robot) ->
+
+ getAmbiguousUserText = (users) ->
+ "Be more specific, I know #{users.length} people named like that: #{(user.name for user in users).join(", ")}"
+
+ robot.respond /sms (\w+) (.*)/i, (msg) ->
+ to = msg.match[1]
+ bahdy = msg.match[2] # bahdy, that's how john mayer would say it.
+ user = process.env.HUBOT_46ELKS_USERNAME
+ pass = process.env.HUBOT_46ELKS_PASSWORD
+ from = "Hubot"
+ auth = 'Basic ' + new Buffer(user + ':' + pass).toString("base64")
+
+ unless user
+ msg.send "46Elks USERNAME isn't set."
+ msg.send "Please set the HUBOT_46ELKS_USERNAME environment variable."
+ return
+
+ unless pass
+ msg.send "46Elks PASSWORD isn't set."
+ msg.send "Please set the HUBOT_46ELKS_PASSWORD environment variable."
+ return
+
+ #get <user>'s phone number as listed in the brain
+ if user = robot.userForName(to)
+ if user.phone == ""
+ msg.send user.name + ' has no phone! set it with <user> has phone <phone>'
+ return
+ else
+ to = user.phone
+ to = to.toString().replace(/\d/, '+46')
+ else
+ msg.send 'Me cant find ' + to + ', are you sure that person is born?'
+ return
+
+ data = QS.stringify from: from, to: to, message: bahdy
+
+ msg.http("https://api.46elks.com")
+ .path("/a1/SMS")
+ .header("Authorization", auth)
+ .post(data) (err, res, body) ->
+ switch res.statusCode
+ when 200
+ msg.send "Sent sms to #{user.name}"
+ else
+ msg.send "Failed to send."
+
+ robot.respond /@?([\w .-_]+) has phone number (\d*)*$/i, (msg) ->
+ name = msg.match[1]
+ phone = msg.match[2].trim()
+
+
+ users = robot.usersForFuzzyName(name)
+ if users.length is 1
+ user = users[0]
+ if user.phone == phone
+ msg.send "I know."
+ else
+ user.phone = phone
+ msg.send "Ok, #{name} has phone #{phone}."
+ else if users.length > 1
+ msg.send getAmbiguousUserText users
+ else
+ msg.send "I don't know anything about #{name}."
+
+
+
+ robot.respond /@?give me the phone number to ([\w .-_]+)*/i, (msg) ->
+ name = msg.match[1]
+ users = robot.usersForFuzzyName(name)
+ if users.length is 1
+ user = users[0]
+ if user.phone.length < 1
+ msg.send "#{user.name} has no phone, set it first!"
+ else
+ msg.send "#{user.name} has phone number #{user.phone}."
+ else if users.length > 1
+ msg.send getAmbiguousUserText users
+ else
+ msg.send "I don't know anything about #{name}."
Oops, something went wrong.

0 comments on commit 5f6d0a9

Please sign in to comment.