summaryrefslogtreecommitdiff
path: root/data/rbot
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-11-04 12:19:11 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-11-04 12:19:11 +0000
commit5cfdc208477c0b97d4c23a8d3bdeba662aad19b8 (patch)
tree112363c22bef4f9750bd626a5a2fe1a2ae535c1d /data/rbot
parent60682184a5679d1da2fc94b58696a10f4792705c (diff)
factoids plugin: output fact numbers prefixed by a pound sign (#), and accept it in index parameter
Diffstat (limited to 'data/rbot')
-rw-r--r--data/rbot/plugins/factoids.rb6
1 files changed, 3 insertions, 3 deletions
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+/ }