embolalia/willie — pull request #442 by saltire (2014-01-31 03:04:09+00:00)
Title: [core] Expose bot.sub() to modules

Modules can now access the substitution function that is used for rules.
This can come in handy if you are dynamically adding rules to functions
and want to know what the actual regex will look like.

My use case for this: I'm creating replacement for the "ping" module that takes a list of regexes and replies. The regexes are used as rules, and later compared with the triggering pattern to find the reply - but since bot.py might make some substitutions within the rule, the module needs to be able to make the same substitutions to match the final pattern. The only way is to make sub() a public function.