]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
autorejoin after a random time between 0 and 10, instead of fixed 10
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 15 Oct 2006 13:40:54 +0000 (13:40 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Sun, 15 Oct 2006 13:40:54 +0000 (13:40 +0000)
data/rbot/plugins/autorejoin.rb

index aba46507b20e6c68b3ef3e6eb1411f6d8c506fed..f057a6598163514b19a480746ec6494823d95dd0 100644 (file)
@@ -4,10 +4,16 @@ class AutoRejoinPlugin < Plugin
   end
   def kick(m)
     if m.address?
-      @bot.timer.add_once(10, m) {|m|
-        @bot.join m.channel
-        @bot.say m.channel, @bot.lang.get("insult") % m.sourcenick
-      }
+      r = rand(10)
+      if r > 0
+       @bot.timer.add_once(r, m) {|m|
+         @bot.join m.channel
+         @bot.say m.channel, @bot.lang.get("insult") % m.sourcenick
+       }
+      else
+       @bot.join m.channel
+       @bot.say m.channel, @bot.lang.get("insult") % m.sourcenick
+      end
     end
   end
 end