]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/ri.rb
[plugin] ri fixed, simple no longer available :(
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / ri.rb
index 1eed65c02f638c85791e1e892dc5a0be196241be..9cb7edb24a41caa525d1928cd5d24b5b349db629 100644 (file)
@@ -14,9 +14,9 @@
 
 class RiPlugin < Plugin
 
-  RI_COMMAND = %w{ri -f simple -T}
+  RI_COMMAND = %w{ri -f ansi -T}
 
-  BotConfig.register BotConfigIntegerValue.new('ri.max_length',
+  Config.register Config::IntegerValue.new('ri.max_length',
     :default => 512,
     :desc => "Maximum length of ri entry (in bytes) which is ok to be sent to channels or other users")
 
@@ -52,9 +52,11 @@ class RiPlugin < Plugin
       return m.reply("failed to execute ri")
     end
     ret = ret.gsub(/\t/, "  ").split(/\n/).join(" ").gsub(/\s\s+/, '  ')
-    
-    if ret.length > @bot.config['ri.max_length'] && !m.private?
-      return m.reply('entry is too long to send to the channel or to some other user, use /msg to ask me about it')
+
+    if ret.length > @bot.config['ri.max_length']
+      if !m.private? && tgt.to_s != m.sourcenick
+        return m.reply('entry is too long to send to the channel or to some other user, use /msg to ask me about it')
+      end
     end
     if tgt
       @bot.say(tgt, ret)