X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fsalut.rb;h=2948b2f37506a94d4caf66451cf764d1a9c63954;hb=3f8710a19b6989cd1c67629a92fd992968579456;hp=e4295a06655c84323fe9d6fb52a886701a5cfd75;hpb=a96db3722879210c77e6d67dd8100b60e2452947;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/salut.rb b/data/rbot/plugins/salut.rb index e4295a06..2948b2f3 100644 --- a/data/rbot/plugins/salut.rb +++ b/data/rbot/plugins/salut.rb @@ -1,27 +1,25 @@ -# vim: set sw=2 et: +#-- vim:sw=2:et +#++ +# +# :title: Salutations plugin for rbot +# +# Author:: Giuseppe "Oblomov" Bilotta +# Copyright:: (C) 2006-2007 Giuseppe Bilotta +# License:: GPL v2 +# # Salutations plugin: respond to salutations -# TODO allow online editing of salutations -# TODO *REMEMBER* to set @changed to true after edit -# TODO or changes won't be saved - -unless Array.new.respond_to?(:pick_one) - debug "Defining the pick_one method for Array" - class ::Array - def pick_one - return nil if self.empty? - self[rand(self.length)] - end - end -end - +# +# TODO:: allow online editing of salutations +# +# TODO:: *REMEMBER* to set @changed to true after edit or changes won't be saved class SalutPlugin < Plugin - BotConfig.register BotConfigBooleanValue.new('salut.all_languages', + Config.register Config::BooleanValue.new('salut.all_languages', :default => true, :desc => "Check for a salutation in all languages and not just in the one defined by core.language", :on_change => Proc.new {|bot, v| bot.plugins['salut'].reload} ) - BotConfig.register BotConfigBooleanValue.new('salut.address_only', + Config.register Config::BooleanValue.new('salut.address_only', :default => true, :desc => "When set to true, the bot will only reply to salutations directed at him", :on_change => Proc.new {|bot, v| bot.plugins['salut'].reload}