mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Rig seeded randoms
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
XIAO_TOKEN=
|
||||
# Seperate OWNERS with a ,
|
||||
OWNERS=
|
||||
GIRLFRIEND_USER_ID=
|
||||
XIAO_PREFIX=
|
||||
INVITE=
|
||||
XIAO_WEBHOOK_ID=
|
||||
|
||||
@@ -138,6 +138,7 @@ The difficulty in getting all of these keys is why I recommend
|
||||
|
||||
* `XIAO_TOKEN` can be obtained at the [Discord Developer Portal](https://discord.com/developers/applications/).
|
||||
* `OWNERS` is a comma-seperated list of Discord User IDs.
|
||||
* `GIRLFRIEND_USER_ID` is a Discord User ID for your lover. It rigs commands like `coolness` and `cuteness`. Totally optional, loners can leave it out.
|
||||
* `XIAO_PREFIX` is the prefix you want the bot to have. Like `x;`.
|
||||
* `INVITE` is an invite link to a Discord server. The whole thing, not just the code.
|
||||
* `XIAO_WEBHOOK_ID` is the ID of the webhook you want the `webhook` command to use.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MersenneTwister19937, integer } = require('random-js');
|
||||
const texts = require('../../assets/json/coolness');
|
||||
const { GIRLFRIEND_USER_ID } = process.env;
|
||||
|
||||
module.exports = class CoolnessCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -28,6 +29,7 @@ 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.`);
|
||||
}
|
||||
if (user.id === GIRLFRIEND_USER_ID) return msg.reply(`${user.username} is by far the coolest person ever! ❤`);
|
||||
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]}`);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MersenneTwister19937, integer } = require('random-js');
|
||||
const texts = require('../../assets/json/cuteness');
|
||||
const { GIRLFRIEND_USER_ID } = process.env;
|
||||
|
||||
module.exports = class CutenessCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -35,6 +36,7 @@ module.exports = class CutenessCommand extends Command {
|
||||
if (authorUser) return msg.reply('You\'re the most adorable little cutie I know! ❤');
|
||||
return msg.reply(`${user.username} is ugly. Like, not cute at all.`);
|
||||
}
|
||||
if (user.id === GIRLFRIEND_USER_ID) return msg.reply(`${user.username} is by far the cutest person ever! ❤`);
|
||||
const random = MersenneTwister19937.seed(user.id);
|
||||
const cuteness = integer(0, texts.length - 1)(random);
|
||||
return msg.reply(`${authorUser ? 'You are' : `${user.username} is`} ${texts[cuteness]}`);
|
||||
|
||||
@@ -4,6 +4,7 @@ const { createCanvas, loadImage, registerFont } = require('canvas');
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
const { percentColor } = require('../../util/Util');
|
||||
const { GIRLFRIEND_USER_ID } = process.env;
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Pinky Cupid.otf'), { family: 'Pinky Cupid' });
|
||||
const percentColors = [
|
||||
{ pct: 0.0, color: { r: 0, g: 0, b: 255 } },
|
||||
@@ -56,11 +57,14 @@ module.exports = class FriendshipCommand extends Command {
|
||||
const owner = this.client.isOwner(first) || this.client.isOwner(second);
|
||||
const authorUser = first.id === msg.author.id || second.id === msg.author.id;
|
||||
const botUser = first.id === this.client.user.id || second.id === this.client.user.id;
|
||||
const girlfriendUser = first.id === GIRLFRIEND_USER_ID || second.id === GIRLFRIEND_USER_ID;
|
||||
if (owner && botUser) {
|
||||
if (authorUser) level = 100;
|
||||
else level = 0;
|
||||
} else if (self) {
|
||||
level = 100;
|
||||
} else if (girlfriendUser && owner) {
|
||||
level = 100;
|
||||
} else {
|
||||
const calculated = -Math.abs(Number.parseInt(BigInt(first.id) - BigInt(second.id), 10));
|
||||
const random = MersenneTwister19937.seed(calculated);
|
||||
|
||||
@@ -3,6 +3,7 @@ const { oneLine } = require('common-tags');
|
||||
const { MersenneTwister19937, integer } = require('random-js');
|
||||
const genders = ['male', 'female'];
|
||||
const { eyeColors, hairColors, hairStyles, extras } = require('../../assets/json/guess-looks');
|
||||
const { GIRLFRIEND_USER_ID } = process.env;
|
||||
|
||||
module.exports = class GuessLooksCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -30,6 +31,9 @@ module.exports = class GuessLooksCommand extends Command {
|
||||
if (authorUser) return msg.reply('You look amazing as always! ❤');
|
||||
return msg.reply(`${user.username} looks like a monkey, and smells like one too.`);
|
||||
}
|
||||
if (user.id === GIRLFRIEND_USER_ID) {
|
||||
return msg.reply(`Know what perfection looks like? That's what ${user.username} looks like. ❤`);
|
||||
}
|
||||
const random = MersenneTwister19937.seed(user.id);
|
||||
const gender = genders[integer(0, genders.length - 1)(random)];
|
||||
const eyeColor = eyeColors[integer(0, eyeColors.length - 1)(random)];
|
||||
|
||||
@@ -4,6 +4,7 @@ const { createCanvas, loadImage, registerFont } = require('canvas');
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
const { percentColor } = require('../../util/Util');
|
||||
const { GIRLFRIEND_USER_ID } = process.env;
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Pinky Cupid.otf'), { family: 'Pinky Cupid' });
|
||||
const percentColors = [
|
||||
{ pct: 0.0, color: { r: 0, g: 0, b: 255 } },
|
||||
@@ -56,10 +57,13 @@ module.exports = class ShipCommand extends Command {
|
||||
const owner = this.client.isOwner(first) || this.client.isOwner(second);
|
||||
const authorUser = first.id === msg.author.id || second.id === msg.author.id;
|
||||
const botUser = first.id === this.client.user.id || second.id === this.client.user.id;
|
||||
const girlfriendUser = first.id === GIRLFRIEND_USER_ID || second.id === GIRLFRIEND_USER_ID;
|
||||
if (owner && botUser) {
|
||||
level = 0;
|
||||
} else if (self) {
|
||||
level = 100;
|
||||
} else if (girlfriendUser && owner) {
|
||||
level = 100;
|
||||
} else {
|
||||
const calculated = Math.abs(Number.parseInt(BigInt(first.id) - BigInt(second.id), 10));
|
||||
const random = MersenneTwister19937.seed(calculated);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MersenneTwister19937, bool } = require('random-js');
|
||||
const { GIRLFRIEND_USER_ID } = process.env;
|
||||
|
||||
module.exports = class SmashOrPassCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -27,7 +28,7 @@ module.exports = class SmashOrPassCommand extends Command {
|
||||
return msg.reply('I sure hope no one is dumb enough to smash that... Thing.');
|
||||
}
|
||||
const random = MersenneTwister19937.seed(user.id);
|
||||
const smashOrPass = bool()(random);
|
||||
const smashOrPass = user.id === GIRLFRIEND_USER_ID || bool()(random);
|
||||
return msg.reply(smashOrPass ? 'Smash, I\'d definitely smash.' : 'Hard pass. Yuck.');
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { MersenneTwister19937, integer } = require('random-js');
|
||||
const { formatNumber } = require('../../util/Util');
|
||||
const { GIRLFRIEND_USER_ID } = process.env;
|
||||
|
||||
module.exports = class WorthCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -32,9 +33,12 @@ module.exports = class WorthCommand extends Command {
|
||||
const authorUser = user.id === msg.author.id;
|
||||
if (user.id === this.client.user.id) return msg.reply('Me? I\'m worth $5/month. At least that\'s how much I cost.');
|
||||
if (this.client.isOwner(user)) {
|
||||
if (authorUser) return msg.reply('Infinity, you amazing owner ❤');
|
||||
if (authorUser) return msg.reply('Infinity, you amazing owner! ❤');
|
||||
return msg.reply(`${user.username}, as in my owner? Worthless. Absolutely worthless.`);
|
||||
}
|
||||
if (user.id === GIRLFRIEND_USER_ID) {
|
||||
return msg.reply(`${user.username} is worth more than anyone else on this Earth! ❤`);
|
||||
}
|
||||
const random = MersenneTwister19937.seed(user.id);
|
||||
const worth = integer(0, 1000000)(random);
|
||||
return msg.reply(`${authorUser ? 'You are' : `${user.username} is`} worth $${formatNumber(worth)}.`);
|
||||
|
||||
Reference in New Issue
Block a user