]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/autorejoin.rb
imdb plugin: htmlinfo filter for names too
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / autorejoin.rb
index f057a6598163514b19a480746ec6494823d95dd0..14a2f29c77b0723ab19c96404815384ba7b3c4ba 100644 (file)
@@ -1,22 +1,26 @@
 class AutoRejoinPlugin < Plugin
+  Config.register Config::BooleanValue.new('rejoin.insult',
+    :default => true,
+    :desc => "Determines if the bot will insult whoever kicked it, after rejoin")
+
   def help(plugin, topic="")
     "performs an automatic rejoin if the bot is kicked from a channel"
   end
+
   def kick(m)
     if m.address?
       r = rand(10)
       if r > 0
-       @bot.timer.add_once(r, m) {|m|
+       @bot.timer.add_once(r) {
          @bot.join m.channel
-         @bot.say m.channel, @bot.lang.get("insult") % m.sourcenick
+         @bot.say(m.channel, @bot.lang.get("insult") % m.sourcenick) if @bot.config['rejoin.insult']
        }
       else
        @bot.join m.channel
-       @bot.say m.channel, @bot.lang.get("insult") % m.sourcenick
+       @bot.say(m.channel, @bot.lang.get("insult") % m.sourcenick) if @bot.config['rejoin.insult']
       end
     end
   end
 end
 
 plugin = AutoRejoinPlugin.new
-plugin.register("autorejoin")