summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-02-13 09:30:17 +0100
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-02-13 09:30:17 +0100
commit41c586f52b4bace414275b96cdd86c1919f539af (patch)
tree073a0bce590fc5e5bf76276f8c580218e9b0bc7c /data
parent4a02f91e3e8aa783799b1b82a591206fad9840b6 (diff)
markov plugin: display current probability when {{{markov probability}}} is called without a parameter
Diffstat (limited to 'data')
-rw-r--r--data/rbot/plugins/markov.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/data/rbot/plugins/markov.rb b/data/rbot/plugins/markov.rb
index 14cd0f99..4a7a7328 100644
--- a/data/rbot/plugins/markov.rb
+++ b/data/rbot/plugins/markov.rb
@@ -106,8 +106,12 @@ class MarkovPlugin < Plugin
end
def probability(m, params)
- @registry['probability'] = params[:probability].to_i
- m.okay
+ if params[:probability]
+ @registry['probability'] = params[:probability].to_i
+ m.okay
+ else
+ m.reply _("markov has a %{prob}% chance of chipping in") % { :prob => probability? }
+ end
end
def disable(m, params)
@@ -202,5 +206,5 @@ plugin.map 'markov disable', :action => "disable"
plugin.map 'markov status', :action => "status"
plugin.map 'chat about :seed1 :seed2', :action => "chat"
plugin.map 'chat', :action => "rand_chat"
-plugin.map 'markov probability :probability', :action => "probability",
+plugin.map 'markov probability [:probability]', :action => "probability",
:requirements => {:probability => /^\d+%?$/}