From 41c586f52b4bace414275b96cdd86c1919f539af Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Wed, 13 Feb 2008 09:30:17 +0100 Subject: markov plugin: display current probability when {{{markov probability}}} is called without a parameter --- data/rbot/plugins/markov.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'data') 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+%?$/} -- cgit v1.2.3