Closed vivien closed 13 years ago
Nice. I think my original plan was to keep message
simple, and allow the implementation to parse message
in some way if needed. I like how this formalizes the process and is easy to re-use.
I'll hope to have time to roll this by Monday.
Hi Brett,
That is the new version of my pull request, to add the ability to have several parameters for commands you add to the bot.
"p Hello world!".match(/^p\s+(.*)$/).captures # => ["Hello world!"]
shows the idea). By the way, the piece of code to scan the message is a bit cleaner.Here's an example of command with this feature:
So that could be used like this:
rand_in 30 50 # => 42
.I think it is useful (for a project, I use something like
email recipient@somewhere.com Body of the message...
), and in my opinion, adding groups to the regex makes the command more readable and easier to handle.Thanks, Vivien.