diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-20 15:24:58 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-20 15:24:58 +0000 |
commit | e265413bc16aca216d20c5a01bd373427019d37a (patch) | |
tree | 3024a6ddb2b829583a1211dc795d78f77aac9c2e /data | |
parent | 8b7e8b461cf7c8ee3d88499a8fa72ce7bb2becce (diff) |
reaction plugin: captures in regexp are now available as match1, match2, etc
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/reaction.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/data/rbot/plugins/reaction.rb b/data/rbot/plugins/reaction.rb index a61be294..2887d574 100644 --- a/data/rbot/plugins/reaction.rb +++ b/data/rbot/plugins/reaction.rb @@ -197,7 +197,8 @@ class ReactionPlugin < Plugin "Replies can use the %%{key} syntax to access one of the following keys: " + "who (the user that said the trigger), bot (the bot's own nick), " + "target (the first word following the trigger), what (whatever follows target), " + - "stuff (everything that follows the trigger), match (the actual matched text)" + "stuff (everything that follows the trigger), match (the actual matched text), " + + "match1, match2, ... (the i-th capture)" when :list "reaction list [n]: lists the n-the page of programmed reactions (30 reactions are listed per page)" when :show @@ -226,6 +227,9 @@ class ReactionPlugin < Plugin :what => what, :stuff => stuff } + match.to_a.each_with_index { |d, i| + extra[:"match#{i}"] = d + } subs = @subs.dup.merge extra reply = wanted.pick_reply debug "picked #{reply}" |