Uses POSIX shell parameter expansion syntax.
<pragma-> !factadd cookie /me gives a cookie to ${args:-nobody. What a shame}!
<PBot> cookie added to the global channel.
<pragma-> !cookie Bob
* PBot gives a cookie to Bob!
<pragma-> !cookie
* PBot gives a cookie to nobody. What a shame!
<pragma-> !factadd sum /call calc $arg[0]:-1 + $arg[1]:-2
<PBot> sum added to the global channel.
<pragma-> !sum
<PBot> 1 + 2 = 3
<pragma-> !sum 3
<PBot> 3 + 2 = 5
<pragma-> !sum 4 6
<PBot> 4 + 6 = 10
This fixes e.g.:
<pragma-> ,{echo foo ;;; echo bar} ,{echo baz}
<PBot> foo bar
<PBot> foo baz
To instead produce the expected:
<PBot> foo bar
<PBot> baz
The number of rounds, questions and bonus rounds are now all configurable via
`spinach set settings`.
Refactored states to not transition of a false value is returned, to eliminate
all explicit "wait" states.
Refactored ridiculous large per-round/per-question state transitions and
subroutines into a much more manageable and simpler state machine.
Now can easily and trivially adjust maximum rounds and maximum questions
by editing $self->{game} hashtable entries. TODO: make this configurable
via `spinach set`.
Replaced "/msg me" with "/msg $botnick" throughout.
Adjusted lie validation:
* If all words of lie are found within solution and word-count of lie is
less than word-count of solution, then game will say "So-and-so has found
part of the truth!"
* If lie is 20%-or-less different to the solution, then game will say
"So-and-so has misspelled the truth!"
Also remove the explicit check for `ArrayRef`, which is obsolete since the 2014 addition of the `_is_simple_node` override in commit ba59edb04. (Upstream `_is_simple_node` returns `True` for an `ArrayRef`.)
This allows us to set `locked` to a value greater than `1` to lock a factoid WITHOUT
allowing invocation of `required_caps` commands. This lets us safely lock a factoid
that has unrestrained `$args` or variables.
This preserves the pipe/cmd-substitution/etc to allow post-processing
of the `date` output.
Interpreter: Reset `interpreted` contextual metadata when handling
result to allow recursion for continued command processing.
As a security measure to prevent users from creating or modifying factoids to
sneak in commands to trick chanops/admins/botowners/etc into executing those
commands, the command interpreter will now check if the command has been
invoked in the context of a factoid. If so, the factoid must be locked.
PBot now preserves whitespace by default. The `preserve_whitespace`
metadata field is now redundant. It has now been replaced with
`condense-whitespace`, which when set to a true value will collapse
adjacent whitespace to a single space.
Due to recent changes to support continued processing of empty string command
results, ProcessManager::execute_process() now returns undefined value, which
causes Interpreter::interpret() to continue looping through registered command
interpreters after successfully handling a command.
This causes some plugins, i.e. Plugin/Date.pm, to continue the interpret() loop
after successfully handling a command, which causes additional interpreters to
handle the command, leading to both a built-in command an a factoid command
being invoked if they share the same name.
Applets::execute_applet() now returns the defined empty string to let the
interpreter loop know that the command has been handled.
`factmove` arguments now behave more sensibly in that:
* `factmove #channel keyword global keyword` now properly moves/renames
factoids to global channel
* `factmove #channel keyword #channel global` renames the factoid to `global`
* `factmove #channel keyword newname` renames the factoid to `newname`
* func sed no longer trims leading whitespace
* quoted text no longer trims leading whitespace
* no longer convert tabs to spaces in output
* no longer condense adjacent whitespace together in output