From: Giuseppe Bilotta Date: Sun, 15 Oct 2006 13:40:54 +0000 (+0000) Subject: autorejoin after a random time between 0 and 10, instead of fixed 10 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=12effa29ded2f4e251c3bc3acee46e72c7ef87e8;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git autorejoin after a random time between 0 and 10, instead of fixed 10 --- diff --git a/data/rbot/plugins/autorejoin.rb b/data/rbot/plugins/autorejoin.rb index aba46507..f057a659 100644 --- a/data/rbot/plugins/autorejoin.rb +++ b/data/rbot/plugins/autorejoin.rb @@ -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