diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-11-01 00:31:01 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-11-01 00:31:01 +0000 |
commit | fbdf7a4eb950187a2c551f1dfd03cfaadf1938d8 (patch) | |
tree | 18ea96ad761bb49b0b3adc73fd40ab592fd3aa85 /data | |
parent | 6be3b87e6bd31b5fae61df4daa3d99dd181d3044 (diff) |
lart plugin: listlart and listpraise commands
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/lart.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/data/rbot/plugins/lart.rb b/data/rbot/plugins/lart.rb index fbc1f9e4..a70c67b8 100644 --- a/data/rbot/plugins/lart.rb +++ b/data/rbot/plugins/lart.rb @@ -136,6 +136,16 @@ class LartPlugin < Plugin m.okay end + def handle_listlart(m, params) + rx = Regexp.new(params[:lart].to_s, true) + list = @larts.grep(rx) + if list + m.reply list.join(" | "), :split_at => /\s+\|\s+/ + else + m.reply "no lart found matching #{params[:lart]}" + end + end + def handle_addpraise(m, params) @praises << params[:praise].to_s @changed = true @@ -148,6 +158,16 @@ class LartPlugin < Plugin m.okay end + def handle_listpraise(m, params) + rx = Regexp.new(params[:praise].to_s, true) + list = @praises.grep(rx) + if list + m.reply list.join(" | "), :split_at => /\s+\|\s+/ + else + m.reply "no praise found matching #{params[:praise]}" + end + end + # The following are utils for larts/praises def replace_who(msg, nick) msg.gsub(/<who>/i, "#{nick}") @@ -169,3 +189,6 @@ plugin.map "addpraise *praise", :action => :handle_addpraise plugin.map "rmlart *lart", :action => :handle_rmlart plugin.map "rmpraise *praise", :action => :handle_rmpraise + +plugin.map "listlart *lart", :action => :handle_listlart +plugin.map "listpraise *praise", :action => :handle_listpraise |