├── .gitignore ├── bin └── hubot ├── Makefile ├── src └── scripts │ ├── bij.coffee │ ├── put-it-back.coffee │ ├── disassemble.coffee │ ├── botsnack.coffee │ ├── do-it-live.coffee │ ├── sweetdude.coffee │ ├── applause.coffee │ ├── hideyakids.coffee │ ├── coin.coffee │ ├── megusta.coffee │ ├── bees.coffee │ ├── clark.coffee │ ├── fortune.coffee │ ├── sudo.coffee │ ├── commitmessage.coffee │ ├── wat.coffee │ ├── ascii.coffee │ ├── sigh.coffee │ ├── inigo-montoya.coffee │ ├── cleverbot.coffee │ ├── decide.coffee │ ├── cowsay.coffee │ ├── lmgtfy.coffee │ ├── giftv.coffee │ ├── chat.coffee │ ├── look-of-disapproval.coffee │ ├── thebattle.coffee │ ├── javascript-sandbox.coffee │ ├── whos-turn.coffee │ ├── base64.coffee │ ├── rimshot.coffee │ ├── tweet-content.coffee │ ├── xmas.js │ ├── nettipot.coffee │ ├── nice.coffee │ ├── eval.coffee │ ├── dealwithit.coffee │ ├── mtg.coffee │ ├── stocks.coffee │ ├── quickmeme.coffee │ ├── cheerlights.coffee │ ├── twss.coffee │ ├── goooood.coffee │ ├── stock.coffee │ ├── yomama.coffee │ ├── which-do-you-prefer.coffee │ ├── flying-high.coffee │ ├── insult.coffee │ ├── auto-stache.coffee │ ├── tryerlang.coffee │ ├── twitter.coffee │ ├── bing.coffee │ ├── corgime.coffee │ ├── google.coffee │ ├── alot.coffee │ ├── pizza.coffee │ ├── cheer.coffee │ ├── hardradio.coffee │ ├── file-brain.coffee │ ├── fml.coffee │ ├── http-say.coffee │ ├── talklikewarrenellis.coffee │ ├── bang-bang.coffee │ ├── carlton.coffee │ ├── cat.coffee │ ├── xkcd.coffee │ ├── destiny.coffee │ ├── sheits.coffee │ ├── isup.coffee │ ├── rubygems.coffee │ ├── serenity.coffee │ ├── shorten.coffee │ ├── demolition-man.coffee │ ├── lyrics.coffee │ ├── tweet.coffee │ ├── aww.coffee │ ├── achievement_unlocked.coffee │ ├── wolfram.coffee │ ├── punchfork.coffee │ ├── walmart.coffee │ ├── travis.coffee │ ├── defprogramming.coffee │ ├── yuno.coffee │ ├── roll.coffee │ ├── quote.coffee │ ├── jordan.coffee │ ├── lastfm_np.coffee │ ├── pokefacts.coffee │ ├── horse.coffee │ ├── sensitive.coffee │ ├── reddit-jokes.coffee │ ├── eight-ball.coffee │ ├── ruby.coffee │ ├── fibonacci.coffee │ ├── dilbert.coffee │ ├── bitbucket.coffee │ ├── clojure.coffee │ ├── urban.coffee │ ├── octocat.coffee │ ├── ive.coffee │ ├── modulepuppy.coffee │ ├── gemwhois.coffee │ ├── github-issue-link.coffee │ ├── myappstatus.coffee │ ├── wheninaustin.coffee │ ├── kittens.coffee │ ├── illogical.coffee │ ├── redis-brain.coffee │ ├── buscemi.coffee │ ├── chuck-norris.coffee │ ├── store-messages-couchdb.coffee │ ├── hashing.coffee │ ├── filmwise.coffee │ ├── wits.coffee │ ├── romanemperor.coffee │ ├── http-info.coffee │ ├── tell.coffee │ ├── url.coffee │ ├── ackbar.coffee │ ├── facepalm.coffee │ ├── spotify.coffee │ ├── penny-arcade.coffee │ ├── animal.coffee │ ├── good-night.coffee │ ├── celery-man.coffee │ ├── likeaboss.coffee │ ├── rageface.coffee │ ├── bing-images.coffee │ ├── swanson.coffee │ ├── dnsimple.coffee │ ├── whatis.coffee │ ├── faceup.coffee │ ├── rsstodolist.coffee │ ├── github-activity.coffee │ ├── google-search-api.coffee │ ├── complete.coffee │ ├── days_since.coffee │ ├── yoda-pictures.coffee │ ├── adult.coffee │ ├── webshot.coffee │ ├── tumblr.coffee │ ├── uptime.coffee │ ├── getajob.coffee │ ├── gosling.coffee │ ├── gifbin.coffee │ ├── lolz.coffee │ ├── haters.coffee │ ├── archer.coffee │ ├── dribbble.coffee │ ├── cricket.coffee │ ├── brewerydb.coffee │ ├── mta.coffee │ ├── cloudapp.coffee │ ├── dice.coffee │ ├── ping.coffee │ ├── resque.coffee │ ├── ambush.coffee │ ├── rotten.coffee │ ├── 9gag.coffee │ ├── directions.coffee │ ├── trajectorystorylisten.coffee │ ├── polite.coffee │ ├── joinme-generator.coffee │ ├── coderwall.coffee │ ├── reddit.coffee │ ├── linsanity.coffee │ ├── fuck_yeah_nouns.coffee │ ├── chm.coffee │ ├── iwdrm.coffee │ ├── manatee.coffee │ ├── iced-coffee-weather.coffee │ ├── github-credentials.coffee │ ├── scoutapp.coffee │ ├── shipit.coffee │ ├── newrelic.coffee │ ├── news.coffee │ ├── base36.coffee │ ├── base58.coffee │ ├── speak.coffee │ ├── gtalk.coffee │ ├── pivotalstorylisten.coffee │ ├── itcrowd.coffee │ ├── beerme.coffee │ ├── snow.coffee │ ├── tasks.coffee │ ├── github-commiters.coffee │ ├── abstract.coffee │ ├── stagehand.coffee │ ├── git-help.coffee │ ├── sms.coffee │ └── pypi.coffee ├── test ├── scripts │ ├── hubot_test.coffee │ ├── speak_test.coffee │ ├── isup_test.coffee │ └── github-issues_test.coffee └── tests.coffee ├── package.json └── LICENSE.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | .DS_Store* 4 | .idea 5 | 6 | -------------------------------------------------------------------------------- /bin/hubot: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | npm install 4 | export PATH="node_modules/.bin:node_modules/hubot/node_modules/.bin:$PATH" 5 | 6 | exec node_modules/.bin/hubot "$@" 7 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | test: deps 2 | @find test -name '*.coffee' | xargs -n 1 -t coffee 3 | 4 | dev: generate-js 5 | @coffee -wc --bare -o lib src/*.coffee 6 | 7 | generate-js: 8 | @find src -name '*.coffee' | xargs coffee -c -o lib 9 | 10 | remove-js: 11 | @rm -fr lib/ 12 | 13 | deps: 14 | 15 | .PHONY: all 16 | -------------------------------------------------------------------------------- /src/scripts/bij.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # EXPERIENCE BIJ 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # 12 | # Author: 13 | # mrtazz 14 | 15 | module.exports = (robot) -> 16 | robot.hear /bij/i, (msg) -> 17 | msg.send "EXPERIENCE BIJ!" 18 | -------------------------------------------------------------------------------- /src/scripts/put-it-back.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # put back the table 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # 12 | # Author: 13 | # ajacksified 14 | 15 | module.exports = (robot) -> 16 | robot.hear /(╯°□°)╯︵ ┻━┻/i, (msg) -> 17 | msg.send('┬──┬ ノ( ゜-゜ノ)') 18 | -------------------------------------------------------------------------------- /src/scripts/disassemble.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # None 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # disassemble - NO DISASSEMBLE 12 | # 13 | # Author: 14 | # listrophy 15 | 16 | module.exports = (robot) -> 17 | robot.hear /disassemble/i, (msg) -> 18 | msg.send 'NO DISASSEMBLE!' 19 | -------------------------------------------------------------------------------- /src/scripts/botsnack.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Hubot enjoys delicious snacks 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # botsnack - give the boot a food 12 | # 13 | # Author: 14 | # richo 15 | 16 | module.exports = (robot) -> 17 | robot.hear /^botsnack/i, (msg) -> 18 | msg.send ":D" 19 | -------------------------------------------------------------------------------- /src/scripts/do-it-live.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Fuck it, we'll do it live! 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # 12 | # Author: 13 | # stewart 14 | 15 | module.exports = (robot) -> 16 | robot.hear /do it live/i, (msg) -> 17 | msg.send "http://rationalmale.files.wordpress.com/2011/09/doitlive.jpeg" 18 | -------------------------------------------------------------------------------- /src/scripts/sweetdude.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # None 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # 12 | # Author: 13 | # cgarvis 14 | 15 | module.exports = (robot) -> 16 | robot.hear /^(sweet|dude)!/i, (msg) -> 17 | switch msg.match[1].toLowerCase() 18 | when "sweet" then msg.send "Dude!" 19 | when "dude" then msg.send "Sweet!" 20 | -------------------------------------------------------------------------------- /src/scripts/applause.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Applause from Orson Welles 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # (applause|applaud|bravo|slow clap) - Get applause 12 | # 13 | # Author: 14 | # joshfrench 15 | 16 | module.exports = (robot) -> 17 | robot.hear /applau(d|se)|bravo|slow clap/i, (msg) -> 18 | msg.send "http://i.imgur.com/9Zv4V.gif" -------------------------------------------------------------------------------- /src/scripts/hideyakids.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Antoine Dodson's greatest hits... errr... only hit 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hide ya kids - Hide `em! 12 | # 13 | # Author: 14 | # Joseph Huttner 15 | 16 | module.exports = (robot) -> 17 | robot.hear /hide ya kids/i, (msg) -> 18 | msg.send "http://www.youtube.com/watch?v=hMtZfW2z9dw" 19 | -------------------------------------------------------------------------------- /src/scripts/coin.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Help decide between two things 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot throw a coin - Gives you heads or tails 12 | # 13 | # Author: 14 | # mrtazz 15 | 16 | thecoin = ["heads", "tails"] 17 | 18 | module.exports = (robot) -> 19 | robot.respond /(throw|flip|toss) a coin/i, (msg) -> 20 | msg.reply msg.random thecoin 21 | -------------------------------------------------------------------------------- /src/scripts/megusta.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Happiness in image form 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # me gusta - Display "Me Gusta" face when heard 12 | # 13 | # Author: 14 | # phyreman 15 | 16 | module.exports = (robot) -> 17 | robot.hear /me gusta/i, (msg) -> 18 | msg.send "http://s3.amazonaws.com/kym-assets/entries/icons/original/000/002/252/me-gusta.jpg" 19 | -------------------------------------------------------------------------------- /src/scripts/bees.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Bees are insane 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot bees - Oprah at her finest, or a good way to turn the fans on coworkers machines 12 | # 13 | # Author: 14 | # atmos 15 | 16 | module.exports = (robot) -> 17 | robot.respond /bees/i, (message) -> 18 | message.send "http://thechive.files.wordpress.com/2010/11/oprah-bees.gif" 19 | -------------------------------------------------------------------------------- /src/scripts/clark.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # None 3 | # 4 | # Dependencies: 5 | # "clark": "0.0.5" 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot clark - build sparklines out of data 12 | # 13 | # Author: 14 | # ajacksified 15 | 16 | clark = require('clark').clark 17 | 18 | module.exports = (robot) -> 19 | robot.respond /clark (.*)/i, (msg) -> 20 | data = msg.match[1].trim().split(' ') 21 | msg.send(clark(data)) 22 | 23 | -------------------------------------------------------------------------------- /src/scripts/fortune.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Get a fortune 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot fortune me - Displays a super true fortune 12 | # 13 | # Author: 14 | # mrtazz 15 | 16 | module.exports = (robot) -> 17 | robot.respond /(fortune)( me)?/i, (msg) -> 18 | msg.http('http://www.fortunefortoday.com/getfortuneonly.php') 19 | .get() (err, res, body) -> 20 | msg.reply body 21 | -------------------------------------------------------------------------------- /src/scripts/sudo.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Forces hubot to do what you want, even if he doesn't know how 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot sudo - Force hubot to do what you want 12 | # 13 | # Author: 14 | # searls 15 | 16 | module.exports = (robot) -> 17 | robot.respond /(sudo)(.*)/i, (msg) -> 18 | msg.send "Alright. I'll #{msg.match?[2] || "do whatever it is you wanted."}" 19 | -------------------------------------------------------------------------------- /test/scripts/hubot_test.coffee: -------------------------------------------------------------------------------- 1 | # Tests hubot listeners 2 | module.exports = (robot) -> 3 | assert = require 'assert' 4 | 5 | robot.hear /test/i, (msg) -> 6 | msg.send "OK" 7 | 8 | robot.hear /reply/i, (msg) -> 9 | msg.reply "OK" 10 | 11 | robot.hear /random/i, (msg) -> 12 | msg.send msg.random([1,2]).toString() 13 | 14 | robot.hear /http/i, (msg) -> 15 | msg.http('http://127.0.0.1').port(9001) 16 | .get() (err, res, body) -> 17 | msg.send body 18 | -------------------------------------------------------------------------------- /src/scripts/commitmessage.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Get a random commit message 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot commit message - Displays a random commit message 12 | # 13 | # Author: 14 | # mrtazz 15 | 16 | module.exports = (robot) -> 17 | robot.respond /commit message/i, (msg) -> 18 | msg.http("http://whatthecommit.com/index.txt") 19 | .get() (err, res, body) -> 20 | msg.reply body 21 | -------------------------------------------------------------------------------- /src/scripts/wat.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Get a random WAT image - warning, this includes NSFW content! 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot wat - Random WAT 12 | # 13 | # Author: 14 | # john-griffin 15 | 16 | module.exports = (robot) -> 17 | 18 | robot.respond /wat/i, (msg) -> 19 | msg.http("http://watme.herokuapp.com/random") 20 | .get() (err, res, body) -> 21 | msg.send JSON.parse(body).wat 22 | -------------------------------------------------------------------------------- /src/scripts/ascii.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # ASCII art 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot ascii me - Show text in ascii art 12 | # 13 | # Author: 14 | # atmos 15 | 16 | module.exports = (robot) -> 17 | robot.respond /ascii( me)? (.+)/i, (msg) -> 18 | msg 19 | .http("http://asciime.heroku.com/generate_ascii") 20 | .query(s: msg.match[2]) 21 | .get() (err, res, body) -> 22 | msg.send body 23 | -------------------------------------------------------------------------------- /src/scripts/sigh.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # http://xkcd.com/1009/ 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # 12 | # Author: 13 | # eighnjel 14 | 15 | module.exports = (robot) -> 16 | sigh_counter = 0 17 | 18 | robot.hear /(^|\W)[s]+[i]+[g]+[h]+(\z|\W|$)/i, (msg) -> 19 | if sigh_counter == 3 20 | sigh_counter = 0 21 | msg.send "I work out" 22 | else 23 | sigh_counter += 1 24 | msg.send "Girl look at that body" 25 | -------------------------------------------------------------------------------- /src/scripts/inigo-montoya.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # None 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # 12 | # Author: 13 | # harukizaemon 14 | 15 | module.exports = (robot) -> 16 | robot.hear /inconceivable/i, (msg) -> 17 | msg.reply "You keep using that word. I do not think it means what you think it means." 18 | 19 | robot.hear /(inigo|montoya)/i, (msg) -> 20 | msg.reply "Hello. My name is Inigo Montoya. You killed my father. Prepare to die." 21 | -------------------------------------------------------------------------------- /src/scripts/cleverbot.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # "Makes your Hubot even more Clever™" 3 | # 4 | # Dependencies: 5 | # "cleverbot-node": "0.1.1" 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot c 12 | # 13 | # Authors: 14 | # ajacksified 15 | 16 | cleverbot = require('cleverbot-node') 17 | 18 | module.exports = (robot) -> 19 | c = new cleverbot() 20 | 21 | robot.respond /c (.*)/i, (msg) -> 22 | data = msg.match[1].trim() 23 | c.write(data, (c) => msg.send(c.message)) 24 | 25 | -------------------------------------------------------------------------------- /src/scripts/decide.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Allows Hubot to help you decide between multiple options 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot decide "" "" "" - Randomly picks an option 12 | # 13 | # Authors: 14 | # logikal 15 | 16 | module.exports = (robot) -> 17 | robot.respond /decide "(.*)"/i, (msg) -> 18 | options = msg.match[1].split('" "') 19 | msg.reply("Definitely \"#{ msg.random options }\".") 20 | -------------------------------------------------------------------------------- /src/scripts/cowsay.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Cowsay. 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot cowsay - Returns a cow that says what you want 12 | # 13 | # Author: 14 | # brettbuddin 15 | 16 | module.exports = (robot) -> 17 | robot.respond /cowsay( me)? (.*)/i, (msg) -> 18 | msg 19 | .http("http://cowsay.morecode.org/say") 20 | .query(format: 'text', message: msg.match[2]) 21 | .get() (err, res, body) -> 22 | msg.send body 23 | -------------------------------------------------------------------------------- /src/scripts/lmgtfy.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Tell Hubot to send a user a link to lmgtfy.com 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot lmgtfy 12 | # 13 | # Author: 14 | # phlipper 15 | 16 | module.exports = (robot) -> 17 | robot.respond /lmgtfy?\s?(?:@(\w*))? (.*)/i, (msg) -> 18 | link = "" 19 | link += "#{msg.match[1]}: " if msg.match[1] 20 | link += "http://lmgtfy.com/?q=#{escape(msg.match[2])}" 21 | msg.send link 22 | -------------------------------------------------------------------------------- /src/scripts/giftv.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Return random animated GIFs from giftv 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot giftv me - Returns a random animated GIF 12 | # 13 | # Author: 14 | # brettbuddin 15 | 16 | module.exports = (robot) -> 17 | robot.respond /giftv( me)?$/i, (msg) -> 18 | msg 19 | .http('http://www.gif.tv/gifs/get.php') 20 | .get() (err, res, body) -> 21 | msg.send 'http://www.gif.tv/gifs/' + body + '.gif' || 'Could not compute.' 22 | -------------------------------------------------------------------------------- /src/scripts/chat.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Start up some wonderful chats with conversation starters 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot chat - Tell hubot to make something fun to chat about 12 | # 13 | # Author: 14 | # GantMan 15 | 16 | module.exports = (robot) -> 17 | robot.respond /chat/i, (msg) -> 18 | msg.http("http://chatoms.com/chatom.json?Normal=1&Fun=2&Philosophy=3&Out+There=4&Love=5&Personal=7") 19 | .get() (err, res, body) -> 20 | msg.send JSON.parse(body).text 21 | -------------------------------------------------------------------------------- /src/scripts/look-of-disapproval.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Allows Hubot to give a look of disapproval 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot lod - gives back the character for the look of disapproval, optionally @name 12 | # 13 | # Author: 14 | # ajacksified 15 | 16 | module.exports = (robot) -> 17 | robot.respond /lod\s?(.*)/i, (msg) -> 18 | response = 'ಠ_ಠ' 19 | 20 | name = msg.match[1].trim() 21 | response += " @" + name if name != "" 22 | 23 | msg.send(response) 24 | -------------------------------------------------------------------------------- /src/scripts/thebattle.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Display "The Battle" image 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # knowing is half the battle - display "The Battle" image 12 | # 13 | # Author: 14 | # coyled 15 | 16 | thebattle = [ 17 | "http://static2.nerduo.com/thebattle_zoom.png", 18 | "http://img.skitch.com/20090805-g4a2qhttwij8n2jr9t552efn3k.png" 19 | ] 20 | 21 | module.exports = (robot) -> 22 | robot.hear /knowing is half the battle/i, (msg) -> 23 | msg.send msg.random thebattle 24 | -------------------------------------------------------------------------------- /src/scripts/javascript-sandbox.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # sandbox - run javascript in a sandbox! 3 | # 4 | # Dependencies: 5 | # "sandbox": "0.8.3" 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot (run|sandbox) - Execute the javascript code 12 | # 13 | # Author: 14 | # ajacksified 15 | 16 | Sandbox = require('Sandbox') 17 | 18 | module.exports = (robot) -> 19 | robot.respond /(run|sandbox) (.*)/i, (msg) -> 20 | sandbox = new Sandbox 21 | sandbox.run(msg.match[2], (output) -> 22 | msg.send output.result 23 | ) 24 | -------------------------------------------------------------------------------- /src/scripts/whos-turn.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Who's turn to do something? 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot who ? - Returns who does ! 12 | # 13 | # Author: 14 | # KuiKui 15 | 16 | module.exports = (robot) -> 17 | robot.respond /(who|qui) (.+)\?/i, (msg) -> 18 | users = [] 19 | for own key, user of robot.brain.data.users 20 | users.push "#{user.name}" if "#{user.name}" != robot.name 21 | msg.send (msg.random users).split(" ")[0] + " " + msg.match[2] + "!" 22 | -------------------------------------------------------------------------------- /src/scripts/base64.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Base64 encoding and decoding 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot base64 encode|decode - Base64 encode or decode 12 | # 13 | # Author: 14 | # jimeh 15 | 16 | module.exports = (robot) -> 17 | robot.respond /base64 encode( me)? (.*)/i, (msg) -> 18 | msg.send new Buffer(msg.match[2]).toString('base64') 19 | 20 | robot.respond /base64 decode( me)? (.*)/i, (msg) -> 21 | msg.send new Buffer(msg.match[2], 'base64').toString('utf8') 22 | -------------------------------------------------------------------------------- /src/scripts/rimshot.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Emphasize a joke 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # rimshot - Link to a short video of a rimshot 12 | # 13 | # Author: 14 | # mrtazz 15 | 16 | shots = [ 17 | 'http://www.youtube.com/watch?v=DH5p5iMEbrE', 18 | 'http://www.youtube.com/watch?v=6zXDo4dL7SU', 19 | 'http://www.youtube.com/watch?v=GnOl4VcV5ng', 20 | 'http://www.youtube.com/watch?v=3gPV2wzNNyo' 21 | ] 22 | 23 | module.exports = (robot) -> 24 | robot.hear /rimshot/i, (msg) -> 25 | msg.send msg.random shots 26 | -------------------------------------------------------------------------------- /src/scripts/tweet-content.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Detect tweet URL and send tweet content 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # 12 | # Author: 13 | # Vrtak-CZ 14 | 15 | module.exports = (robot) -> 16 | robot.hear /https?:\/\/(mobile\.)?twitter\.com\/.*?\/status\/([0-9]+)/i, (msg) -> 17 | msg.http("https://api.twitter.com/1/statuses/show/#{msg.match[2]}.json").get() (err, res, body) -> 18 | return if err or (res.statusCode != 200) 19 | 20 | tweet = JSON.parse(body) 21 | 22 | msg.send "@#{tweet.user.screen_name}: #{tweet.text}" 23 | -------------------------------------------------------------------------------- /src/scripts/xmas.js: -------------------------------------------------------------------------------- 1 | // Description: 2 | // xmas detector script 3 | // 4 | // Dependencies: 5 | // None 6 | // 7 | // Configuration: 8 | // None 9 | // 10 | // Commands: 11 | // hubot is it xmas ? - returns whether is it christmas or not 12 | // hubot is it christmas ? - returns whether is it christmas or not 13 | // 14 | // Author: 15 | // Johnny G. Halife 16 | 17 | module.exports = function(robot) { 18 | robot.respond(/is it (xmas|christmas)\s?\?/i, function(msg){ 19 | var today = new Date(); 20 | 21 | msg.reply(today.getDate() == 25 && (today.getMonth() + 1) == 12 ? "YES" : "NO"); 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /src/scripts/nettipot.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # None 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot nettipot - Send scarring, horrifying image of a nettipot in use. 12 | # 13 | # Author 14 | # alexpgates 15 | 16 | nettipot = "http://i.imgur.com/EIqdZ.gif" 17 | 18 | module.exports = (robot) -> 19 | robot.respond /nettipot/i, (msg) -> 20 | msg.send nettipot 21 | 22 | robot.respond /nettibomb/i, (msg) -> 23 | msg.send nettipot 24 | msg.send nettipot 25 | msg.send nettipot 26 | msg.send nettipot 27 | msg.send nettipot 28 | -------------------------------------------------------------------------------- /src/scripts/nice.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Fill your chat with some kindness 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot be nice - just gives some love :) 12 | # 13 | # Author: 14 | # nesQuick 15 | 16 | hugs = [ 17 | "You are awesome!", 18 | "A laugh is a smile that bursts.", 19 | "=)", 20 | "Everyone smiles in the same language.", 21 | "Thank you for installing me." 22 | ] 23 | 24 | module.exports = (robot)-> 25 | robot.respond /be nice/i, (message)-> 26 | rnd = Math.floor Math.random() * hugs.length 27 | message.send hugs[rnd] 28 | -------------------------------------------------------------------------------- /src/scripts/eval.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # evaluate code 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot eval me - evaluate and show the result 12 | # 13 | # Author: 14 | # aanoaa 15 | 16 | module.exports = (robot) -> 17 | robot.respond /eval( me)? ([^ ]+) (.+)/i, (msg) -> 18 | msg 19 | .http("http://api.dan.co.jp/lleval.cgi") 20 | .query(s: "#!/usr/bin/#{msg.match[2]}\n#{msg.match[3]}") 21 | .get() (err, res, body) -> 22 | out = JSON.parse(body) 23 | msg.send if out.stderr then out.stderr else out.stdout 24 | -------------------------------------------------------------------------------- /src/scripts/dealwithit.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Display a "deal with it" gif 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # deal with it - display a "deal with it" gif 12 | # 13 | # Author: 14 | # brianstanwyck 15 | 16 | deal = [ 17 | "http://i.imgur.com/ykDuU.gif", 18 | "http://i.imgur.com/3PWHn.gif", 19 | "http://i.imgur.com/sEinL.gif", 20 | "http://i.imgur.com/zsK7e.gif", 21 | "http://i.imgur.com/rE2aH.gif", 22 | "http://i.imgur.com/Wj3Do.gif" 23 | ] 24 | 25 | module.exports = (robot) -> 26 | robot.hear /deal with it/i, (msg)-> 27 | msg.send msg.random deal 28 | -------------------------------------------------------------------------------- /src/scripts/mtg.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Insert Pictures of Magic: The Gathering Cards 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot cast - a picture of the named magic card 12 | # 13 | # Author: 14 | # djljr 15 | 16 | querystring = require 'querystring'; 17 | 18 | module.exports = (robot) -> 19 | robot.respond /cast (.+)/i, (msg) -> 20 | url = "http://gatherer.wizards.com/Handlers/Image.ashx" 21 | card = msg.match[1] || "Dismal%20Failure" 22 | query = { type: "card", name: card } 23 | msg.send "#{url}?#{querystring.stringify(query)}#.jpg" 24 | -------------------------------------------------------------------------------- /src/scripts/stocks.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Finance charts 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot stock me - show today's stock chart for 12 | # hubot stock me -(5d|2w|2mon|1y) - show stock chart for 13 | # 14 | # Author: 15 | # maddox 16 | 17 | module.exports = (robot) -> 18 | 19 | robot.respond /stock( me)?( -(\d+\w+))? (.*)/i, (msg) -> 20 | ticker = msg.match[4] 21 | time = msg.match[3] || '1d' 22 | msg.send "http://chart.finance.yahoo.com/z?s=#{ticker}&t=#{time}&q=l&l=on&z=l&a=v&p=s&lang=en-US®ion=US#.png" 23 | -------------------------------------------------------------------------------- /src/scripts/quickmeme.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Allow Hubot to show the image from a quickmeme link, as dragging 3 | # from their site is a pain. 4 | # 5 | # Dependencies: 6 | # None 7 | # 8 | # Configuration: 9 | # None 10 | # 11 | # Commands: 12 | # http://www.quickmeme.com/meme/* - Detects the url and displays the image 13 | # 14 | # Author: 15 | # chrisdrackett 16 | 17 | module.exports = (robot) -> 18 | robot.hear /https?:\/\/www\.quickmeme\.com\/\w+\/(\w+)\//i, (msg) -> 19 | return if msg.match[2] # Ignore already embedded images. 20 | 21 | id = msg.match[1] 22 | 23 | msg.send "http://i.qkme.me/" + id + ".jpg" 24 | -------------------------------------------------------------------------------- /src/scripts/cheerlights.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # None 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot cheerlights - get last color from http://www.cheerlights.com 12 | # 13 | # Author: 14 | # marciotoshio 15 | 16 | module.exports = (robot) -> 17 | robot.respond /cheerlights/i, (msg) -> 18 | msg.http("http://api.thingspeak.com/channels/1417/field/1/last.json") 19 | .get() (err, res, body) -> 20 | response = JSON.parse body 21 | if response 22 | msg.send "The last color is: " + response["field1"] 23 | else 24 | msg.send "Error" 25 | -------------------------------------------------------------------------------- /src/scripts/twss.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Hubot will respond to (in)appropriate lines with "That's what she said" 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot - Hubot will "that's what she said" that ish 12 | # 13 | # Author: 14 | # dhchow 15 | 16 | module.exports = (robot) -> 17 | robot.respond /.*(big|small|long|hard|soft|mouth|face|good|fast|slow|in there|on there|in that|on that|wet|dry|on the|in the|suck|blow|jaw|all in|fit that|fit it|hurts|hot|huge|balls|stuck)/i, (msg) -> 18 | msg.send "THAT'S WHAT SHE SAID!" 19 | -------------------------------------------------------------------------------- /src/scripts/goooood.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Listens for "good" but with 3 or more "o"s 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commnads: 11 | # gooo+d 12 | # 13 | # Author: 14 | # tbwIII 15 | 16 | darths = [ 17 | "http://images4.wikia.nocookie.net/__cb20080808031313/starwars/images/thumb/d/d4/Palpycropped.jpg/250px-Palpycropped.jpg", 18 | "http://www.vamortgagecenter.com/blog/wp-content/uploads/2011/07/sidious.jpg", 19 | "http://torwars.com/wp-content/uploads/2011/10/darth-sidious.jpg" 20 | ] 21 | 22 | module.exports = (robot) -> 23 | robot.hear /gooo+d/i, (msg) -> 24 | msg.send msg.random darths 25 | -------------------------------------------------------------------------------- /src/scripts/stock.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Get a stock price 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # stock for - Get a stock price 12 | # 13 | # Author: 14 | # eliperkins 15 | 16 | module.exports = (robot) -> 17 | robot.respond /stock (info|price|quote) for @?([\w .-_]+)/i, (msg) -> 18 | ticker = escape(msg.match[2]) 19 | msg.http('http://finance.google.com/finance/info?client=ig&q=' + ticker) 20 | .get() (err, res, body) -> 21 | result = JSON.parse(body.replace(/\/\/ /, '')) 22 | 23 | msg.send result[0].l_cur + "(#{result[0].c})" 24 | -------------------------------------------------------------------------------- /src/scripts/yomama.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # None 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot yo mama joke me - Returns a random Yo Mama joke 12 | # 13 | # Author: 14 | # victorbutler 15 | 16 | module.exports = (robot) -> 17 | robot.respond /(yo\s?mama( joke)?)( me)?/i, (msg) -> 18 | yoMama msg, (url) -> 19 | msg.send url 20 | 21 | yoMama = (msg, cb) -> 22 | msg.http('http://www.yomamajokesdb.com/random-joke/') 23 | .get() (err, res, body) -> 24 | cb body.match(/
([^\<]+)<\/div>/)?[1] || "Sorry, this joke is very inappropriate (or could not be found)" 25 | 26 | -------------------------------------------------------------------------------- /src/scripts/which-do-you-prefer.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Which does hubot like best? Find out. 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot which do you prefer: or [.. or ]? 12 | # 13 | # Author: 14 | # ajacksified 15 | 16 | module.exports = (robot) -> 17 | robot.respond /(which )?do you (like|like best|prefer)[:,\s]? (.*)$/i, (msg) -> 18 | split = msg.match[3].split(" or ") 19 | thing = split[(Math.random() * split.length) >> 0] 20 | 21 | if thing[thing.length-1] == '?' then thing = thing[0..thing.length-2] 22 | 23 | msg.send("I #{msg.match[2]} #{thing}.") 24 | -------------------------------------------------------------------------------- /src/scripts/flying-high.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # None 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # 12 | # Author: 13 | # harukizaemon 14 | 15 | module.exports = (robot) -> 16 | 17 | robot.hear /surely you/i, (msg) -> 18 | msg.reply "I am, and don't call me Shirley." 19 | 20 | robot.hear /I can'?t .* tell/i, (msg) -> 21 | msg.reply "You can tell me. I'm a doctor." 22 | 23 | robot.hear /I('?ve| have) never/i, (msg) -> 24 | msg.reply "You ever seen a grown man naked?" 25 | 26 | robot.hear /hospital\?/i, (msg) -> 27 | msg.reply "It's a big building with patients, but that's not important right now." 28 | -------------------------------------------------------------------------------- /src/scripts/insult.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # None 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot insult - give the what-for 12 | # 13 | # Author: 14 | # ajacksified 15 | 16 | module.exports = (robot) -> 17 | robot.respond /insult (.*)/i, (msg) -> 18 | name = msg.match[1].trim() 19 | msg.send(insult(name)) 20 | 21 | insult = (name) -> 22 | insults[(Math.random() * insults.length) >> 0].replace(/{name}/, name); 23 | 24 | insults = [ 25 | "{name} is a scoundrel.", 26 | "{name} should be ashamed of himself.", 27 | "{name} is a motherless son of a goat.", 28 | "{name} is a gravy-sucking pig." 29 | ] 30 | -------------------------------------------------------------------------------- /test/scripts/speak_test.coffee: -------------------------------------------------------------------------------- 1 | Tests = require('../tests') 2 | assert = require 'assert' 3 | helper = Tests.helper() 4 | 5 | require('../../src/scripts/speak') helper 6 | 7 | process.env.HUBOT_MSTRANSLATE_APIKEY ||= "0xDEADBEEF" 8 | 9 | # start up a danger room for hubt speak 10 | danger = Tests.danger helper, (req, res, url) -> 11 | res.writeHead 200 12 | res.end JSON.stringify( 13 | {responseData: {results: [ 14 | {unescapedUrl: url.query } 15 | ]}} 16 | ) 17 | 18 | # callbacks for when hubot sends messages 19 | tests = [ 20 | (msg) -> assert.equal "", msg 21 | ] 22 | 23 | # run the async tests 24 | danger.start tests, -> 25 | helper.receive 'hubot speak me Ich bin ein Berliner' 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hubot-scripts", 3 | "version": "2.1.1", 4 | "author": "hubot", 5 | "keywords": "hubot plugin scripts campfire bot robot", 6 | "description": "Allows you to opt in to a variety of scripts", 7 | "licenses": [{ 8 | "type": "MIT", 9 | "url": "http://github.com/github/hubot-scripts/raw/master/LICENSE" 10 | }], 11 | 12 | "repository" : { 13 | "type" : "git", 14 | "url" : "https://github.com/github/hubot-scripts.git" 15 | }, 16 | 17 | "dependencies": { 18 | "hubot": ">= 2.3.0", 19 | "redis": "0.7.2" 20 | }, 21 | 22 | "directories": { 23 | "lib": "./src" 24 | }, 25 | "engine": "node >= 0.4.1" 26 | } 27 | -------------------------------------------------------------------------------- /src/scripts/auto-stache.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Automatically add mustaches to any images it can 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # None 12 | # 13 | # Author: 14 | # atmos 15 | 16 | module.exports = (robot) -> 17 | robot.hear /^(https?:\/\/[^ #]+\.(?:png|jpg|jpeg))(?:[#]\.png)?$/i, (msg) -> 18 | src = msg.match[1] 19 | 20 | unless src.match(/^http:\/\/mustachify.me/) 21 | msg.http("http://stacheable.herokuapp.com") 22 | .query(src: src) 23 | .get() (err, res, body) -> 24 | img = JSON.parse body 25 | 26 | if img.count > 0 27 | msg.send "http://mustachify.me/?src=#{escape img.src}" 28 | -------------------------------------------------------------------------------- /src/scripts/tryerlang.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # None 3 | # 4 | # Dependencies: 5 | # "querystring": "0.1.0" 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot erl - Evaluate an Erlang Expression on tryerlang.org and return the result 12 | # 13 | # Author: 14 | # Roberto Aloi (@robertoaloi) 15 | 16 | QS = require "querystring" 17 | 18 | module.exports = (robot) -> 19 | robot.respond /(tryerlang|erl) (.*)/i, (msg) -> 20 | expr = msg.match[2] 21 | data = QS.stringify({'expression': expr}) 22 | msg.http('http://www.tryerlang.org/api/eval/default/intro') 23 | .post(data) (err, res, body) -> 24 | response = JSON.parse(body) 25 | msg.send response.result 26 | -------------------------------------------------------------------------------- /src/scripts/twitter.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # gets tweet from user 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot twitter - Show last tweet from 12 | # 13 | # Author: 14 | # KevinTraver 15 | # 16 | module.exports = (robot) -> 17 | robot.respond /(twitter|lasttweet) (.+)$/i, (msg) -> 18 | username = msg.match[2] 19 | msg.http("http://api.twitter.com/1/statuses/user_timeline/#{escape(username)}.json?count=1&include_rts=true") 20 | .get() (err, res, body) -> 21 | response = JSON.parse body 22 | if response[0] 23 | msg.send response[0]["text"] 24 | else 25 | msg.send "Error" 26 | -------------------------------------------------------------------------------- /src/scripts/bing.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Returns the URL of the first bing hit for a query 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot bing me - Bings & returns 1st result's URL 12 | # 13 | # Author: 14 | # Brandon Satrom 15 | 16 | module.exports = (robot) -> 17 | robot.respond /(bing)( me)? (.*)/i, (msg) -> 18 | bingMe msg, msg.match[3], (url) -> 19 | msg.send url 20 | 21 | bingMe = (msg, query, cb) -> 22 | msg.http('http://www.bing.com/search') 23 | .query(q: query) 24 | .get() (err, res, body) -> 25 | cb body.match(/

18 | 19 | robot.respond /corgi me/i, (msg) -> 20 | msg.http("http://corgibomb.heroku.com/random") 21 | .get() (err, res, body) -> 22 | msg.send body 23 | 24 | robot.respond /corgi bomb( (\d+))?/i, (msg) -> 25 | count = msg.match[2] || 5 26 | msg.http("http://corgibomb.heroku.com/bomb/" + count) 27 | .get() (err, res, body) -> 28 | msg.send corgi for corgi in JSON.parse(body) 29 | -------------------------------------------------------------------------------- /src/scripts/google.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Returns the URL of the first google hit for a query 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot google me - Googles & returns 1st result's URL 12 | # 13 | # Author: 14 | # searls 15 | 16 | module.exports = (robot) -> 17 | robot.respond /(google)( me)? (.*)/i, (msg) -> 18 | googleMe msg, msg.match[3], (url) -> 19 | msg.send url 20 | 21 | googleMe = (msg, query, cb) -> 22 | msg.http('http://www.google.com/search') 23 | .query(q: query) 24 | .get() (err, res, body) -> 25 | cb body.match(/class="r">/)?[1] || "Sorry, Google had zero results for '#{query}'" 26 | -------------------------------------------------------------------------------- /src/scripts/alot.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # None 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # alot - Shows a picture of an alot 12 | # 13 | # Author: 14 | # tbwIII 15 | 16 | images = [ 17 | "http://4.bp.blogspot.com/_D_Z-D2tzi14/S8TRIo4br3I/AAAAAAAACv4/Zh7_GcMlRKo/s400/ALOT.png", 18 | "http://3.bp.blogspot.com/_D_Z-D2tzi14/S8TTPQCPA6I/AAAAAAAACwA/ZHZH-Bi8OmI/s1600/ALOT2.png", 19 | "http://2.bp.blogspot.com/_D_Z-D2tzi14/S8TiTtIFjpI/AAAAAAAACxQ/HXLdiZZ0goU/s320/ALOT14.png", 20 | "http://fc02.deviantart.net/fs70/f/2010/210/1/9/Alot_by_chrispygraphics.jpg" 21 | ] 22 | 23 | module.exports = (robot) -> 24 | robot.hear /(^|\W)alot(\z|\W|$)/i, (msg) -> 25 | msg.send msg.random images 26 | -------------------------------------------------------------------------------- /src/scripts/pizza.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Displays a random pizza gif from animatedpizzagifs.com 3 | # 4 | # Dependencies: 5 | # "jsdom": "~0.2.13" 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot pizza - Show a pizza gif 12 | # 13 | # Author: 14 | # iangreenleaf 15 | 16 | jsdom = require "jsdom" 17 | PIZZA = "http://animatedpizzagifs.com" 18 | 19 | module.exports = (robot) -> 20 | robot.respond /pizza/i, (msg) -> 21 | msg.http(PIZZA) 22 | .path("/") 23 | .get() (err, res, body) -> 24 | document = jsdom.jsdom body, null, features: { "QuerySelector": true, 'ProcessExternalResources': false } 25 | img = msg.random document.querySelectorAll "li img" 26 | msg.send "#{PIZZA}/#{img.src}" 27 | -------------------------------------------------------------------------------- /src/scripts/cheer.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Feeling depressed? 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot cheer me up - A little pick me up 12 | # 13 | # Author: 14 | # carllerche 15 | 16 | module.exports = (robot) -> 17 | robot.respond /cheer me up/i, (msg) -> 18 | aww msg 19 | 20 | robot.hear /i( am|'m) emo/i, (msg) -> 21 | msg.send "Let me cheer you up." 22 | aww msg 23 | 24 | aww = (msg) -> 25 | msg 26 | .http('http://imgur.com/r/aww.json') 27 | .get() (err, res, body) -> 28 | images = JSON.parse(body) 29 | images = images.gallery 30 | image = msg.random images 31 | msg.send "http://i.imgur.com/#{image.hash}#{image.ext}" 32 | -------------------------------------------------------------------------------- /src/scripts/hardradio.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # See what's playing on the Heavy Metal Supersite 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot hardradio song - Display the song that's rocking on air 12 | # hubot hardradio listen - Displays a link to play the radio 13 | # 14 | # Author: 15 | # teo-sk 16 | 17 | module.exports = (robot) -> 18 | robot.respond /hardradio listen/i, (msg) -> 19 | msg.send "http://www.hardradio.com/streaming/hardmp3.pls" 20 | 21 | robot.respond /hardradio song/i, (msg) -> 22 | msg.http('http://axl.hardradio.com/playnow.txt') 23 | .get() (err, res, body) -> 24 | body = body.replace(/song=/g, "Tearing your speakers right now: ") 25 | msg.send body 26 | -------------------------------------------------------------------------------- /src/scripts/file-brain.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # None 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # FILE_BRAIN_PATH 9 | # 10 | # Commands: 11 | # None 12 | # 13 | # Author: 14 | # dustyburwell 15 | 16 | fs = require 'fs' 17 | path = require 'path' 18 | 19 | module.exports = (robot) -> 20 | brainPath = process.env.FILE_BRAIN_PATH or '/var/hubot' 21 | brainPath = path.join brainPath, 'brain-dump.json' 22 | 23 | try 24 | data = fs.readFileSync brainPath, 'utf-8' 25 | if data 26 | robot.brain.mergeData JSON.parse(data) 27 | catch error 28 | console.log('Unable to read file', error) unless error.code is 'ENOENT' 29 | 30 | robot.brain.on 'save', (data) -> 31 | fs.writeFileSync brainPath, JSON.stringify(data), 'utf-8' 32 | -------------------------------------------------------------------------------- /src/scripts/fml.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # None 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # fml - A random message from fmylife.com 12 | # 13 | # Author: 14 | # artfuldodger 15 | 16 | module.exports = (robot) -> 17 | robot.respond /fml/i, (msg) -> 18 | fml msg 19 | 20 | fml = (msg) -> 21 | msg 22 | .http('http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&q=http://feeds.feedburner.com/fmylife') 23 | .get() (err, res, body) -> 24 | fmls = JSON.parse(body) 25 | random = Math.round(Math.random() * fmls.responseData.feed.entries.length) 26 | text = fmls.responseData.feed.entries[random].content 27 | text = text[0..text.indexOf('[&room=&type= 22 | robot.router.get "/hubot/say", (req, res) -> 23 | query = querystring.parse(req._parsedUrl.query) 24 | 25 | user = {} 26 | user.room = query.room if query.room 27 | user.type = query.type if query.type 28 | 29 | robot.send(user, query.message) 30 | 31 | res.end "Said #{query.message}" 32 | -------------------------------------------------------------------------------- /src/scripts/talklikewarrenellis.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Talklikewarrenellis.com random quote builder 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot good morning - Receive a random quote from the warren ellis generator 12 | # 13 | # Author: 14 | # vosechu 15 | 16 | module.exports = (robot) -> 17 | 18 | robot.hear /(talk like warren ellis|ellis)/i, (msg) -> 19 | msg.http("http://talklikewarrenellis.com/random.php") 20 | .get() (err, res, body) -> 21 | msg.send JSON.parse(body).quote 22 | 23 | robot.hear /good (morning|afternoon|evening|day|night)/i, (msg) -> 24 | msg.http("http://talklikewarrenellis.com/random.php") 25 | .get() (err, res, body) -> 26 | msg.send JSON.parse(body).quote 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/scripts/bang-bang.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # None 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot !! - Repeat the last command directed at hubot 12 | # 13 | # Author: 14 | # None 15 | 16 | module.exports = (robot) -> 17 | robot.respond /(.+)/i, (msg) -> 18 | store msg 19 | 20 | robot.respond /!!/i, (msg) -> 21 | 22 | if exports.last_command? 23 | msg.send exports.last_command 24 | msg['message']['text'] = "hubot: #{exports.last_command}" 25 | robot.receive(msg['message']) 26 | msg['message']['done'] = true 27 | else 28 | msg.send "i don't remember hearing anything." 29 | 30 | store = (msg) -> 31 | command = msg.match[1].trim() 32 | exports.last_command = command unless command == '!!' 33 | -------------------------------------------------------------------------------- /src/scripts/carlton.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Carlton Celebration 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # dance - Display a dancing Carlton 12 | # 13 | # Author: 14 | # pingles 15 | 16 | carltons = [ 17 | "http://media.tumblr.com/tumblr_lrzrlymUZA1qbliwr.gif", 18 | "http://3deadmonkeys.com/gallery3/var/albums/random_stuff/Carlton-Dance-GIF.gif", 19 | "http://gifsoup.com/webroot/animatedgifs/987761_o.gif", 20 | "http://gifsoup.com/view1/1307943/carlton-banks-dance-o.gif", 21 | "http://s2.favim.com/orig/28/carlton-banks-dance-Favim.com-239179.gif", 22 | "http://gifsoup.com/webroot/animatedgifs/131815_o.gif" 23 | ] 24 | 25 | module.exports = (robot) -> 26 | robot.hear /.*(dance|happy).*/i, (msg) -> 27 | msg.send msg.random carltons 28 | -------------------------------------------------------------------------------- /src/scripts/cat.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Send messages to channels via hubot 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # HUBOT_CAT_PORT 9 | # 10 | # Commands: 11 | # None 12 | # 13 | # Notes: 14 | # $ echo "#channel|hello everyone" | nc -u -w1 bot_hostname bot_port 15 | # $ echo "nickname|hello mister" | nc -u -w1 bot_hostname bot_port 16 | # 17 | # Author: 18 | # simon 19 | 20 | dgram = require "dgram" 21 | server = dgram.createSocket "udp4" 22 | 23 | module.exports = (robot) -> 24 | server.on 'message', (message, rinfo) -> 25 | msg = message.toString().trim().split("|") 26 | target = msg[0] 27 | console.log("Sending '#{msg[1]}' to '#{target}'"); 28 | user = { room: target } 29 | robot.send user, msg[1] 30 | server.bind(parseInt(process.env.HUBOT_CAT_PORT)) 31 | -------------------------------------------------------------------------------- /src/scripts/xkcd.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Grab XKCD comic image urls 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot xkcd - The latest XKCD comic 12 | # hubot xkcd - XKCD comic 13 | # 14 | # Author: 15 | # twe4ked 16 | 17 | module.exports = (robot) -> 18 | robot.respond /xkcd\s?(\d+)?/i, (msg) -> 19 | if msg.match[1] == undefined 20 | num = '' 21 | else 22 | num = "#{msg.match[1]}/" 23 | 24 | msg.http("http://xkcd.com/#{num}info.0.json") 25 | .get() (err, res, body) -> 26 | if res.statusCode == 404 27 | msg.send 'Comic not found.' 28 | else 29 | object = JSON.parse(body) 30 | msg.send object.alt 31 | msg.send object.title 32 | msg.send object.img 33 | -------------------------------------------------------------------------------- /src/scripts/destiny.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Is it the day? 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot is it day ? - Returns if it's the day for your action 12 | # 13 | # Author: 14 | # KuiKui 15 | 16 | module.exports = (robot) -> 17 | robot.respond /is it (\w+) day \?/i, (msg) -> 18 | action = msg.match[1] 19 | nbDay = Math.floor(new Date().getTime() / 1000 / 86400) 20 | actionHash = action.length + action.charCodeAt(0) + action.charCodeAt(action.length - 1) 21 | destiny = Math.cos(nbDay + actionHash) + 1 22 | limit = (Math.sin(actionHash) + 1) / 2 23 | if destiny > limit 24 | msg.send "Sorry, it's not " + action + " day. But try tomorrow..." 25 | else 26 | msg.send "Yes, it's " + action + " day !" 27 | -------------------------------------------------------------------------------- /src/scripts/sheits.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # When you get some bad news sometimes you got to let it out. 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # sheeeit - Display an image or animated gif 12 | # 13 | # Author: 14 | # danishkhan 15 | 16 | sheits = [ 17 | "http://www.circlenoir.com/forums/attachment.php?attachmentid=478&stc=1#.jpg", 18 | "http://media.skateboard.com.au/forum/images/davis_sheeeit.jpg", 19 | "http://www.gifsoup.com/webroot/animatedgifs1/2019075_o.gif", 20 | "http://i417.photobucket.com/albums/pp258/reddreadrevolver/sheeeit.gif", 21 | "http://behance.vo.llnwd.net/profiles3/111050/projects/252777/1110501249152745.jpg" 22 | ] 23 | 24 | module.exports = (robot) -> 25 | robot.hear /sh(e+)(i+)(t+)/, (msg) -> 26 | msg.send msg.random sheits 27 | 28 | -------------------------------------------------------------------------------- /src/scripts/isup.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Uses downforeveryoneorjustme.com to check if a site is up 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot is up? - Checks if is up 12 | # 13 | # Author: 14 | # jmhobbs 15 | 16 | module.exports = (robot) -> 17 | robot.respond /is (.*?) (up|down)(\?)?/i, (msg) -> 18 | isUp msg, msg.match[1], (domain) -> 19 | msg.send domain 20 | 21 | isUp = (msg, domain, cb) -> 22 | msg.http('http://www.isup.me/' + domain) 23 | .get() (err, res, body) -> 24 | if body.match("It's just you.") 25 | cb "#{domain} looks UP from here." 26 | else if body.match("It's not just you!") 27 | cb "#{domain} looks DOWN from here." 28 | else 29 | cb "Not sure, #{domain} returned an error." 30 | -------------------------------------------------------------------------------- /src/scripts/rubygems.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Find a rubygem from rubygems.org 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot there's a gem for - Returns a link to a gem on rubygems.org 12 | # 13 | # Author: 14 | # sferik 15 | 16 | module.exports = (robot) -> 17 | robot.respond /there's a gem for (.*)/i, (msg) -> 18 | search = msg.match[1] 19 | msg.http('https://rubygems.org/api/v1/search.json') 20 | .query(query: search) 21 | .get() (err, res, body) -> 22 | results = JSON.parse(body) 23 | gems=[] 24 | for result in results[0..4] 25 | gems.push "#{result.name}: https://rubygems.org/gems/#{result.name}" 26 | if gems.length>0 then msg.send gems.join('\n') else msg.send "Actually, there isn't a gem for that!" 27 | -------------------------------------------------------------------------------- /src/scripts/serenity.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Serenity Now!! 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # 12 | # Author: 13 | # madtimber 14 | 15 | module.exports = (robot) -> 16 | robot.hear /serenity|serenity now/i, (msg) -> 17 | quotes = ["Serenity now...insanity later!", 18 | "Hey Braun!...Costanza is kicking your butt!", 19 | "Costanza, you're white hot!!", 20 | "Hey Braun, I got good news and bad news...and they're both the same, you're fired!", 21 | "Listen to me, George....I owe ya one.", 22 | "This is a place of business, I told you never to come in here! Serenity now!", 23 | "Hoochie mama!!!"] 24 | msg.send msg.random quotes 25 | msg.send "http://www.youtube.com/watch?v=dEMHtoWGLW0" 26 | -------------------------------------------------------------------------------- /src/scripts/shorten.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Shorten URLs with bit.ly 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # HUBOT_BITLY_USERNAME 9 | # HUBOT_BITLY_API_KEY 10 | # 11 | # Commands: 12 | # hubot (bitly|shorten) (me) - Shorten the URL using bit.ly 13 | # 14 | # Author: 15 | # sleekslush 16 | 17 | module.exports = (robot) -> 18 | robot.respond /(bitly|shorten)\s?(me)?\s?(.+)$/i, (msg) -> 19 | msg 20 | .http("http://api.bitly.com/v3/shorten") 21 | .query 22 | login: process.env.HUBOT_BITLY_USERNAME 23 | apiKey: process.env.HUBOT_BITLY_API_KEY 24 | longUrl: msg.match[3] 25 | format: "json" 26 | .get() (err, res, body) -> 27 | response = JSON.parse body 28 | msg.send if response.status_code is 200 then response.data.url else response.status_txt 29 | -------------------------------------------------------------------------------- /src/scripts/demolition-man.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Watch your language! 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # 12 | # Author: 13 | # whitman 14 | 15 | module.exports = (robot) -> 16 | 17 | words = [ 18 | 'arse', 19 | 'ass', 20 | 'bastard', 21 | 'bitch', 22 | 'bugger', 23 | 'bollocks', 24 | 'bullshit', 25 | 'cock', 26 | 'cunt', 27 | 'damn', 28 | 'damnit', 29 | 'dick', 30 | 'douche', 31 | 'fag', 32 | 'fuck', 33 | 'fucked', 34 | 'fucking', 35 | 'piss', 36 | 'shit', 37 | 'wank' 38 | ] 39 | regex = new RegExp('(?:^|\\s)(' + words.join('|') + ')(?:\\s|\\.|\\?|!|$)', 'i'); 40 | 41 | robot.hear regex, (msg) -> 42 | msg.send 'You have been fined one credit for a violation of the verbal morality statute.' 43 | -------------------------------------------------------------------------------- /src/scripts/lyrics.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Grabs snippets of song lyrics 3 | # Limited to snippets due to copyright stuff 4 | # 5 | # Dependencies: 6 | # None 7 | # 8 | # Configuration: 9 | # None 10 | # 11 | # Commands: 12 | # hubot lyrics for by - returns snippet of lyrics for this song 13 | # 14 | # Author: 15 | # mportiz08 16 | 17 | module.exports = (robot) -> 18 | robot.respond /lyrics for (.*) by (.*)/i, (msg) -> 19 | song = msg.match[1] 20 | artist = msg.match[2] 21 | getLyrics msg, song, artist 22 | 23 | getLyrics = (msg, song, artist) -> 24 | msg.http("http://lyrics.wikia.com/api.php") 25 | .query(artist: artist, song: song, fmt: "json") 26 | .get() (err, res, body) -> 27 | result = eval body # can't use JSON.parse :( 28 | msg.send result['url'] 29 | msg.send result['lyrics'] 30 | -------------------------------------------------------------------------------- /src/scripts/tweet.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Display a random tweet from twitter about a subject 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot tweet - Returns a link to a tweet about 12 | # 13 | # Author: 14 | # atmos 15 | 16 | module.exports = (robot) -> 17 | robot.respond /(.*) tweet/i, (msg) -> 18 | search = escape(msg.match[1]) 19 | msg.http('http://search.twitter.com/search.json') 20 | .query(q: search) 21 | .get() (err, res, body) -> 22 | tweets = JSON.parse(body) 23 | 24 | if tweets.results? and tweets.results.length > 0 25 | tweet = msg.random tweets.results 26 | msg.send "http://twitter.com/#!/#{tweet.from_user}/status/#{tweet.id_str}" 27 | else 28 | msg.reply "No one is tweeting about that." 29 | -------------------------------------------------------------------------------- /src/scripts/aww.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Hubot delivers a pic from Reddit's /r/aww frontpage 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # aww - Display the picture from /r/aww 12 | # 13 | # Author: 14 | # eliperkins 15 | 16 | module.exports = (robot) -> 17 | robot.respond /aww/i, (msg) -> 18 | search = escape(msg.match[1]) 19 | msg.http('http://www.reddit.com/r/aww.json') 20 | .get() (err, res, body) -> 21 | result = JSON.parse(body) 22 | 23 | if result.data.children.count <= 0 24 | msg.send "Couldn't find anything cute..." 25 | return 26 | 27 | urls = [ ] 28 | for child in result.data.children 29 | urls.push(child.data.url) 30 | 31 | rnd = Math.floor(Math.random()*urls.length) 32 | msg.send urls[rnd] 33 | -------------------------------------------------------------------------------- /src/scripts/achievement_unlocked.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # None 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot achievement get [achiever's gravatar email] - life goals are in reach 12 | # 13 | # Author: 14 | # Chris 15 | 16 | module.exports = (robot) -> 17 | robot.hear /achievement (get|unlock(ed)?) (.+?)(\s*[^@\s]+@[^@\s]+)?\s*$/i, (msg) -> 18 | caption = msg.match[3] 19 | email = msg.match[4] || msg.message.user.email_address 20 | url = "http://achievement-unlocked.heroku.com/xbox/#{escape(caption)}.png" 21 | if email 22 | url += "?email=#{escape(email.trim())}.png" 23 | msg.send(url) 24 | 25 | robot.hear /acheivement (get|unlock(ed)?)/i, (msg) -> 26 | url = "http://achievement-unlocked.heroku.com/xbox/#{escape("Bane of Daniel Webster")}.png" 27 | msg.send(url) 28 | -------------------------------------------------------------------------------- /src/scripts/wolfram.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Allows hubot to answer almost any question by asking Wolfram Alpha 3 | # 4 | # Dependencies: 5 | # "wolfram": "0.2.0" 6 | # 7 | # Configuration: 8 | # HUBOT_WOLFRAM_APPID - your AppID 9 | # 10 | # Commands: 11 | # hubot question - Searches Wolfram Alpha for the answer to the question 12 | # 13 | # Notes: 14 | # This may not work with node 0.6.x 15 | # 16 | # Author: 17 | # dhorrigan 18 | 19 | Wolfram = require('wolfram').createClient(process.env.HUBOT_WOLFRAM_APPID) 20 | 21 | module.exports = (robot) -> 22 | robot.respond /(question|wfa) (.*)$/i, (msg) -> 23 | console.log msg.match 24 | Wolfram.query msg.match[2], (e, result) -> 25 | # console.log result 26 | if result and result.length > 0 27 | msg.send result[1]['subpods'][0]['value'] 28 | else 29 | msg.send 'Hmm...not sure' 30 | -------------------------------------------------------------------------------- /src/scripts/punchfork.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Grab a Punchform recipe - http://punchfork.com/api 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # HUBOT_PUNCHFORK_APIKEY 9 | # 10 | # Commands: 11 | # hubot cook - Suggest recipe based on ingredent 12 | # 13 | # Author: 14 | # adamstrawson 15 | 16 | module.exports = (robot) -> 17 | robot.respond /cook (.*)$/i, (msg) -> 18 | 19 | keyword = "#{msg.match[1]}/" 20 | 21 | api_key = process.env.HUBOT_PUNCHFORK_APIKEY 22 | 23 | msg.http("http://api.punchfork.com/recipes?key=#{api_key}&q=#{keyword}&count=1") 24 | .get() (err, res, body) -> 25 | if res.statusCode == 404 26 | msg.send 'No recipe not found.' 27 | else 28 | object = JSON.parse(body) 29 | msg.send object.recipes[0].title 30 | msg.send object.recipes[0].pf_url 31 | -------------------------------------------------------------------------------- /src/scripts/walmart.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Show a random image from peopleofwalmart.com 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot walmart me - Show random Walmart image 12 | # hubot mart me - Show random Walmart image 13 | # 14 | # Author: 15 | # kevinsawicki 16 | 17 | module.exports = (robot) -> 18 | robot.respond /(wal)?mart( me)?/i, (msg) -> 19 | random = Math.floor(Math.random() * 770) 20 | msg.http("http://www.peopleofwalmart.com/photos/random-photos/page/" + random) 21 | .get() (err, res, body) -> 22 | col1 = body.indexOf '
' 23 | if (col1 != -1) 24 | body = body.substring col1 25 | match = body.match /http:\/\/media.peopleofwalmart.com\/wp-content\/uploads\/\d\d\d\d\/\d\d\/.+?\.jpg/g 26 | if (match) 27 | msg.send match[0] 28 | -------------------------------------------------------------------------------- /src/scripts/travis.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Find the build status of an open-source project on Travis 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot travis me / - Returns the build status of https://github.com// 12 | # 13 | # Author: 14 | # sferik 15 | 16 | module.exports = (robot) -> 17 | robot.respond /travis me (.*)/i, (msg) -> 18 | project = escape(msg.match[1]) 19 | msg.http("http://travis-ci.org/#{project}.json") 20 | .get() (err, res, body) -> 21 | response = JSON.parse(body) 22 | if response.last_build_status == 0 23 | msg.send "Build status for #{project}: Passing" 24 | else if response.last_build_status == 1 25 | msg.send "Build status for #{project}: Failing" 26 | else 27 | msg.send "Build status for #{project}: Unknown" 28 | -------------------------------------------------------------------------------- /src/scripts/defprogramming.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # None 3 | # 4 | # Dependencies: 5 | # "htmlparser": "1.7.6" 6 | # "soupselect: "0.2.0" 7 | # 8 | # Configuration: 9 | # None 10 | # 11 | # Commands: 12 | # hubot def programming - Display a random programming quote from defprogramming.com 13 | # 14 | # Author: 15 | # daviferreira 16 | 17 | Select = require("soupselect").select 18 | HtmlParser = require "htmlparser" 19 | 20 | module.exports = (robot) -> 21 | robot.respond /def programming/i, (msg) -> 22 | msg.http("http://www.defprogramming.com/random") 23 | .get() (err, res, body) -> 24 | handler = new HtmlParser.DefaultHandler() 25 | parser = new HtmlParser.Parser handler 26 | 27 | parser.parseComplete body 28 | 29 | results = Select handler.dom, "cite a p" 30 | msg.send results[0].children[0].raw 31 | -------------------------------------------------------------------------------- /src/scripts/yuno.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # None 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # HUBOT_YUNO_URL 9 | # HUBOT_YUNO_AUTH_TOKEN 10 | # 11 | # Commands: 12 | # y u no - U NO WHAT IT DOES 13 | # 14 | # Notes: 15 | # Get image generation script at https://github.com/alexdean/yuno 16 | # 17 | # Author: 18 | # alexdean 19 | 20 | module.exports = (robot) -> 21 | robot.hear /(.*) y u no (.*)/i, (msg) -> 22 | if not process.env.HUBOT_YUNO_URL? 23 | msg.send "HUBOT_YUNO_URL is not set." 24 | return 25 | 26 | msg.http(process.env.HUBOT_YUNO_URL) 27 | .query( 28 | auth: process.env.HUBOT_YUNO_AUTH_TOKEN, 29 | name: msg.match[1], 30 | action: msg.match[2] 31 | ) 32 | .get() (err, res, body) -> 33 | if err 34 | msg.send "error: #{err}" 35 | return 36 | msg.send body 37 | -------------------------------------------------------------------------------- /src/scripts/roll.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Roll a dice! 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot roll - Generates a random number between 1 and 100 inclusive 12 | # hubot roll - Generates a random number between 1 and inclusive 13 | # hubot roll - - Generates a random number between and inclusive 14 | # 15 | # Author: 16 | # jkongie 17 | 18 | module.exports = (robot) -> 19 | robot.respond /(roll)\s?(\d+)?-?(\d+)?/i, (msg) -> 20 | low = 1 21 | high = 100 22 | 23 | if msg.match[3] == undefined && msg.match[2] 24 | high = parseInt(msg.match[2]) 25 | else if msg.match[2] && msg.match[3] 26 | low = parseInt(msg.match[2]) 27 | high = parseInt(msg.match[3]) 28 | 29 | rand = Math.floor(Math.random() * (high - low + 1)) + low 30 | msg.reply "rolled a #{rand} of #{high}" 31 | -------------------------------------------------------------------------------- /src/scripts/quote.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Display a random quote or one from a specific person 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # HUBOT_QUOTE_MAX_LINES 9 | # 10 | # Commands: 11 | # hubot enlighten - random quote 12 | # hubot quote - random quote 13 | # hubot quote from - quote from person 14 | # 15 | # Author: 16 | # cldwalker 17 | 18 | module.exports = (robot) -> 19 | robot.respond /enlighten|quote from (.*)|quote/i, (msg) -> 20 | params = {max_lines: process.env.HUBOT_QUOTE_MAX_LINES || '4'} 21 | if msg.match[1] 22 | params['source'] = msg.match[1].split(/\s+/).join('+') 23 | 24 | msg.http('http://www.iheartquotes.com/api/v1/random') 25 | .query(params) 26 | .get() (err, res, body) -> 27 | body = body.replace(/\s*\[\w+\]\s*http:\/\/iheartquotes.*\s*$/m, '') 28 | body = body.replace(/"/g, "'") 29 | msg.send body 30 | -------------------------------------------------------------------------------- /src/scripts/jordan.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Display a picture of Michael Jordan if anyone invokes "jordan" or says "23" 3 | # Cause Jordan is God. So much more than Steve Jobs :D 4 | # 5 | # Dependencies: 6 | # None 7 | # 8 | # Configuration: 9 | # None 10 | # 11 | # Commands: 12 | # 13 | # Author: 14 | # KuiKui 15 | 16 | images = [ 17 | "http://pictureloaders.com/images/pictures-of-michael-jordan18.jpg" 18 | "http://a7.idata.over-blog.com/0/54/95/85/Michael_Jordan1414.jpg" 19 | "http://02.img.v4.skyrock.net/028/michael-jordan-n23/pics/884566066_small.jpg" 20 | "http://absolutezone.files.wordpress.com/2008/11/michael_jordan014.jpg" 21 | "http://hrichert1.free.fr/IDD_BB_NT/postes_basket/Michael%20jordan.jpg" 22 | "http://www.michaeljordansworld.com/pictures/images/michael_jordan_dunks_jazz.jpg" 23 | ] 24 | 25 | module.exports = (robot) -> 26 | robot.hear /(jordan|23)/i, (msg) -> 27 | msg.send msg.random images 28 | -------------------------------------------------------------------------------- /src/scripts/lastfm_np.coffee: -------------------------------------------------------------------------------- 1 | # 2 | # Description: 3 | # Last (or current) played song by a user in Last.fm 4 | # 5 | # Dependencies: 6 | # None 7 | # 8 | # Configuration: 9 | # HUBOT_LASTFM_APIKEY 10 | # 11 | # Commands: 12 | # hubot what's playing - Returns song name and artist 13 | # 14 | # Author: 15 | # guilleiguaran 16 | 17 | module.exports = (robot) -> 18 | robot.respond /what's playing (.*)/i, (msg) -> 19 | user = escape(msg.match[1]) 20 | apiKey = process.env.HUBOT_LASTFM_APIKEY 21 | msg.http('http://ws.audioscrobbler.com/2.0/?') 22 | .query(method: 'user.getrecenttracks', user: user, api_key: apiKey, format: 'json') 23 | .get() (err, res, body) -> 24 | results = JSON.parse(body) 25 | if results.error 26 | msg.send results.message 27 | return 28 | song = results.recenttracks.track[0] 29 | msg.send "#{song.name} by #{song.artist['#text']}" 30 | -------------------------------------------------------------------------------- /src/scripts/pokefacts.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Pokemon fun! 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # pokefact - get a random pokefact! 12 | # 13 | # Author: 14 | # eliperkins 15 | 16 | module.exports = (robot) -> 17 | 18 | robot.respond /pokefact/i, (msg) -> 19 | msg.http('https://api.twitter.com/1/statuses/user_timeline.json') 20 | .query(screen_name: 'pokefacts', count: 100) 21 | .get() (err, res, body) -> 22 | tweets = JSON.parse(body) 23 | msg.send tweets.length 24 | if tweets? and tweets.length > 0 25 | tweet = msg.random tweets 26 | while(tweet.text.toLowerCase().indexOf('#pokefact') == -1) 27 | tweet = msg.random tweets 28 | msg.send "PokeFACT: " + tweet.text.replace(/\#pokefact/i, ""); 29 | else 30 | msg.reply "Couldn't find a PokeFACT" 31 | -------------------------------------------------------------------------------- /src/scripts/horse.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # None 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot horse - Display a randomly selected insight on the world from Horse_Ebooks 12 | # 13 | # Author: 14 | # lavelle 15 | 16 | module.exports = (robot) -> 17 | robot.respond /horse/i, (msg) -> 18 | url = 'http://api.twitter.com/1/statuses/user_timeline.json' 19 | msg 20 | .http(url) 21 | .query 22 | screen_name: 'horse_ebooks' 23 | count: 10 24 | .get() (err, res, body) -> 25 | tweets = JSON.parse(body) 26 | 27 | if tweets? and tweets.length > 0 28 | n = Math.floor Math.random() * tweets.length or 0 29 | msg.send(tweets[n].text) 30 | else 31 | msg.reply "Couldn't find any insights for you this time" 32 | -------------------------------------------------------------------------------- /src/scripts/sensitive.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Hubot has feelings too, you know 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # 12 | # Author: 13 | # iangreenleaf 14 | 15 | messages = [ 16 | "Hey, that stings." 17 | "Is that tone really necessary?" 18 | "Robots have feelings too, you know." 19 | "You should try to be nicer." 20 | "Sticks and stones cannot pierce my anodized exterior, but words *do* hurt me." 21 | "I'm sorry, I'll try to do better next time." 22 | "https://p.twimg.com/AoTI6tLCIAAITfB.jpg" 23 | ] 24 | 25 | hurt_feelings = (msg) -> 26 | msg.send msg.random messages 27 | 28 | module.exports = (robot) -> 29 | pejoratives = "stupid|buggy|useless|dumb" 30 | 31 | r = new RegExp "\\b(you|u|is)\\b.*(#{pejoratives})", "i" 32 | robot.respond r, hurt_feelings 33 | 34 | r = new RegExp "(#{pejoratives}) ((ro)?bot|#{robot.name})", "i" 35 | robot.hear r, hurt_feelings 36 | -------------------------------------------------------------------------------- /src/scripts/reddit-jokes.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Random jokes from /r/jokes 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot joke me - Pull a random joke from /r/jokes 12 | # 13 | # Author: 14 | # tombell 15 | 16 | module.exports = (robot) -> 17 | 18 | robot.respond /joke me/i, (msg) -> 19 | msg.http('http://www.reddit.com/r/jokes.json') 20 | .get() (err, res, body) -> 21 | try 22 | data = JSON.parse body 23 | children = data.data.children 24 | joke = msg.random(children).data 25 | 26 | if joke.selftext.match /^\.\.\./ 27 | joketext = joke.title.replace(/\*\.\.\.$/,'') + ' ' + joke.selftext.replace(/^\.\.\.\s*/, '') 28 | else 29 | joketext = joke.selftext 30 | 31 | msg.send joketext.trim() 32 | 33 | catch ex 34 | msg.send "Erm, something went EXTREMELY wrong - #{ex}" 35 | -------------------------------------------------------------------------------- /src/scripts/eight-ball.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # The Magic Eight ball 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot eightball - Ask the magic eight ball a question 12 | # 13 | # Author: 14 | # ryanatwork 15 | 16 | ball = [ 17 | "It is certain", 18 | "It is decidedly so", 19 | "Without a doubt", 20 | "Yes – definitely", 21 | "You may rely on it", 22 | "As I see it, yes", 23 | "Most likely", 24 | "Outlook good", 25 | "Signs point to yes", 26 | "Yes", 27 | "Reply hazy, try again", 28 | "Ask again later", 29 | "Better not tell you now", 30 | "Cannot predict now", 31 | "Concentrate and ask again", 32 | "Don't count on it", 33 | "My reply is no", 34 | "My sources say no", 35 | "Outlook not so good", 36 | "Very doubtful", 37 | ] 38 | 39 | module.exports = (robot) -> 40 | robot.respond /(eightball|8ball)(.*)/i, (msg) -> 41 | msg.reply msg.random ball 42 | -------------------------------------------------------------------------------- /src/scripts/ruby.coffee: -------------------------------------------------------------------------------- 1 | # Description: 2 | # Evaluate one line of Ruby script 3 | # 4 | # Dependencies: 5 | # None 6 | # 7 | # Configuration: 8 | # None 9 | # 10 | # Commands: 11 | # hubot ruby|rb