Permalink
Browse files

\!swineflu will give latest #'s from the CDC

  • Loading branch information...
1 parent 4bd8e73 commit e7b04929aa457e134a2e56d620aa54970483b742 @jamiew committed Apr 29, 2009
Showing with 13 additions and 2 deletions.
  1. +13 −2 fatbot.rb
View
@@ -9,6 +9,7 @@
require 'open-uri'
require 'sequel'
require 'isaac'
+require 'mechanize' # for !swineflu
#gem 'jnunemaker-twitter'; require 'twitter'
DB = Sequel.sqlite('irc.db')
@@ -77,11 +78,21 @@ def ops?(nick)
puts "URL: #{match[0]} by #{nick}"
end
+# swine flu report (USA only for now)
+# the CDC has a nice report with latest US stats, but not global
+on :channel, /^!(swineflu|pigflu)$/ do
+
+ url, shorturl = "http://www.cdc.gov/swineflu/", "http://bit.ly/eeat8"
+
+ page = WWW::Mechanize.new.get(url)
+ totals = (page/'#situationupdate strong')
+ msg channel, "OMFGBBQ. #{totals[1]}, #{totals[2]} -- #{shorturl}"
+end
+
# lastly, do logging
# from http://github.com/jamie/ircscribe/
on :channel, /.*/ do
msg = message.chomp
puts "#{channel} <#{nick}> #{msg}"
DB[:messages] << {:channel => channel, :nick => nick, :message => msg, :at => Time.now}
-end
-
+end

0 comments on commit e7b0492

Please sign in to comment.