X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fautorejoin.rb;h=14a2f29c77b0723ab19c96404815384ba7b3c4ba;hb=1fa68bb86705b0e1e70d9d655bbfd8e1e13eb093;hp=4b6572747c7ef4fbeb15718a531f648d1c1b00bc;hpb=d29df50ddaf32536b105decefb135a0b86ee937f;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/autorejoin.rb b/data/rbot/plugins/autorejoin.rb index 4b657274..14a2f29c 100644 --- a/data/rbot/plugins/autorejoin.rb +++ b/data/rbot/plugins/autorejoin.rb @@ -1,18 +1,23 @@ 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