[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.
[core] Rewrite bot.sub() with docstring
Merge pull request #442 from saltire/dev

[core] Expose bot.sub() to modules