Skip to content

Commit

Permalink
Added ascii, chat and chuck-norris scripts from ...
Browse files Browse the repository at this point in the history
  • Loading branch information
theirishpenguin committed Sep 19, 2012
1 parent 1a3516a commit 1027a2d
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
22 changes: 22 additions & 0 deletions scripts/ascii.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Description:
# ASCII art
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot ascii me <text> - Show text in ascii art
#
# Author:
# atmos

module.exports = (robot) ->
robot.respond /ascii( me)? (.+)/i, (msg) ->
msg
.http("http://asciime.heroku.com/generate_ascii")
.query(s: msg.match[2])
.get() (err, res, body) ->
msg.send body
20 changes: 20 additions & 0 deletions scripts/chat.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Description:
# Start up some wonderful chats with conversation starters
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot chat - Tell hubot to make something fun to chat about
#
# Author:
# GantMan

module.exports = (robot) ->
robot.respond /chat/i, (msg) ->
msg.http("http://chatoms.com/chatom.json?Normal=1&Fun=2&Philosophy=3&Out+There=4&Love=5&Personal=7")
.get() (err, res, body) ->
msg.send JSON.parse(body).text
36 changes: 36 additions & 0 deletions scripts/chuck-norris.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Description:
# Chuck Norris awesomeness
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot chuck norris -- random Chuck Norris awesomeness
# hubot chuck norris me <user> -- let's see how <user> would do as Chuck Norris
#
# Author:
# dlinsin

module.exports = (robot) ->

robot.respond /(chuck norris)( me )?(.*)/i, (msg)->
user = msg.match[3]
if user.length == 0
askChuck msg, "http://api.icndb.com/jokes/random"
else
askChuck msg, "http://api.icndb.com/jokes/random?firstName="+user+"&lastName="

askChuck = (msg, url) ->
msg.http(url)
.get() (err, res, body) ->
if err
msg.send "Chuck Norris says: #{err}"
else
message_from_chuck = JSON.parse(body)
if message_from_chuck.length == 0
msg.send "Achievement unlocked: Chuck Norris is quiet!"
else
msg.send message_from_chuck.value.joke

0 comments on commit 1027a2d

Please sign in to comment.