Permalink
Browse files

support for bang-twitter, aka CoTweet Lite

  • Loading branch information...
1 parent 68c968d commit 1fa3f248571c2b1ea045cf8f79f64cfa04378f31 @jamiew committed Aug 13, 2009
Showing with 8 additions and 3 deletions.
  1. +8 −3 fatbot.rb
View
@@ -13,6 +13,7 @@
require 'open-uri' # for !meme, !swineflu
require 'mechanize' # for !swineflu
#gem 'jnunemaker-twitter', :lib => 'twitter' for !twitter
+require 'twitter'
puts %w{twitter_search flickraw}.collect{|ld|ld+': '+require(ld).to_s}#.join(", ")
# require 'sequel'
@@ -67,9 +68,13 @@ def ops?(nick)
# post to a shared twitter account
on :channel, /^\!twitter (.*)/i do
- cred = YAML.load('twitter.yml')
- # TODO do some stuff with twitter gem
- msg channel, "*** posting announcement by #{nick} to http://twitter.com/fffffat ..."
+ 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}"
end

0 comments on commit 1fa3f24

Please sign in to comment.