lastfm plugin: added now playing info to the help
[rbot] / data / rbot / plugins / autorejoin.rb
1 class AutoRejoinPlugin < Plugin
2   Config.register Config::BooleanValue.new('rejoin.insult',
3     :default => true,
4     :desc => "Determines if the bot will insult whoever kicked it, after rejoin")
5
6   def help(plugin, topic="")
7     "performs an automatic rejoin if the bot is kicked from a channel"
8   end
9
10   def kick(m)
11     if m.address?
12       r = rand(10)
13       if r > 0
14         @bot.timer.add_once(r) {
15           @bot.join m.channel
16           @bot.say(m.channel, @bot.lang.get("insult") % m.sourcenick) if @bot.config['rejoin.insult']
17         }
18       else
19         @bot.join m.channel
20         @bot.say(m.channel, @bot.lang.get("insult") % m.sourcenick) if @bot.config['rejoin.insult']
21       end
22     end
23   end
24 end
25
26 plugin = AutoRejoinPlugin.new