Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

bit of cleanup, and give everyone ops OMGLOLOLOL

  • Loading branch information...
commit 318a85a05ae89febb8e45fa91fdea3a59a94e1e0 1 parent dfa2229
@jamiew authored
Showing with 22 additions and 20 deletions.
  1. +22 −20 fatbot.rb
View
42 fatbot.rb
@@ -6,13 +6,14 @@
# dependencies: isaac, sequel, jnunemaker-twitter
require 'rubygems'
-require 'open-uri'
-require 'sequel'
require 'isaac'
+
+require 'open-uri' # for !meme
require 'mechanize' # for !swineflu
-#gem 'jnunemaker-twitter'; require 'twitter'
+#gem 'jnunemaker-twitter', :lib => 'twitter' for !twitter
-DB = Sequel.sqlite('irc.db')
+# require 'sequel'
+# DB = Sequel.sqlite('irc.db')
configure do |c|
c.nick = "dubtron"
@@ -24,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
@@ -68,27 +70,27 @@ 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
-
-# do URL detection & logging, idea vi sh1v
-on :channel, /http\:\/\/(.*)\s?/ do
- 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
-
+on :channel, /^\!(swineflu|pigflu).*/ do
url, shorturl = "http://www.cdc.gov/swineflu/", "http://bit.ly/eeat8"
-
- page = WWW::Mechanize.new.get(url)
+ agent = WWW::Mechanize.new # TODO: use a global agent & set user-agent to FATBOT YEAH
+ page = agent.get(url)
totals = (page/'#situationupdate strong')
- msg channel, "OMFGBBQ. #{totals[1]}, #{totals[2]} -- #{shorturl}"
+ 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
+ puts "URL: #{match[0]} by #{nick}"
+end
+
# lastly, do logging
# from http://github.com/jamie/ircscribe/
# on :channel, /.*/ do
Please sign in to comment.
Something went wrong with that request. Please try again.