summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/rbot/plugins/salut.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/data/rbot/plugins/salut.rb b/data/rbot/plugins/salut.rb
index 48276019..b8d9c4d7 100644
--- a/data/rbot/plugins/salut.rb
+++ b/data/rbot/plugins/salut.rb
@@ -18,6 +18,12 @@ class SalutPlugin < Plugin
: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',
+ :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}
+ )
+
def initialize
@salutations = Hash.new
@@ -63,6 +69,9 @@ class SalutPlugin < Plugin
end
def listen(m)
+ if @bot.config['salut.address_only']
+ return unless m.address? or m.message =~ /#{Regexp.escape(@bot.nick)}/
+ end
salut = nil
[:both, :in, :out].each { |k|
next unless @match[k]