dice
Dice module. Responsible for rolling dice in PMs.
- dice
- .description
- .configuration
- .name
- .priority
- .version
- .commands :
Object
- .roll()
- .prerollDice(num, sides) ⇒
number
- .rollWolfDice(match, callback)
- .rollFudgeDice(match, callback)
- .rollXDice(match, callback)
- .parser(input, each, complete)
- .handleInput(input, callback)
- .rollDice(match, callback)
- .begin(browser, config)
- .getError() ⇒
string
dice.description
Brief description of this module for Help Docs
Kind: static property of dice
dice.configuration
Default Configuration settings for this sock_module
Kind: static property of dice
dice.name
The name of this sock_module
Kind: static property of dice
dice.priority
If defined by a sock_module it is the priority of the module with respect to other modules.
sock_modules should not define modules with negative permissions. Default value is 50 with lower numbers being higher priority.
Kind: static property of dice
dice.version
The version of this sock_module
Kind: static property of dice
dice.commands : Object
Each command has the following properties: - handler: The handler function. - defaults: Default values of parameters - params: Named parameters for this function - description: A description of this function for the help
Kind: static property of dice
dice.roll()
Roll the actual dice. Uses random.org as a source of random numbers. Calls back with the following parameters: - sum: the total sum of dice rolled - results: the array of arrays of dice rolled (int[][])
Kind: static method of dice
dice.prerollDice(num, sides) ⇒ number
Pre-roll dice. To get bad streaks out early :)
Kind: static method of dice
Returns: number
- How many rolls were performed
Param | Type | Description |
---|---|---|
num | number |
The number of dice to roll |
sides | number |
The size of dice to roll |
dice.rollWolfDice(match, callback)
Roll White Wolf-style dice
Kind: static method of dice
Param | Type | Description |
---|---|---|
match | object |
Information about how to match |
match.reroll | string |
Whether to reroll 10s (exploding dice) |
match.num | number |
How many dice to roll. Defaults to ten. |
match.target | number |
The target number for the roll |
match.preroll | string |
Whether to preroll |
match.bonus | number |
The bonus to add |
callback | function |
The callback to call when complete Will receive the following parameters: - Result: the string response to return |
dice.rollFudgeDice(match, callback)
Roll Fudge dice
Kind: static method of dice
Param | Type | Description |
---|---|---|
match | object |
Information about how to match |
match.num | number |
How many dice to roll. Defaults to four |
callback | function |
The callback to call when complete |
dice.rollXDice(match, callback)
Roll arbitrary d20-style dice
Kind: static method of dice
Param | Type | Description |
---|---|---|
match | object |
Information about how to match |
match.sides | number |
What size dice to roll |
match.num | number |
How many dice to roll |
callback | function |
The callback to call when complete |
dice.parser(input, each, complete)
Parse the command to determine how many and of what type of dice to roll
Kind: static method of dice
Param | Type | Description |
---|---|---|
input | string |
The input for the dice roll command |
each | dice~each |
The function to execute for each match found |
complete | function |
The callback to call when complete |
dice.handleInput(input, callback)
Roll as many dice as can be parsed.
Kind: static method of dice
Param | Type | Description |
---|---|---|
input | string |
The input string to parse |
callback | function |
The callback to call when complete |
dice.rollDice(match, callback)
Determine what dice to roll and outsource the logic
Kind: static method of dice
Param | Type | Description |
---|---|---|
match | object |
Information about how to roll |
match.method | string |
What method to use to roll dice |
callback | function |
The callback to call when complete. |
dice.begin(browser, config)
Bootstrap the module
Kind: static method of dice
Param | Type | Description |
---|---|---|
browser | string |
discourse. |
config | object |
The configuration to use |
dice.getError() ⇒ string
Get a random error message. Adds quirkiness to the bot.
Kind: static method of dice
Returns: string
- The error string.