mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-08 07:11:49 +02:00
Updates
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const answers = require('../../assets/json/8-ball');
|
||||
|
||||
module.exports = class EightBallCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: '8-ball',
|
||||
aliases: ['magic-8-ball', 'eight-ball', 'magic-eight-ball'],
|
||||
group: 'random',
|
||||
memberName: '8-ball',
|
||||
description: 'Asks your question to the Magic 8 Ball.',
|
||||
args: [
|
||||
{
|
||||
key: 'question',
|
||||
prompt: 'What do you want to ask the 8 ball?',
|
||||
type: 'string',
|
||||
max: 1950
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { question }) {
|
||||
return msg.say(stripIndents`
|
||||
${question}
|
||||
🎱 ${answers[Math.floor(Math.random() * answers.length)]} 🎱
|
||||
`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const facts = require('../../assets/json/cat-fact');
|
||||
|
||||
module.exports = class CatFactCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'cat-fact',
|
||||
aliases: ['neko-fact', 'kitty-fact'],
|
||||
group: 'random',
|
||||
memberName: 'cat-fact',
|
||||
description: 'Responds with a random cat fact.'
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
return msg.say(facts[Math.floor(Math.random() * facts.length)]);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class CatCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'cat',
|
||||
aliases: ['neko', 'kitty'],
|
||||
group: 'random',
|
||||
memberName: 'cat',
|
||||
description: 'Responds with a random cat image.',
|
||||
clientPermissions: ['ATTACH_FILES']
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
try {
|
||||
const { body } = await snekfetch.get('http://random.cat/meow');
|
||||
return msg.say({ files: [body.file] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { stripIndent } = require('common-tags');
|
||||
const answers = ['yes', 'no'];
|
||||
|
||||
module.exports = class CharlieCharlieChallengeCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'charlie-charlie-challenge',
|
||||
aliases: ['charlie-charlie'],
|
||||
group: 'random',
|
||||
memberName: 'charlie-charlie-challenge',
|
||||
description: 'Asks your question to Charlie.',
|
||||
args: [
|
||||
{
|
||||
key: 'question',
|
||||
prompt: 'What do you want to ask Charlie?',
|
||||
type: 'string',
|
||||
max: 1900
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { question }) {
|
||||
const answer = answers[Math.floor(Math.random() * answers.length)];
|
||||
return msg.say(stripIndent`
|
||||
${question}
|
||||
\`\`\`
|
||||
${answer === 'no' ? '\\' : ' '} | ${answer === 'yes' ? '/' : ' '}
|
||||
NO ${answer === 'no' ? '\\' : ' '} | ${answer === 'yes' ? '/' : ' '}YES
|
||||
${answer === 'no' ? '\\' : ' '}|${answer === 'yes' ? '/' : ' '}
|
||||
————————————————
|
||||
${answer === 'yes' ? '/' : ' '}|${answer === 'no' ? '\\' : ' '}
|
||||
YES${answer === 'yes' ? '/' : ' '} | ${answer === 'no' ? '\\' : ' '}NO
|
||||
${answer === 'yes' ? '/' : ' '} | ${answer === 'no' ? '\\' : ' '}
|
||||
\`\`\`
|
||||
`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
|
||||
module.exports = class ChooseCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'choose',
|
||||
aliases: ['pick'],
|
||||
group: 'random',
|
||||
memberName: 'choose',
|
||||
description: 'Chooses between options you provide.',
|
||||
args: [
|
||||
{
|
||||
key: 'choices',
|
||||
prompt: 'What choices do you want me pick from?',
|
||||
type: 'string',
|
||||
infinite: true,
|
||||
max: 1950
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { choices }) {
|
||||
return msg.say(`I choose ${choices[Math.floor(Math.random() * choices.length)]}!`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class ChuckNorrisCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'chuck-norris',
|
||||
aliases: ['chuck', 'norris'],
|
||||
group: 'random',
|
||||
memberName: 'chuck-norris',
|
||||
description: 'Responds with a random Chuck Norris joke.',
|
||||
args: [
|
||||
{
|
||||
key: 'name',
|
||||
prompt: 'What would you like the name to be?',
|
||||
type: 'string',
|
||||
default: 'Chuck'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { name }) {
|
||||
try {
|
||||
const { body } = await snekfetch
|
||||
.get('http://api.icndb.com/jokes/random')
|
||||
.query({
|
||||
escape: 'javascript',
|
||||
firstName: name
|
||||
});
|
||||
return msg.say(body.value.joke);
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const sides = ['heads', 'tails'];
|
||||
|
||||
module.exports = class CoinCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'coin',
|
||||
aliases: ['coin-flip', 'flip'],
|
||||
group: 'random',
|
||||
memberName: 'coin',
|
||||
description: 'Flips a coin.'
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
return msg.say(`It landed on ${sides[Math.floor(Math.random() * sides.length)]}!`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const compliments = require('../../assets/json/compliment');
|
||||
|
||||
module.exports = class ComplimentCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'compliment',
|
||||
group: 'random',
|
||||
memberName: 'compliment',
|
||||
description: 'Compliments a user.',
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'What user do you want to compliment?',
|
||||
type: 'user',
|
||||
default: ''
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { user }) {
|
||||
if (!user) user = msg.author;
|
||||
return msg.say(`${user.username}, ${compliments[Math.floor(Math.random() * compliments.length)]}`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const facts = require('../../assets/json/dog-fact');
|
||||
|
||||
module.exports = class DogFactCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'dog-fact',
|
||||
aliases: ['puppy-fact'],
|
||||
group: 'random',
|
||||
memberName: 'dog-fact',
|
||||
description: 'Responds with a random dog fact.'
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
return msg.say(facts[Math.floor(Math.random() * facts.length)]);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class DogCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'dog',
|
||||
aliases: ['puppy'],
|
||||
group: 'random',
|
||||
memberName: 'dog',
|
||||
description: 'Responds with a random dog image.',
|
||||
clientPermissions: ['ATTACH_FILES']
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
try {
|
||||
const { body } = await snekfetch.get('https://dog.ceo/api/breeds/image/random');
|
||||
return msg.say({ files: [body.message] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const facts = require('../../assets/json/fact-core');
|
||||
|
||||
module.exports = class FactCoreCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'fact-core',
|
||||
group: 'random',
|
||||
memberName: 'fact-core',
|
||||
description: 'Responds with a random Fact Core quote.'
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
return msg.say(facts[Math.floor(Math.random() * facts.length)]);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const nimbats = require('../../assets/json/fidget');
|
||||
|
||||
module.exports = class FidgetCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'fidget',
|
||||
aliases: ['nimbat'],
|
||||
group: 'random',
|
||||
memberName: 'fidget',
|
||||
description: 'Responds with a random image of Fidget.',
|
||||
clientPermissions: ['ATTACH_FILES']
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
return msg.say({ files: [nimbats[Math.floor(Math.random() * nimbats.length)]] });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const fortunes = require('../../assets/json/fortune');
|
||||
|
||||
module.exports = class FortuneCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'fortune',
|
||||
aliases: ['fortune-cookie'],
|
||||
group: 'random',
|
||||
memberName: 'fortune',
|
||||
description: 'Responds with a random fortune.'
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
return msg.say(stripIndents`
|
||||
${fortunes[Math.floor(Math.random() * fortunes.length)]}
|
||||
${Array.from({ length: 6 }, () => Math.floor(Math.random() * 100)).join(', ')}
|
||||
`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { oneLine } = require('common-tags');
|
||||
const { randomRange } = require('../../util/Util');
|
||||
const genders = ['male', 'female'];
|
||||
const { eyeColors, hairColors, hairStyles, extras } = require('../../assets/json/guess-looks');
|
||||
|
||||
module.exports = class GuessLooksCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'guess-looks',
|
||||
aliases: ['guess-my-looks'],
|
||||
group: 'random',
|
||||
memberName: 'guess-looks',
|
||||
description: 'Guesses what a user looks like.',
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'Which user do you want me to guess the looks of?',
|
||||
type: 'user',
|
||||
default: ''
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { user }) {
|
||||
if (!user) user = msg.author;
|
||||
const gender = genders[Math.floor(Math.random() * genders.length)];
|
||||
const eyeColor = eyeColors[Math.floor(Math.random() * eyeColors.length)];
|
||||
const hairColor = hairColors[Math.floor(Math.random() * hairColors.length)];
|
||||
const hairStyle = hairStyles[Math.floor(Math.random() * hairStyles.length)];
|
||||
const age = randomRange(10, 100);
|
||||
const feet = randomRange(3, 7);
|
||||
const inches = Math.floor(Math.random() * 12);
|
||||
const weight = randomRange(50, 300);
|
||||
const extra = extras[Math.floor(Math.random() * extras.length)];
|
||||
return msg.say(oneLine`
|
||||
I think ${user.username} is a ${age} year old ${gender} with ${eyeColor} eyes and ${hairStyle} ${hairColor}
|
||||
hair. They are ${feet}'${inches}" and weigh ${weight} pounds. Don't forget the ${extra}!
|
||||
`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const jokes = require('../../assets/json/joke');
|
||||
|
||||
module.exports = class JokeCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'joke',
|
||||
group: 'random',
|
||||
memberName: 'joke',
|
||||
description: 'Responds with a random joke.'
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
return msg.say(jokes[Math.floor(Math.random() * jokes.length)]);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { shuffle } = require('../../util/Util');
|
||||
|
||||
module.exports = class KissMarryKillCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'kiss-marry-kill',
|
||||
aliases: ['kiss-kill-marry', 'kill-kiss-marry', 'kill-marry-kiss', 'marry-kiss-kill', 'marry-kill-kiss'],
|
||||
group: 'random',
|
||||
memberName: 'kiss-marry-kill',
|
||||
description: 'Determines who to kiss, who to marry, and who to kill.',
|
||||
args: [
|
||||
{
|
||||
key: 'first',
|
||||
label: 'first name',
|
||||
prompt: 'Who is the first person you choose?',
|
||||
type: 'string',
|
||||
max: 500
|
||||
},
|
||||
{
|
||||
key: 'second',
|
||||
label: 'second name',
|
||||
prompt: 'Who is the second person you choose?',
|
||||
type: 'string',
|
||||
max: 500
|
||||
},
|
||||
{
|
||||
key: 'third',
|
||||
label: 'third name',
|
||||
prompt: 'Who is the third person you choose?',
|
||||
type: 'string',
|
||||
max: 500
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { first, second, third }) {
|
||||
const things = shuffle([first, second, third]);
|
||||
return msg.say(`I'd kiss ${things[0]}, marry ${things[1]}, and kill ${things[2]}.`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { stripIndents } = require('common-tags');
|
||||
const answers = require('../../assets/json/magic-conch');
|
||||
|
||||
module.exports = class MagicConchCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'magic-conch',
|
||||
aliases: ['magic-conch-shell'],
|
||||
group: 'random',
|
||||
memberName: 'magic-conch',
|
||||
description: 'Asks your question to the Magic Conch.',
|
||||
args: [
|
||||
{
|
||||
key: 'question',
|
||||
prompt: 'What do you want to ask the magic conch?',
|
||||
type: 'string',
|
||||
max: 1950
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { question }) {
|
||||
return msg.say(stripIndents`
|
||||
${question}
|
||||
🐚 ${answers[Math.floor(Math.random() * answers.length)]} 🐚
|
||||
`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,43 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const snekfetch = require('snekfetch');
|
||||
const { list } = require('../../util/Util');
|
||||
const genders = ['male', 'female', 'both'];
|
||||
|
||||
module.exports = class NameCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'name',
|
||||
group: 'random',
|
||||
memberName: 'name',
|
||||
description: 'Responds with a random name, with the gender of your choice.',
|
||||
args: [
|
||||
{
|
||||
key: 'gender',
|
||||
prompt: `Which gender do you want to generate a name for? Either ${list(genders, 'or')}.`,
|
||||
type: 'string',
|
||||
default: 'both',
|
||||
validate: gender => {
|
||||
if (genders.includes(gender.toLowerCase())) return true;
|
||||
return `Invalid gender, please enter either ${list(genders, 'or')}.`;
|
||||
},
|
||||
parse: gender => gender.toLowerCase()
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { gender }) {
|
||||
try {
|
||||
const { body } = await snekfetch
|
||||
.get('http://namey.muffinlabs.com/name.json')
|
||||
.query({
|
||||
with_surname: true,
|
||||
type: gender,
|
||||
frequency: 'all'
|
||||
});
|
||||
return msg.say(body[0]);
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class NumberFactCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'number-fact',
|
||||
group: 'random',
|
||||
memberName: 'number-fact',
|
||||
description: 'Responds with a random fact about a specific number.',
|
||||
args: [
|
||||
{
|
||||
key: 'number',
|
||||
prompt: 'What number do you want to get a fact for?',
|
||||
type: 'integer'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { number }) {
|
||||
try {
|
||||
const { text } = await snekfetch.get(`http://numbersapi.com/${number}`);
|
||||
return msg.say(text);
|
||||
} catch (err) {
|
||||
if (err.status === 404) return msg.say('Could not find any results.');
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const genders = ['boy', 'girl'];
|
||||
|
||||
module.exports = class OffspringCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'offspring',
|
||||
aliases: ['sex'],
|
||||
group: 'random',
|
||||
memberName: 'offspring',
|
||||
description: 'Determines if your new child will be a boy or a girl.'
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
return msg.say(`It's a ${genders[Math.floor(Math.random() * genders.length)]}!`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const pikachus = require('../../assets/json/pikachu');
|
||||
|
||||
module.exports = class PikachuCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'pikachu',
|
||||
aliases: ['pika'],
|
||||
group: 'random',
|
||||
memberName: 'pikachu',
|
||||
description: 'Responds with a random image of Pikachu.',
|
||||
clientPermissions: ['ATTACH_FILES']
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
return msg.say({ files: [pikachus[Math.floor(Math.random() * pikachus.length)]] });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const sides = [NaN, 0, null, undefined, ''];
|
||||
|
||||
module.exports = class QuantumCoinCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'quantum-coin',
|
||||
aliases: ['q-coin'],
|
||||
group: 'random',
|
||||
memberName: 'quantum-coin',
|
||||
description: 'Flips a coin that lands on some form of nothing.'
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
return msg.say(`It landed on ${sides[Math.floor(Math.random() * sides.length)]}.`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const quotes = require('../../assets/json/quote');
|
||||
|
||||
module.exports = class QuoteCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'quote',
|
||||
group: 'random',
|
||||
memberName: 'quote',
|
||||
description: 'Responds with a random quote.'
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
const quote = quotes[Math.floor(Math.random() * quotes.length)];
|
||||
return msg.say(`${quote.quote} - _${quote.author}_`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
|
||||
module.exports = class RateWaifuCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'rate-waifu',
|
||||
aliases: ['waifu', 'rate'],
|
||||
group: 'random',
|
||||
memberName: 'rate-waifu',
|
||||
description: 'Rates a waifu.',
|
||||
args: [
|
||||
{
|
||||
key: 'waifu',
|
||||
prompt: 'Who do you want to rate?',
|
||||
type: 'string',
|
||||
max: 1950
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { waifu }) {
|
||||
return msg.say(`I'd give ${waifu} a ${Math.floor(Math.random() * 10) + 1}/10!`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,51 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class RedditCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'reddit',
|
||||
aliases: ['subreddit'],
|
||||
group: 'random',
|
||||
memberName: 'reddit',
|
||||
description: 'Responds with a random post from a subreddit.',
|
||||
clientPermissions: ['EMBED_LINKS'],
|
||||
args: [
|
||||
{
|
||||
key: 'subreddit',
|
||||
prompt: 'What subreddit would you like to get a post from?',
|
||||
type: 'string',
|
||||
parse: subreddit => encodeURIComponent(subreddit)
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { subreddit }) {
|
||||
try {
|
||||
const { body } = await snekfetch
|
||||
.get(`https://www.reddit.com/r/${subreddit}/new.json`)
|
||||
.query({ sort: 'new' });
|
||||
const allowed = msg.channel.nsfw ? body.data.children : body.data.children.filter(post => !post.data.over_18);
|
||||
if (!allowed.length) return msg.say('Could not find any results.');
|
||||
const post = allowed[Math.floor(Math.random() * allowed.length)].data;
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0xFF4500)
|
||||
.setAuthor('Reddit', 'https://i.imgur.com/DSBOK0P.png')
|
||||
.setURL(`https://www.reddit.com${post.permalink}`)
|
||||
.setTitle(post.title)
|
||||
.addField('❯ Upvotes',
|
||||
post.ups, true)
|
||||
.addField('❯ Downvotes',
|
||||
post.downs, true)
|
||||
.addField('❯ Score',
|
||||
post.score, true);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
if (err.status === 403) return msg.say('This subreddit is private.');
|
||||
if (err.status === 404) return msg.say('Could not find any results.');
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const roasts = require('../../assets/json/roast');
|
||||
|
||||
module.exports = class RoastCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'roast',
|
||||
group: 'random',
|
||||
memberName: 'roast',
|
||||
description: 'Roasts a user.',
|
||||
args: [
|
||||
{
|
||||
key: 'user',
|
||||
prompt: 'What user do you want to roast?',
|
||||
type: 'user',
|
||||
default: ''
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { user }) {
|
||||
if (!user) user = msg.author;
|
||||
return msg.say(`${user.username}, ${roasts[Math.floor(Math.random() * roasts.length)]}`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
|
||||
module.exports = class RollCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'roll',
|
||||
aliases: ['dice'],
|
||||
group: 'random',
|
||||
memberName: 'roll',
|
||||
description: 'Rolls a dice with a maximum value of your choice.',
|
||||
args: [
|
||||
{
|
||||
key: 'value',
|
||||
label: 'maximum number',
|
||||
prompt: 'What is the maximum number you wish to appear?',
|
||||
type: 'integer',
|
||||
default: 6
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
run(msg, { value }) {
|
||||
return msg.say(`You rolled a ${Math.floor(Math.random() * value) + 1}.`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
|
||||
module.exports = class RouletteCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'roulette',
|
||||
group: 'random',
|
||||
memberName: 'roulette',
|
||||
description: 'Randomly chooses a member of the server.',
|
||||
guildOnly: true
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
return msg.say(`I choose ${msg.guild.members.random().displayName}!`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
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}%!`);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const snekfetch = require('snekfetch');
|
||||
|
||||
module.exports = class ShowerThoughtCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'shower-thought',
|
||||
aliases: ['shower-thoughts'],
|
||||
group: 'random',
|
||||
memberName: 'shower-thought',
|
||||
description: 'Responds with a random shower thought, directly from r/Showerthoughts.'
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
try {
|
||||
const { body } = await snekfetch
|
||||
.get('https://www.reddit.com/r/Showerthoughts.json')
|
||||
.query({ limit: 1000 });
|
||||
const allowed = msg.channel.nsfw ? body.data.children : body.data.children.filter(post => !post.data.over_18);
|
||||
if (!allowed.length) return msg.say('Hmm... It seems the thoughts are all gone right now. Try again later!');
|
||||
return msg.say(allowed[Math.floor(Math.random() * allowed.length)].data.title);
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const questions = require('../../assets/json/would-you-rather');
|
||||
|
||||
module.exports = class WouldYouRatherCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'would-you-rather',
|
||||
aliases: ['wy-rather'],
|
||||
group: 'random',
|
||||
memberName: 'would-you-rather',
|
||||
description: 'Responds with a random "Would you rather ...?" question.'
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
return msg.say(questions[Math.floor(Math.random() * questions.length)]);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const xiaos = require('../../assets/json/xiao');
|
||||
|
||||
module.exports = class XiaoCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'xiao',
|
||||
aliases: ['xiao-pai', 'iao'],
|
||||
group: 'random',
|
||||
memberName: 'xiao',
|
||||
description: 'Responds with a random image of Xiao Pai.',
|
||||
clientPermissions: ['ATTACH_FILES']
|
||||
});
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
return msg.say({ files: [xiaos[Math.floor(Math.random() * xiaos.length)]] });
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user