Permalink
Browse files

Add to #memelab & #diaspora-dev & cleanup commentary

  • Loading branch information...
1 parent 1b0157f commit 0f34e8a6106dca84909219acba48519027394617 Jamie Wilkinson committed Oct 22, 2010
Showing with 14 additions and 15 deletions.
  1. +14 −15 fatbot.rb
View
@@ -36,41 +36,43 @@ def ops?(nick)
# CONNECT
on :connect do
- join "#fatlab", "#knowyourmeme", "#omgkym"
+ join "#fatlab", "#knowyourmeme", "#memelab", "#omgkym", "#diaspora-dev"
end
# echo things like "quote this: some text"
on :channel, /^\!echo (.*)/i do
msg channel, "#{match[0]}"
end
-# give me a meme using Automeme's "ENTERPRISE" API (by inky)
+# print a randomly generated meme phrase using Automeme API by @inky
on :channel, /^\!meme/i do
meme = open("http://meme.boxofjunk.ws/moar.txt?lines=1").read.chomp rescue 'ERROR: could not reach AutoMeme :-('
msg channel, meme
end
-# print a Kanye quote from THE QUOTABLE KANYE, http://jamiedubs.com/quotable-kanye/
+# print a Kanye quote from QUOTABLE KANYE by @jamiew, http://jamiedubs.com/quotable-kanye/
on :channel, /^\!kanye/i do
quote = open("http://jamiedubs.com/quotable-kanye/api.txt").read.chomp rescue 'ERROR: could not reach Kanye Quote DB :-('
msg channel, quote
end
# post to a shared twitter account
-# keep your settings in twiter.yml
+# keep your settings (username, password) in twitter.yml
on :channel, /^\!twitter (.*)/i do
return unless ops?(nick)
cred = YAML.load(File.open('twitter.yml'))
-
- httpauth = Twitter::HTTPAuth.new(cred['username'], cred['password'])
- base = Twitter::Base.new(httpauth)
- base.update(match[0])
-
- msg channel, "*** affirmative #{nick}, posted to #{cred['username'].inspect}"
+ begin
+ httpauth = Twitter::HTTPAuth.new(cred['username'], cred['password'])
+ base = Twitter::Base.new(httpauth)
+ base.update(match[0])
+ msg channel, "*** affirmative #{nick}, posted to #{cred['username'].inspect}"
+ rescue
+ msg channel, "Failed to update Twitter :( error => #{$!}"
+ end
end
-# ..
+# print results of Twitter.com search for a phrase
on :channel, /^\!search_twitter (.*)/i do
begin
case match[0]
@@ -97,7 +99,7 @@ def ops?(nick)
raw ["NOTICE #{channel} :", "gives #{nick} a #{tacos[(rand*tacos.length).floor]} taco"].join
end
-# change the topic by proxy (for bot-ops)
+# change the topic (for people in ops? but without real ops)
on :channel, /^\!topic (.*)/i do
topic(channel, "#{match[0]} [#{nick}]") if ops?(nick)
end
@@ -111,8 +113,6 @@ def ops?(nick)
begin
page = Mechanize.new.get(url)
aggregates = (page/'script').map { |i| i.content }
-
- #initialize('200906081850/aggregates.js', '200906081850/states.js', '200906081850');
if aggregates[5] =~ /(\d+)\/aggregates.js/
timedate = TwitterSearch::Tweet.time_ago_or_time_stamp( Time.parse($1) )
@@ -129,7 +129,6 @@ def ops?(nick)
cases = usdata["cases"]
fatal = usdata["Fatal"]
-
text = "U.S. Human Cases of H1N1 Flu Infection (As of #{timedate}): Cases: #{cases} - Deaths: #{fatal} -- http://flutracker.rhizalabs.com/"
rescue Exception => e

0 comments on commit 0f34e8a

Please sign in to comment.