Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

close issue/1 - links from #fatlab get tossed into #tumblrs, etc

  • Loading branch information...
commit 6dafaa378741fde0110d4f6459b8218768c3b8e9 1 parent ba80d50
lian authored May 21, 2009

Showing 1 changed file with 11 additions and 6 deletions. Show diff stats Hide diff stats

  1. 17  fatbot.rb
17  fatbot.rb
@@ -17,7 +17,7 @@
17 17
 
18 18
 # require 'sequel'
19 19
 # DB = Sequel.sqlite('irc.db')
20  
-$link_store ||= []
  20
+$link_store ||= {}
21 21
 $twitter ||= TwitterSearch::Client.new
22 22
 
23 23
 configure do |c|
@@ -140,14 +140,19 @@ def ops?(nick)
140 140
 
141 141
 # do URL detection & logging, idea vi sh1v
142 142
 on :channel, /http\:\/\/(.*)\s?/ do
143  
-  $link_store << { :url => match[0], :nick => nick, :date => Time.now }
144  
-  $link_store.shift if $link_store.size > 10
145  
-  puts "URL: #{match[0]} by #{nick} : #{$link_store.size}"
  143
+  $link_store[channel] ||= []
  144
+  $link_store[channel] << { :url => match[0], :nick => nick, :date => Time.now }
  145
+  $link_store[channel].shift if $link_store[channel].size > 10
  146
+  puts "URL: #{match[0]} by #{nick} : #{$link_store[channel].size}"
146 147
 end
147 148
 
148 149
 on :channel, /^\!(links|bookmarks).*/i do
149  
-  msg channel, "last urls: (#{$link_store.size})"
150  
-  $link_store.collect { |l| msg channel, "#{l[:url]} by #{l[:nick]}" }
  150
+  if $link_store[channel]
  151
+    msg channel, "last urls: (#{$link_store[channel].size})"
  152
+    $link_store[channel].collect { |l| msg channel, "#{l[:url]} by #{l[:nick]}" }
  153
+  else
  154
+    msg channel, "no urls.."
  155
+  end
151 156
 end
152 157
 
153 158
 

0 notes on commit 6dafaa3

Please sign in to comment.
Something went wrong with that request. Please try again.