From 9f04d0f8dd737cfd3bb7ebaed89ebcf53ebabf9a Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Sat, 21 Apr 2018 01:30:16 +0000 Subject: [PATCH] random-js is cool --- README.md | 4 ++-- assets/json/coolness.json | 5 ++++- commands/analyze/coolness.js | 7 ++++--- commands/analyze/dick.js | 28 ++++++++++++++++++++++++++++ commands/analyze/ship.js | 32 ++++++++++++++++++++++++++++++++ commands/random/dick.js | 18 ------------------ commands/random/ship.js | 32 -------------------------------- package.json | 3 ++- 8 files changed, 72 insertions(+), 57 deletions(-) create mode 100644 commands/analyze/dick.js create mode 100644 commands/analyze/ship.js delete mode 100644 commands/random/dick.js delete mode 100644 commands/random/ship.js diff --git a/README.md b/README.md index 1592c002..5532844b 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,6 @@ served over 10,000 servers with a uniquely devoted fanbase. * **chuck-norris**: Responds with a random Chuck Norris joke. * **coin**: Flips a coin. * **compliment**: Compliments a user. -* **dick**: Determines your dick size. * **discord-email-fun-fact**: Responds with a random fun fact from the Discord emails. * **dog-fact**: Responds with a random dog fact. * **dog**: Responds with a random dog image. @@ -84,7 +83,6 @@ served over 10,000 servers with a uniquely devoted fanbase. * **roast**: Roasts a user. * **roll**: Rolls a dice with a maximum value of your choice. * **security-key**: Responds with a random security key. -* **ship**: Ships two people together. * **shower-thought**: Responds with a random shower thought, directly from r/Showerthoughts. * **user-roulette**: Randomly chooses a member of the server. * **would-you-rather**: Responds with a random "Would you rather ...?" question. @@ -182,10 +180,12 @@ served over 10,000 servers with a uniquely devoted fanbase. ### Analyzers: * **coolness**: Determines a user's coolness. +* **dick**: Determines your dick size. * **face-analyze**: Determines the age, gender, and race of a face. * **gender-analyze**: Determines the gender of a name. * **read-qr-code**: Reads a QR Code. * **severe-toxicity**: Determines the toxicity of text, but less sensitive to milder language. +* **ship**: Ships two users together. * **toxicity**: Determines the toxicity of text. ### Games: diff --git a/assets/json/coolness.json b/assets/json/coolness.json index 7dd37131..f22d21b3 100644 --- a/assets/json/coolness.json +++ b/assets/json/coolness.json @@ -2,11 +2,14 @@ "the coolest being to walk this Earth.", "extremely amazingly amazing.", "as cool as ice.", + "cooler than cool.", "an extremely cool dude.", "pretty sweet, not gonna lie.", "okay, nothing special.", "just not all that neat.", "awful, honestly.", "terrible in every way.", - "the worst thing I've ever had the displeasure of knowing." + "an absolute train wreck.", + "a horrible, horrible person.", + "the worst person I've ever had the displeasure of knowing." ] diff --git a/commands/analyze/coolness.js b/commands/analyze/coolness.js index 42484692..e179d225 100644 --- a/commands/analyze/coolness.js +++ b/commands/analyze/coolness.js @@ -1,4 +1,5 @@ const { Command } = require('discord.js-commando'); +const Random = require('random-js'); const texts = require('../../assets/json/coolness'); module.exports = class CoolnessCommand extends Command { @@ -21,13 +22,13 @@ module.exports = class CoolnessCommand extends Command { run(msg, { user }) { const authorUser = user.id === msg.author.id; - const coolness = Math.round(((user.id / this.client.user.id) * 10) / 2); if (user.id === this.client.user.id) return msg.reply('Me? I think I\'m the very best, like no one ever was.'); if (this.client.isOwner(user)) { 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 text = texts[Math.min(coolness, texts.length - 1)]; - return msg.reply(`${authorUser ? 'You are' : `${user.username} is`} ${text}`); + const random = new Random(Random.engines.mt19937().seed(user.id)); + const coolness = random.integer(0, texts.length - 1); + return msg.reply(`${authorUser ? 'You are' : `${user.username} is`} ${texts[coolness]}`); } }; diff --git a/commands/analyze/dick.js b/commands/analyze/dick.js new file mode 100644 index 00000000..5bab7e74 --- /dev/null +++ b/commands/analyze/dick.js @@ -0,0 +1,28 @@ +const { Command } = require('discord.js-commando'); +const Random = require('random-js'); + +module.exports = class DickCommand extends Command { + constructor(client) { + super(client, { + name: 'dick', + aliases: ['dick-size'], + group: 'analyze', + memberName: 'dick', + description: 'Determines your dick size.', + nsfw: true, + args: [ + { + key: 'user', + prompt: 'What user do you want to determine the dick size of?', + type: 'user', + default: msg => msg.author + } + ] + }); + } + + run(msg, { user }) { + const random = new Random(Random.engines.mt19937().seed(user.id)); + return msg.reply(`8${'='.repeat(random.integer(0, 200))}D`); + } +}; diff --git a/commands/analyze/ship.js b/commands/analyze/ship.js new file mode 100644 index 00000000..9e46652d --- /dev/null +++ b/commands/analyze/ship.js @@ -0,0 +1,32 @@ +const { Command } = require('discord.js-commando'); +const Random = require('random-js'); + +module.exports = class ShipCommand extends Command { + constructor(client) { + super(client, { + name: 'ship', + group: 'analyze', + memberName: 'ship', + description: 'Ships two users together.', + args: [ + { + key: 'first', + label: 'first user', + prompt: 'Who is the first user in the ship?', + type: 'user' + }, + { + key: 'second', + label: 'second user', + prompt: 'Who is the second user in the ship?', + type: 'user' + } + ] + }); + } + + run(msg, { first, second }) { + const random = new Random(Random.engines.mt19937().seed(first.id - second.id)); + return msg.say(`I'd give ${first.username} and ${second.username} a ${random.integer(0, 100)}%!`); + } +}; diff --git a/commands/random/dick.js b/commands/random/dick.js deleted file mode 100644 index 5ba9e6fe..00000000 --- a/commands/random/dick.js +++ /dev/null @@ -1,18 +0,0 @@ -const { Command } = require('discord.js-commando'); - -module.exports = class DickCommand extends Command { - constructor(client) { - super(client, { - name: 'dick', - aliases: ['dick-size'], - group: 'random', - memberName: 'dick', - description: 'Determines your dick size.', - nsfw: true - }); - } - - run(msg) { - return msg.say(`8${'='.repeat(Math.floor(Math.random() * 200) + 1)}D`); - } -}; diff --git a/commands/random/ship.js b/commands/random/ship.js deleted file mode 100644 index b2f9cb10..00000000 --- a/commands/random/ship.js +++ /dev/null @@ -1,32 +0,0 @@ -const { Command } = require('discord.js-commando'); - -module.exports = class ShipCommand extends Command { - constructor(client) { - super(client, { - name: 'ship', - group: 'random', - memberName: 'ship', - description: 'Ships two people together.', - args: [ - { - key: 'first', - label: 'first name', - prompt: 'Who is the first person in the ship?', - type: 'string', - max: 500 - }, - { - key: 'second', - label: 'second name', - prompt: 'Who is the second person in the ship?', - type: 'string', - max: 500 - } - ] - }); - } - - run(msg, { first, second }) { - return msg.say(`I'd give ${first} and ${second} a ${Math.floor(Math.random() * 100) + 1}%!`); - } -}; diff --git a/package.json b/package.json index afeb1852..0372e02c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "72.0.5", + "version": "73.0.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": { @@ -41,6 +41,7 @@ "node-opus": "^0.2.7", "pg": "^6.4.2", "pg-hstore": "^2.3.2", + "random-js": "^1.0.8", "sequelize": "^4.37.6", "snekfetch": "^3.6.4", "uws": "^9.147.0",