Roll a die or multiple dice.
This command will roll dice and return the results. A few flows to consider:
- number of dice and the number of dice faces delimited on a 'd'
- delimiter can be capital or lower case;
- multiple dice delimited by a space( ), comma(,), or plus sign(+)
- space delimiting different dice rolls
- multiple types of dice
- multiple dice in roll
- combinations of above
Example Usage and Results:
| Roll Argument(s) | Result Range | Example Output |
| 1d6 | number between 1 and 6 | 4 |
| 2d6 | number between 2 and 12 | 6 = 4 + 2 |
| 1d6 + 1d4 | number between 2 and 10 | 4 = 1 + 3 |
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
dice |
string |
<repeatable> |
which dice (number of dice and/or type of dice) to roll; required |
Returns:
string -- dice results (as a message to discord text channel)
Members
-
inner diceArray :Array.<integer>
results of each dice result for additional info in the roll
-
-
inner dieArray :Array.<string>
where we will prep and store the dice roll
-
-
inner dieTotal :integer
total die roll, starting at 0 and incremented up based on die roll
-
-
inner userRoll :Array.<string>
the user input for the roll command, empty array if undefined
-
Methods
-
inner execute(message, args) → {string}
-
Parameters:
Name Type Description messagestring command, used to determine which channel to return results
argsstring dice roll passed into arguments
Returns:
string -total of the die or dice rolled (includes each die roll if multiple dice requested)