Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

merge

  • Loading branch information...
commit 1f1755517e4cc1592a0b4b1a6c36cb5ed0e96d77 2 parents e1f12bd + 318a85a
@jamiew authored
Showing with 28 additions and 15 deletions.
  1. +28 −15 fatbot.rb
View
43 fatbot.rb
@@ -7,11 +7,13 @@
require 'rubygems'
require 'open-uri'
-#require 'sequel'
-require 'isaac'
-#gem 'jnunemaker-twitter'; require 'twitter'
-#DB = Sequel.sqlite('irc.db')
+require 'open-uri' # for !meme
+require 'mechanize' # for !swineflu
+#gem 'jnunemaker-twitter', :lib => 'twitter' for !twitter
+
+# require 'sequel'
+# DB = Sequel.sqlite('irc.db')
configure do |c|
c.nick = "dubtron"
@@ -23,16 +25,17 @@
# just a simple check for FAT Lab fellows
# count on NickServ for security :x
+# UPDATE: fuck it, allow everyone. FREE CULTURE BABY YEAH
def ops?(nick)
- ['jamiew','ttttbx','fi5e','randofo','bekathwia','Geraldine','Geraldine_'].include?(nick)
- # w/e, everyone for now
- # true
+ # ['jamiew','ttttbx','fi5e','randofo','bekathwia','Geraldine','Geraldine_'].include?(nick)
+ true
end
# CONNECT
on :connect do
- join "#tumblrs", "#fatlab"
+ # join "#tumblrs", "#fatlab"
+ join "#fatlab"
end
@@ -67,10 +70,21 @@ def ops?(nick)
end
# change the topic by proxy (for bot-ops)
-on :channel, /^!topic (.*)/ do
+on :channel, /^\!topic (.*)/ do
topic(channel, "#{match[0]} [#{nick}]") if ops?(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"
+ agent = WWW::Mechanize.new # TODO: use a global agent & set user-agent to FATBOT YEAH
+ page = agent.get(url)
+ totals = (page/'#situationupdate strong')
+ text = "Swine Flu USA: #{totals[1].content},#{totals[2].content} -- #{shorturl}"
+ msg channel, text
+end
+
# do URL detection & logging, idea vi sh1v
on :channel, /http\:\/\/(.*)\s?/ do
@@ -79,9 +93,8 @@ def ops?(nick)
# 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
-
+# on :channel, /.*/ do
+# msg = message.chomp
+# puts "#{channel} <#{nick}> #{msg}"
+# # DB[:messages] << {:channel => channel, :nick => nick, :message => msg, :at => Time.now}
+# end
Please sign in to comment.
Something went wrong with that request. Please try again.