diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-10-28 08:28:52 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-10-28 08:28:52 +0000 |
commit | 666d854019fe336f69cfaeb9b7e7599aa04a3151 (patch) | |
tree | 24a70f465f0b772676b3f768c0d1cc3b7806965e | |
parent | 2f909788778208bac970faa2128949bcb3bc6c01 (diff) |
salut now only replies to salutations directed at him, unless salut.address_only is false
-rw-r--r-- | data/rbot/plugins/salut.rb | 9 |
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]
|