diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-02-13 00:01:53 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-02-13 00:01:53 +0100 |
commit | 485a5e503f1f60d363c0018dd8d10ad1a2088479 (patch) | |
tree | 94858297b877c983a7b919ed5a6db6d06b1fe13f /data/rbot | |
parent | d7df65437c3328141ae6faf372d334b9708fe078 (diff) |
factoids plugin: short_fact() auxiliary (no metadata)
Diffstat (limited to 'data/rbot')
-rw-r--r-- | data/rbot/plugins/factoids.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/data/rbot/plugins/factoids.rb b/data/rbot/plugins/factoids.rb index 2a75fd52..51074221 100644 --- a/data/rbot/plugins/factoids.rb +++ b/data/rbot/plugins/factoids.rb @@ -271,6 +271,15 @@ class FactoidsPlugin < Plugin end end + def short_fact(fact,index=nil,total=@factoids.length) + idx = index || @factoids.index(fact)+1 + _("[%{idx}/%{total}] %{fact}" % { + :idx => idx, + :total => total, + :fact => fact.to_s(:meta => false) + }) + end + def long_fact(fact,index=nil,total=@factoids.length) idx = index || @factoids.index(fact)+1 _("fact #%{idx} of %{total}: %{fact}" % { @@ -316,10 +325,10 @@ class FactoidsPlugin < Plugin end end known.each { |f| - reply << long_fact(f) + reply << short_fact(f) } end - m.reply reply.join(" -- "), :split_at => /\s+--\s+/ + m.reply reply.join(". "), :split_at => /\s+--\s+/ end end |