$switch
$switch
will select and execute an action based on matching a value to predefined cases.
Usage
$switch[value;case]
Parameters
Field | Type | Description | Required |
---|---|---|---|
value | string | The value to compare against cases. | true |
case | string | Contains cases in the format {case:<comparisonValue>:<awaitedCmd>} , where comparisonValue can be a specific value. If none of the cases match, use {case:default:<awaitedCmd>} to handle the default behavior. | true |
Example(s)
1client.command({2 name: "switch",3 code: `4 $switch[2;5 $comment[If 2 == 3 execute this]6 {case:3:awaitedName}7 $comment[If 2 == 4 execute this]8 {case:4:awaitedName}9 $comment[If none are correct, execute this]10 {default:awaitedName}11 ]12 `13});