From 5cfdc208477c0b97d4c23a8d3bdeba662aad19b8 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sun, 4 Nov 2007 12:19:11 +0000 Subject: factoids plugin: output fact numbers prefixed by a pound sign (#), and accept it in index parameter --- data/rbot/plugins/factoids.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'data/rbot') diff --git a/data/rbot/plugins/factoids.rb b/data/rbot/plugins/factoids.rb index 96bb729a..59f1a06b 100644 --- a/data/rbot/plugins/factoids.rb +++ b/data/rbot/plugins/factoids.rb @@ -155,7 +155,7 @@ class FactoidsPlugin < Plugin idx = 0 total = @factoids.length if params[:index] - idx = params[:index].to_i + idx = params[:index].scan(/\d+/).first.to_i if idx <= 0 or idx > total m.reply _("please select a fact number between 1 and %{total}" % { :total => total }) return @@ -194,7 +194,7 @@ class FactoidsPlugin < Plugin unless metadata.empty? meta = _(" [learnt %{data}]" % {:data => metadata.join(" ")}) end - m.reply _("fact %{idx}/%{total}: %{fact}%{meta}" % { + m.reply _("fact #%{idx} of %{total}: %{fact}%{meta}" % { :idx => idx, :total => total, :fact => fact, @@ -212,4 +212,4 @@ plugin.map 'learn that *stuff' plugin.map 'forget that *stuff', :auth_path => 'edit' plugin.map 'facts [about *words]' plugin.map 'fact [about *words]' -plugin.map 'fact :index', :requirements => { :index => /\d+/ } +plugin.map 'fact :index', :requirements => { :index => /#?\d+/ } -- cgit v1.2.3