random-js 2.0.0

This commit is contained in:
Daniel Odendahl Jr
2019-04-24 16:58:07 +00:00
parent 64f11322d0
commit 59e8972a24
8 changed files with 33 additions and 33 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
const Random = require('random-js');
const { MersenneTwister19937, integer } = require('random-js');
const texts = require('../../assets/json/butt');
module.exports = class ButtCommand extends Command {
@@ -29,8 +29,8 @@ module.exports = class ButtCommand extends Command {
run(msg, { user }) {
if (user.id === this.client.user.id) return msg.reply('Me? I think I have the best butt around!');
const random = new Random(Random.engines.mt19937().seed(user.id));
const quality = random.integer(0, texts.length - 1);
const random = MersenneTwister19937.seed(user.id);
const quality = integer(0, texts.length - 1)(random);
return msg.reply(`${user.id === msg.author.id ? 'ur' : `${user.username}'s`} butt is ${texts[quality]}`);
}
};
+3 -3
View File
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
const Random = require('random-js');
const { MersenneTwister19937, integer } = require('random-js');
const texts = require('../../assets/json/coolness');
module.exports = class CoolnessCommand extends Command {
@@ -27,8 +27,8 @@ module.exports = class CoolnessCommand extends Command {
if (authorUser) return msg.reply('You\'re the best owner a bot could ask for! ❤');
return msg.reply(`Don't tell them I said this but I think ${user.username} smells like a sack of diapers.`);
}
const random = new Random(Random.engines.mt19937().seed(user.id));
const coolness = random.integer(0, texts.length - 1);
const random = MersenneTwister19937.seed(user.id);
const coolness = integer(0, texts.length - 1)(random);
return msg.reply(`${authorUser ? 'You are' : `${user.username} is`} ${texts[coolness]}`);
}
};
+3 -3
View File
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
const Random = require('random-js');
const { MersenneTwister19937, integer } = require('random-js');
module.exports = class DickCommand extends Command {
constructor(client) {
@@ -23,8 +23,8 @@ module.exports = class DickCommand extends Command {
run(msg, { user }) {
const clientAuthor = user.id === this.client.user.id;
const random = new Random(Random.engines.mt19937().seed(clientAuthor ? msg.author.id : user.id));
const length = random.integer(0, 200);
const random = MersenneTwister19937.seed(clientAuthor ? msg.author.id : user.id);
const length = integer(0, 200)(random);
return msg.reply(`8${'='.repeat(clientAuthor ? length + 1 : length)}D`);
}
};
+11 -11
View File
@@ -1,6 +1,6 @@
const Command = require('../../structures/Command');
const { oneLine } = require('common-tags');
const Random = require('random-js');
const { MersenneTwister19937, integer } = require('random-js');
const genders = ['male', 'female'];
const { eyeColors, hairColors, hairStyles, extras } = require('../../assets/json/guess-looks');
@@ -26,16 +26,16 @@ module.exports = class GuessLooksCommand extends Command {
run(msg, { user }) {
if (user.id === this.client.user.id) return msg.reply('Me? Just look at my avatar, dummy.');
const authorUser = user.id === msg.author.id;
const random = new Random(Random.engines.mt19937().seed(user.id));
const gender = genders[random.integer(0, genders.length - 1)];
const eyeColor = eyeColors[random.integer(0, eyeColors.length - 1)];
const hairColor = hairColors[random.integer(0, hairColors.length - 1)];
const hairStyle = hairStyles[random.integer(0, hairStyles.length - 1)];
const age = random.integer(10, 100);
const feet = random.integer(3, 7);
const inches = random.integer(0, 11);
const weight = random.integer(50, 300);
const extra = extras[random.integer(0, extras.length - 1)];
const random = MersenneTwister19937.seed(user.id);
const gender = genders[integer(0, genders.length - 1)(random)];
const eyeColor = eyeColors[integer(0, eyeColors.length - 1)(random)];
const hairColor = hairColors[integer(0, hairColors.length - 1)(random)];
const hairStyle = hairStyles[integer(0, hairStyles.length - 1)(random)];
const age = integer(10, 100)(random);
const feet = integer(3, 7)(random);
const inches = integer(0, 11)(random);
const weight = integer(50, 300)(random);
const extra = extras[integer(0, extras.length - 1)(random)];
return msg.reply(oneLine`
I think ${authorUser ? 'you are' : `${user.username} is`} a ${age} year old ${gender} with ${eyeColor} eyes
and ${hairStyle} ${hairColor} hair. ${authorUser ? 'You are' : `${gender === 'male' ? 'He' : 'She'} is`}
+3 -3
View File
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
const Random = require('random-js');
const { MersenneTwister19937, integer } = require('random-js');
module.exports = class IQCommand extends Command {
constructor(client) {
@@ -22,8 +22,8 @@ module.exports = class IQCommand extends Command {
run(msg, { user }) {
if (user.id === this.client.user.id) return msg.reply('Me? My IQ score is off the charts!');
const random = new Random(Random.engines.mt19937().seed(user.id));
const score = random.integer(20, 170);
const random = MersenneTwister19937.seed(user.id);
const score = integer(20, 170)(random);
return msg.reply(`${user.id === msg.author.id ? 'Your' : `${user.username}'s`} IQ score is ${score}.`);
}
};
+3 -3
View File
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
const Random = require('random-js');
const { MersenneTwister19937, integer } = require('random-js');
const { under100, between, over300 } = require('../../assets/json/psycho-pass');
module.exports = class PsychoPassCommand extends Command {
@@ -29,8 +29,8 @@ module.exports = class PsychoPassCommand extends Command {
run(msg, { user }) {
if (user.id === this.client.user.id) return msg.reply('Me? I-I\'m not dangerous, I promise!');
const random = new Random(Random.engines.mt19937().seed(user.id));
const coefficient = random.integer(0, 500);
const random = MersenneTwister19937.seed(user.id);
const coefficient = integer(0, 500)(random);
let res;
if (coefficient < 100) res = under100;
else if (coefficient > 300) res = over300;
+3 -3
View File
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
const Random = require('random-js');
const { MersenneTwister19937, integer } = require('random-js');
const { oneLine } = require('common-tags');
module.exports = class ShipCommand extends Command {
@@ -30,8 +30,8 @@ module.exports = class ShipCommand extends Command {
run(msg, { first, second }) {
if (first.id === second.id) return msg.reply('Shipping someone with themselves would be pretty weird.');
const authorInvolved = first.id === msg.author.id || second.id === msg.author.id;
const random = new Random(Random.engines.mt19937().seed(Math.abs(first.id - second.id)));
const level = random.integer(0, 100);
const random = MersenneTwister19937.seed(Math.abs(first.id - second.id));
const level = integer(0, 100)(random);
const botText = first.id === this.client.user.id || second.id === this.client.user.id
? level >= 70
? `But ${authorInvolved ? 'you\'re' : 'they\'re'} still rejected.`
+4 -4
View File
@@ -28,7 +28,7 @@
},
"homepage": "https://github.com/dragonfire535/xiao#readme",
"engines": {
"node": ">=10"
"node": ">=11"
},
"dependencies": {
"@discordjs/uws": "^11.149.1",
@@ -46,14 +46,14 @@
"moment-timezone": "^0.5.25",
"neopet-image-finder": "^5.0.2",
"node-superfetch": "^0.1.9",
"random-js": "^1.0.8",
"random-js": "^2.0.0",
"winston": "^3.2.1",
"zlib-sync": "^0.1.4"
},
"devDependencies": {
"eslint": "^5.8.0",
"eslint": "^5.16.0",
"eslint-config-amber": "^2.0.0",
"eslint-plugin-json": "^1.2.1"
"eslint-plugin-json": "^1.4.0"
},
"eslintConfig": {
"extends": "amber",