2021-04-05 17:29:49 +02:00
.. _plugin-Conditional:
Documentation for the Conditional plugin for Supybot
====================================================
Purpose
-------
Contains numerous conditional commands (such as 'if', 'and', and 'or'),
which can be used on their own or with another plugin.
Also provides logic operators for writing conditions.
Useful for bot scripting / nested commands.
Usage
-----
This plugin provides logic operators and other commands that
enable you to run commands only if a condition is true. Useful for nested
commands and scripting.
2021-04-05 22:56:40 +02:00
.. _commands-Conditional:
2021-04-05 17:29:49 +02:00
Commands
--------
2021-04-17 20:09:33 +02:00
.. _command-conditional-cand:
2021-04-05 22:56:40 +02:00
2021-04-05 17:29:49 +02:00
cand <cond1> [<cond2> ... <condN>]
Returns true if all conditions supplied evaluate to true.
2021-04-17 20:09:33 +02:00
.. _command-conditional-ceq:
2021-04-05 22:56:40 +02:00
2021-04-05 17:29:49 +02:00
ceq <item1> <item2>
Does a string comparison on <item1> and <item2>. Returns true if they are equal.
2021-04-17 20:09:33 +02:00
.. _command-conditional-cerror:
2021-04-05 22:56:40 +02:00
2021-04-05 17:29:49 +02:00
cerror <testcommand>
Runs <testcommand> and returns true if it raises an error; false otherwise.
2021-04-17 20:09:33 +02:00
.. _command-conditional-cif:
2021-04-05 22:56:40 +02:00
2021-04-05 17:29:49 +02:00
cif <condition> <ifcommand> <elsecommand>
Runs <ifcommand> if <condition> evaluates to true, runs <elsecommand> if it evaluates to false. Use other logical operators defined in this plugin and command nesting to your advantage here.
2021-04-17 20:09:33 +02:00
.. _command-conditional-cor:
2021-04-05 22:56:40 +02:00
2021-04-05 17:29:49 +02:00
cor <cond1> [<cond2> ... <condN>]
Returns true if any one of conditions supplied evaluates to true.
2021-04-17 20:09:33 +02:00
.. _command-conditional-cxor:
2021-04-05 22:56:40 +02:00
2021-04-05 17:29:49 +02:00
cxor <cond1> [<cond2> ... <condN>]
Returns true if only one of conditions supplied evaluates to true.
2021-04-17 20:09:33 +02:00
.. _command-conditional-ge:
2021-04-05 22:56:40 +02:00
2021-04-05 17:29:49 +02:00
ge <item1> <item2>
Does a string comparison on <item1> and <item2>. Returns true if <item1> is greater than or equal to <item2>.
2021-04-17 20:09:33 +02:00
.. _command-conditional-gt:
2021-04-05 22:56:40 +02:00
2021-04-05 17:29:49 +02:00
gt <item1> <item2>
Does a string comparison on <item1> and <item2>. Returns true if <item1> is greater than <item2>.
2021-04-17 20:09:33 +02:00
.. _command-conditional-le:
2021-04-05 22:56:40 +02:00
2021-04-05 17:29:49 +02:00
le <item1> <item2>
Does a string comparison on <item1> and <item2>. Returns true if <item1> is less than or equal to <item2>.
2021-04-17 20:09:33 +02:00
.. _command-conditional-lt:
2021-04-05 22:56:40 +02:00
2021-04-05 17:29:49 +02:00
lt <item1> <item2>
Does a string comparison on <item1> and <item2>. Returns true if <item1> is less than <item2>.
2021-04-17 20:09:33 +02:00
.. _command-conditional-match:
2021-04-05 22:56:40 +02:00
2021-04-05 17:29:49 +02:00
match [--case-insensitive] <item1> <item2>
Determines if <item1> is a substring of <item2>. Returns true if <item1> is contained in <item2>. Will only match case if --case-insensitive is not given.
2021-04-17 20:09:33 +02:00
.. _command-conditional-nceq:
2021-04-05 22:56:40 +02:00
2021-04-05 17:29:49 +02:00
nceq <item1> <item2>
Does a numeric comparison on <item1> and <item2>. Returns true if they are equal.
2021-04-17 20:09:33 +02:00
.. _command-conditional-ne:
2021-04-05 22:56:40 +02:00
2021-04-05 17:29:49 +02:00
ne <item1> <item2>
Does a string comparison on <item1> and <item2>. Returns true if they are not equal.
2021-04-17 20:09:33 +02:00
.. _command-conditional-nge:
2021-04-05 22:56:40 +02:00
2021-04-05 17:29:49 +02:00
nge <item1> <item2>
Does a numeric comparison on <item1> and <item2>. Returns true if <item1> is greater than or equal to <item2>.
2021-04-17 20:09:33 +02:00
.. _command-conditional-ngt:
2021-04-05 22:56:40 +02:00
2021-04-05 17:29:49 +02:00
ngt <item1> <item2>
Does a numeric comparison on <item1> and <item2>. Returns true if <item1> is greater than <item2>.
2021-04-17 20:09:33 +02:00
.. _command-conditional-nle:
2021-04-05 22:56:40 +02:00
2021-04-05 17:29:49 +02:00
nle <item1> <item2>
Does a numeric comparison on <item1> and <item2>. Returns true if <item1> is less than or equal to <item2>.
2021-04-17 20:09:33 +02:00
.. _command-conditional-nlt:
2021-04-05 22:56:40 +02:00
2021-04-05 17:29:49 +02:00
nlt <item1> <item2>
Does a numeric comparison on <item1> and <item2>. Returns true if <item1> is less than <item2>.
2021-04-17 20:09:33 +02:00
.. _command-conditional-nne:
2021-04-05 22:56:40 +02:00
2021-04-05 17:29:49 +02:00
nne <item1> <item2>
Does a numeric comparison on <item1> and <item2>. Returns true if they are not equal.
2021-04-17 20:09:33 +02:00
.. _conf-Conditional:
2021-04-05 17:29:49 +02:00
Configuration
-------------
2021-04-17 20:09:33 +02:00
.. _conf-supybot.plugins.Conditional.public:
2021-04-22 00:29:15 +02:00
2021-04-05 17:29:49 +02:00
supybot.plugins.Conditional.public
This config variable defaults to "True", is not network-specific, and is not channel-specific.
Determines whether this plugin is publicly visible.