Skip to content

Commit

Permalink
Add 'hubstatus' command for GitHub status
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Bell committed Sep 27, 2011
1 parent 446dac8 commit 140e2b5
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion rugbot.rb
Expand Up @@ -307,7 +307,7 @@
on :channel, /who broke rugbot/i do
log_user_seen(nick)

msg channel, "tomb broke me"
msg channel, "do I look broke? >:("
=begin
url = "https://api.github.com/repos/#{BOT_REPO}/commits?per_page=1"
Expand All @@ -325,6 +325,21 @@
=end
end

on :channel, /hubstatus/i do
log_user_seen(nick)

real = JSON.parse(Curl::Easy.perform('http://status.github.com/realtime.json').body_str)
status = JSON.parse(Curl::Easy.perform('http://status.github.com/status.json').body_str)

status = status['status']
last = status['last_updated']
pages = real['pages'] ? 'Up' : 'Down'
git = real['git'] ? 'Up' : 'Down'
dl = real['downloads'] ? 'Up' : 'Down'

msg channel, "GitHub status: #{status} (Pages: #{pages}, Git: #{git}, Downloads: #{dl}) - #{last_updated}"
end

# Catchall for seen
on :channel, /.*/ do
log_user_seen(nick)
Expand Down

0 comments on commit 140e2b5

Please sign in to comment.