Skip to content

Commit

Permalink
Add route for knowing the IP where the bot is host
Browse files Browse the repository at this point in the history
  • Loading branch information
ferlores committed Aug 3, 2012
1 parent ec6309a commit 63c7573
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/scripts/httpd.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# /hubot/ping
# /hubot/time
# /hubot/info
# /hubot/ip

spawn = require('child_process').spawn

Expand All @@ -35,3 +36,7 @@ module.exports = (robot) ->
child.stdout.on 'data', (data) ->
res.end "#{data.toString().trim()} running node #{process.version} [pid: #{process.pid}]"
child.stdin.end()

robot.router.get "/hubot/ip", (req, res) ->
robot.http('http://checkip.dyndns.org').get() (err, r, body) ->
res.end body

0 comments on commit 63c7573

Please sign in to comment.