mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-11 03:14:35 +02:00
Minimum Value in Roll
This commit is contained in:
@@ -197,7 +197,7 @@ Total: 398
|
||||
* **random-user:** Randomly chooses a member of the server.
|
||||
* **rate:** Rates something.
|
||||
* **roast:** Roasts a user.
|
||||
* **roll:** Rolls a dice with a maximum value of your choice.
|
||||
* **roll:** Rolls a dice with a minimum/maximum value of your choice.
|
||||
* **security-key:** Responds with a random security key.
|
||||
* **shower-thought:** Responds with a random shower thought, directly from r/Showerthoughts.
|
||||
* **smw-level:** Responds with a random Super Mario World level name.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { formatNumber } = require('../../util/Util');
|
||||
const { randomRange, formatNumber } = require('../../util/Util');
|
||||
|
||||
module.exports = class RollCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -8,20 +8,34 @@ module.exports = class RollCommand extends Command {
|
||||
aliases: ['dice'],
|
||||
group: 'random-res',
|
||||
memberName: 'roll',
|
||||
description: 'Rolls a dice with a maximum value of your choice.',
|
||||
description: 'Rolls a dice with a minimum/maximum value of your choice.',
|
||||
args: [
|
||||
{
|
||||
key: 'value',
|
||||
label: 'maximum number',
|
||||
prompt: 'What is the maximum number you wish to appear?',
|
||||
key: 'maxValue',
|
||||
label: 'highest number',
|
||||
prompt: 'What is the highest number you wish to appear?',
|
||||
type: 'integer',
|
||||
default: 6
|
||||
default: 6,
|
||||
min: 1,
|
||||
max: Number.MAX_SAFE_INTEGER
|
||||
},
|
||||
{
|
||||
key: 'minValue',
|
||||
label: 'lowest number',
|
||||
prompt: 'What is the lowest number you wish to appear?',
|
||||
type: 'integer',
|
||||
default: 0,
|
||||
min: 0,
|
||||
max: Number.MAX_SAFE_INTEGER
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { value }) {
|
||||
return msg.say(`You rolled a ${formatNumber(Math.floor(Math.random() * value) + 1)}.`);
|
||||
run(msg, { maxValue, minValue }) {
|
||||
let result;
|
||||
if (!minValue) result = Math.floor(Math.random() * maxValue) + 1;
|
||||
else result = randomRange(minValue, maxValue);
|
||||
return msg.say(`You rolled a ${formatNumber(result)}.`);
|
||||
}
|
||||
};
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "113.12.1",
|
||||
"version": "113.12.2",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user