Skip to content

Instantly share code, notes, and snippets.

@glidenote
Created May 10, 2013 09:12
Show Gist options
  • Save glidenote/5553372 to your computer and use it in GitHub Desktop.
Save glidenote/5553372 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require 'cinch'
require 'open-uri'
require 'json'
require 'time'
bot = Cinch::Bot.new do
configure do |c|
c.server = "irc.freenode.net"
c.channels = ["#glidenote"]
c.nick = 'github_status_bot'
c.realname = 'github_status_bot'
c.user = 'github_status_bot'
end
on :message, /^status github/ do |m|
html = open("https://status.github.com/api/status.json").read
json = JSON.parser.new(html)
d = json.parse
t = Time.parse("#{d['last_updated']}").getlocal
m.reply "status: #{d['status']} (last_updated: #{t})"
end
end
bot.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment