]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blob - data/rbot/plugins/autorejoin.rb
Modernize/optimize/cleanup a bunch of plugins
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / autorejoin.rb
1 class AutoRejoinPlugin < Plugin
2   def help(plugin, topic="")
3     "performs an automatic rejoin if the bot is kicked from a channel"
4   end
5   def kick(m)
6     if m.address?
7       r = rand(10)
8       if r > 0
9         @bot.timer.add_once(r, m) {|m|
10           @bot.join m.channel
11           @bot.say m.channel, @bot.lang.get("insult") % m.sourcenick
12         }
13       else
14         @bot.join m.channel
15         @bot.say m.channel, @bot.lang.get("insult") % m.sourcenick
16       end
17     end
18   end
19 end
20
21 plugin = AutoRejoinPlugin.new