forked from hubot-archive/hubot-pugme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chihuahuame.coffee
30 lines (26 loc) · 891 Bytes
/
chihuahuame.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Description:
# Pugme is the most important thing in life
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# hubot chihuahua me - Receive a chihuahua
# hubot chihuahua bomb N - get N chihuahuas
module.exports = (robot) ->
robot.respond /chihuahua me/i, (msg) ->
msg.http("http://chihuahua.herokuapp.com/random")
.get() (err, res, body) ->
msg.send JSON.parse(body).chihuahua
robot.respond /chihuahua bomb( (\d+))?/i, (msg) ->
count = msg.match[2] || 5
msg.http("http://chihuahua.herokuapp.com/bomb?count=" + count)
.get() (err, res, body) ->
msg.send pug for pug in JSON.parse(body).chihuahuas
robot.respond /how many chihuahuas are there/i, (msg) ->
msg.http("http://chihuahua.herokuapp.com/count")
.get() (err, res, body) ->
msg.send "There are #{JSON.parse(body).chihuahua_count} chihuahuas."