Permalink
Browse files

restore vendor libs until we can fully move to gems; fix !links

  • Loading branch information...
1 parent b69b2bb commit def4b85dd16b604fdc6ea28684c91a03f75fc99f @jamiew committed Jun 1, 2010
Showing with 13 additions and 13 deletions.
  1. +10 −12 fatbot.rb
  2. +3 −1 vendor/utils/crack-json.rb
View
@@ -5,16 +5,16 @@
#
# dependencies: isaac, sequel, jnunemaker-twitter, mechanize
-%w{/vendor /vendor/utils}.collect{|ld|$:.unshift File.dirname(__FILE__)+ld}
+require 'time'
+require 'open-uri'
require 'rubygems'
require 'isaac'
-require 'time'
-
-require 'open-uri' # for !meme, !swineflu
require 'mechanize' # for !swineflu
require 'twitter' # for !twitter posting
-require 'search_twiter' # for !search_twitter queries
+
+%w{/vendor /vendor/utils}.collect{ |dir| $:.unshift File.dirname(__FILE__)+dir }
+%w{twitter_search flickraw}.collect{ |lib| require(lib).to_s }
# require 'sequel'
# DB = Sequel.sqlite('irc.db')
@@ -28,7 +28,6 @@
c.port = 6667
end
-
# NickServ-based security: simple check for FAT Lab fellows
def ops?(nick)
['jamiew','ttttbx','fi5e','randofo','bekathwia','MissSubmarine','gleuch','agoasi','monki','bennett4senate'].include?(nick)
@@ -139,21 +138,20 @@ def ops?(nick)
msg channel, text
end
-# do URL detection & logging, idea vi sh1v
+# do URL detection & logging -- idea via sh1v
on :channel, /http\:\/\/(.*)\s?/ do
$link_store[channel] ||= []
$link_store[channel] << { :url => match[0], :nick => nick, :date => Time.now }
$link_store[channel].shift if $link_store[channel].size > 10
- # puts "URL: #{match[0]} by #{nick} : #{$link_store[channel].size}"
end
# echo back collected URLs
-on :channel, /^\!(links|bookmarks).*/i do
+on :channel, /^\!links/i do
if $link_store[channel]
- msg channel, "last urls: (#{$link_store[channel].size})"
- $link_store[channel].collect { |l| msg channel, "#{l[:url]} by #{l[:nick]}" }
+ msg channel, "Recent URLs: (#{$link_store[channel].size} total)"
+ $link_store[channel].collect { |l| msg channel, "#{l[:url]} by #{l[:nick]}" }[0..2]
else
- msg channel, "no urls.."
+ msg channel, "No URLs yet!"
end
end
@@ -104,7 +104,9 @@ def self.unescape(str)
end
# matches YAML-formatted dates
- DATE_REGEX = /^\d{4}-\d{2}-\d{2}|\d{4}-\d{1,2}-\d{1,2}[ \t]+\d{1,2}:\d{2}:\d{2}(\.[0-9]*)?(([ \t]*)Z|[-+]\d{2}?(:\d{2})?)?$/
+ unless defined?(DATE_REGEX)
+ DATE_REGEX = /^\d{4}-\d{2}-\d{2}|\d{4}-\d{1,2}-\d{1,2}[ \t]+\d{1,2}:\d{2}:\d{2}(\.[0-9]*)?(([ \t]*)Z|[-+]\d{2}?(:\d{2})?)?$/
+ end
# Ensure that ":" and "," are always followed by a space
def self.convert_json_to_yaml(json) #:nodoc:

0 comments on commit def4b85

Please sign in to comment.