diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-02-13 01:40:23 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-02-13 01:40:23 +0100 |
commit | 5b653affaa2028e8a743965d5d7d303ae7a6c310 (patch) | |
tree | 8901fa1057925b0feccdd46e0c3a93b813de3747 /data/rbot/plugins/factoids.rb | |
parent | 95cbfcc8c336678bd026f9b04b4e1981783a7bb5 (diff) |
factoids plugin: be silent when learning factoids from chat, with option to provide feedback
Diffstat (limited to 'data/rbot/plugins/factoids.rb')
-rw-r--r-- | data/rbot/plugins/factoids.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/data/rbot/plugins/factoids.rb b/data/rbot/plugins/factoids.rb index c5f3a25c..5f8792c0 100644 --- a/data/rbot/plugins/factoids.rb +++ b/data/rbot/plugins/factoids.rb @@ -103,6 +103,9 @@ class FactoidsPlugin < Plugin Config.register Config::BooleanValue.new('factoids.listen_and_learn', :default => false, :desc => "Should the bot learn factoids from what is being said in chat? if true, phrases matching patterns in factoids.learn_pattern will tell the bot when a phrase can be learned") + Config.register Config::BooleanValue.new('factoids.silent_listen_and_learn', + :default => true, + :desc => "Should the bot be silent about the factoids he learns from the chat? If true, the bot will not declare what he learned every time he learns something from factoids.listen_and_learn being true") Config.register Config::IntegerValue.new('factoids.search_results', :default => 5, :desc => "How many factoids to display at a time") @@ -269,7 +272,7 @@ class FactoidsPlugin < Plugin else @factoids << factoid @changed = true - m.reply _("okay, learned fact #%{num}: %{fact}" % { :num => @factoids.length, :fact => @factoids.last}) + m.reply _("okay, learned fact #%{num}: %{fact}" % { :num => @factoids.length, :fact => @factoids.last}) unless params[:silent] trigs = parse_for_trigger(factoid) @triggers |= trigs unless trigs.empty? end @@ -376,7 +379,7 @@ class FactoidsPlugin < Plugin @learn_patterns.each do |pat, i| g = pat.match(m.message) if g and g[i] - learn(m, :stuff => g[i], :silent => true) + learn(m, :stuff => g[i], :silent => @bot.config['factoids.silent_listen_and_learn']) break end end |