Split random response and random image, Lando Command

This commit is contained in:
Dragon Fire
2020-03-23 11:42:43 -04:00
parent faa42bd6d8
commit 9745b15e57
57 changed files with 101 additions and 66 deletions
+38
View File
@@ -0,0 +1,38 @@
const Command = require('../../structures/Command');
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-res',
memberName: '8-ball',
description: 'Asks your question to the Magic 8 Ball.',
credit: [
{
name: 'Mattel',
url: 'https://www.mattel.com/en-us',
reason: 'Original Concept',
reasonURL: 'https://www.mattelgames.com/games/en-us/kids/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)]} 🎱
`);
}
};
+32
View File
@@ -0,0 +1,32 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
module.exports = class AdviceCommand extends Command {
constructor(client) {
super(client, {
name: 'advice',
aliases: ['advice-slip'],
group: 'random-res',
memberName: 'advice',
description: 'Responds with a random bit of advice.',
credit: [
{
name: 'Advice Slip',
url: 'https://adviceslip.com/',
reason: 'API',
reasonURL: 'https://api.adviceslip.com/'
}
]
});
}
async run(msg) {
try {
const { text } = await request.get('http://api.adviceslip.com/advice');
const body = JSON.parse(text);
return msg.say(`${body.slip.advice} (#${body.slip.slip_id})`);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+30
View File
@@ -0,0 +1,30 @@
const Command = require('../../structures/Command');
const teachings = require('../../assets/json/axis-cult');
module.exports = class AxisCultCommand extends Command {
constructor(client) {
super(client, {
name: 'axis-cult',
aliases: ['axis', 'axis-pray'],
group: 'random-res',
memberName: 'axis-cult',
description: 'Responds with a teaching of the Axis Cult.',
credit: [
{
name: 'Axis Order Bot',
url: 'https://www.reddit.com/r/axisorderbot/wiki/index',
reason: 'Prayer Data'
},
{
name: 'KONOSUBA -God\'s blessing on this wonderful world!',
url: 'http://konosuba.com/',
reason: 'Original Anime'
}
]
});
}
run(msg) {
return msg.say(teachings[Math.floor(Math.random() * teachings.length)]);
}
};
+18
View File
@@ -0,0 +1,18 @@
const Command = require('../../structures/Command');
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-res',
memberName: 'cat-fact',
description: 'Responds with a random cat fact.'
});
}
run(msg) {
return msg.say(facts[Math.floor(Math.random() * facts.length)]);
}
};
+39
View File
@@ -0,0 +1,39 @@
const Command = require('../../structures/Command');
const { stripIndent } = require('common-tags');
const answers = ['yes', 'no'];
module.exports = class CharlieCharlieCommand extends Command {
constructor(client) {
super(client, {
name: 'charlie-charlie',
aliases: ['charlie-charlie-challenge'],
group: 'random-res',
memberName: 'charlie-charlie',
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' ? '\\' : ' '}
\`\`\`
`);
}
};
+26
View File
@@ -0,0 +1,26 @@
const Command = require('../../structures/Command');
module.exports = class ChooseCommand extends Command {
constructor(client) {
super(client, {
name: 'choose',
aliases: ['pick'],
group: 'random-res',
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)]}!`);
}
};
+49
View File
@@ -0,0 +1,49 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
module.exports = class ChuckNorrisCommand extends Command {
constructor(client) {
super(client, {
name: 'chuck-norris',
aliases: ['norris'],
group: 'random-res',
memberName: 'chuck-norris',
description: 'Responds with a random Chuck Norris joke.',
credit: [
{
name: 'Chuck Norris',
url: 'https://chucknorris.com/',
reason: 'Himself'
},
{
name: 'The Internet Chuck Norris Database',
url: 'http://www.icndb.com/',
reason: 'API',
reasonURL: 'http://www.icndb.com/api/'
}
],
args: [
{
key: 'name',
prompt: 'What would you like the name to be?',
type: 'string',
default: 'Chuck'
}
]
});
}
async run(msg, { name }) {
try {
const { body } = await request
.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!`);
}
}
};
+18
View File
@@ -0,0 +1,18 @@
const Command = require('../../structures/Command');
const sides = ['heads', 'tails'];
module.exports = class CoinCommand extends Command {
constructor(client) {
super(client, {
name: 'coin',
aliases: ['coin-flip', 'flip'],
group: 'random-res',
memberName: 'coin',
description: 'Flips a coin.'
});
}
run(msg) {
return msg.say(`It landed on ${sides[Math.floor(Math.random() * sides.length)]}!`);
}
};
+25
View File
@@ -0,0 +1,25 @@
const Command = require('../../structures/Command');
const compliments = require('../../assets/json/compliment');
module.exports = class ComplimentCommand extends Command {
constructor(client) {
super(client, {
name: 'compliment',
group: 'random-res',
memberName: 'compliment',
description: 'Compliments a user.',
args: [
{
key: 'user',
prompt: 'What user do you want to compliment?',
type: 'user',
default: msg => msg.author
}
]
});
}
run(msg, { user }) {
return msg.say(`${user.username}, ${compliments[Math.floor(Math.random() * compliments.length)]}`);
}
};
+18
View File
@@ -0,0 +1,18 @@
const Command = require('../../structures/Command');
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-res',
memberName: 'dog-fact',
description: 'Responds with a random dog fact.'
});
}
run(msg) {
return msg.say(facts[Math.floor(Math.random() * facts.length)]);
}
};
+53
View File
@@ -0,0 +1,53 @@
const Command = require('../../structures/Command');
const { shuffle } = require('../../util/Util');
const suits = ['♣', '♥', '♦', '♠'];
const faces = ['Jack', 'Queen', 'King'];
module.exports = class DrawCardsCommand extends Command {
constructor(client) {
super(client, {
name: 'draw-cards',
aliases: ['draw-hand'],
group: 'random-res',
memberName: 'draw-cards',
description: 'Draws a random hand of playing cards.',
args: [
{
key: 'amount',
label: 'hand size',
prompt: 'How many cards do you want to draw?',
type: 'integer',
max: 10,
min: 1
},
{
key: 'jokers',
prompt: 'Do you want the deck to include jokers?',
type: 'boolean',
default: false
}
]
});
this.deck = null;
}
run(msg, { amount, jokers }) {
if (!this.deck) this.deck = this.generateDeck();
let cards = this.deck;
if (!jokers) cards = cards.filter(card => !card.includes('Joker'));
return msg.reply(shuffle(cards).slice(0, amount).join('\n'));
}
generateDeck() {
const deck = [];
for (const suit of suits) {
deck.push(`${suit} Ace`);
for (let i = 2; i <= 10; i++) deck.push(`${suit} ${i}`);
for (const face of faces) deck.push(`${suit} ${face}`);
}
deck.push('⭐ Joker');
deck.push('⭐ Joker');
return deck;
}
};
+25
View File
@@ -0,0 +1,25 @@
const Command = require('../../structures/Command');
const facts = require('../../assets/json/fact-core');
module.exports = class FactCoreCommand extends Command {
constructor(client) {
super(client, {
name: 'fact-core',
group: 'random-res',
memberName: 'fact-core',
description: 'Responds with a random Fact Core quote.',
credit: [
{
name: 'Valve',
url: 'https://www.valvesoftware.com/en/',
reasonURL: 'http://www.thinkwithportals.com/',
reason: 'Original "Portal 2" Game'
}
]
});
}
run(msg) {
return msg.say(facts[Math.floor(Math.random() * facts.length)]);
}
};
+63
View File
@@ -0,0 +1,63 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
module.exports = class FactCommand extends Command {
constructor(client) {
super(client, {
name: 'fact',
group: 'random-res',
memberName: 'fact',
description: 'Responds with a random fact.',
credit: [
{
name: 'Wikipedia',
url: 'https://www.wikipedia.org/',
reason: 'API',
reasonURL: 'https://en.wikipedia.org/w/api.php'
}
]
});
}
async run(msg) {
try {
const article = await this.randomWikipediaArticle();
const { body } = await request
.get('https://en.wikipedia.org/w/api.php')
.query({
action: 'query',
prop: 'extracts',
format: 'json',
titles: article,
exintro: '',
explaintext: '',
redirects: '',
formatversion: 2
});
let fact = body.query.pages[0].extract;
if (fact.length > 200) {
const facts = fact.split('.');
fact = `${facts[0]}.`;
if (fact.length < 200 && facts.length > 1) fact += `${facts[1]}.`;
}
return msg.say(fact);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
async randomWikipediaArticle() {
const { body } = await request
.get('https://en.wikipedia.org/w/api.php')
.query({
action: 'query',
list: 'random',
rnnamespace: 0,
rnlimit: 1,
format: 'json',
formatversion: 2
});
if (!body.query.random[0].title) return 'Facts are hard to find sometimes.';
return body.query.random[0].title;
}
};
+22
View File
@@ -0,0 +1,22 @@
const Command = require('../../structures/Command');
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-res',
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(', ')}
`);
}
};
+31
View File
@@ -0,0 +1,31 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
module.exports = class GithubZenCommand extends Command {
constructor(client) {
super(client, {
name: 'github-zen',
aliases: ['gh-zen'],
group: 'random-res',
memberName: 'github-zen',
description: 'Responds with a random GitHub design philosophy.',
credit: [
{
name: 'GitHub',
url: 'https://github.com/',
reason: 'Zen API',
reasonURL: 'https://developer.github.com/v3/'
}
]
});
}
async run(msg) {
try {
const { text } = await request.get('https://api.github.com/zen');
return msg.say(text);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+17
View File
@@ -0,0 +1,17 @@
const Command = require('../../structures/Command');
const jokes = require('../../assets/json/joke');
module.exports = class JokeCommand extends Command {
constructor(client) {
super(client, {
name: 'joke',
group: 'random-res',
memberName: 'joke',
description: 'Responds with a random joke.'
});
}
run(msg) {
return msg.say(jokes[Math.floor(Math.random() * jokes.length)]);
}
};
+55
View File
@@ -0,0 +1,55 @@
const Command = require('../../structures/Command');
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',
'fuck-marry-kill',
'fuck-kill-marry',
'kill-fuck-marry',
'kill-marry-fuck',
'marry-fuck-kill',
'marry-kill-fuck'
],
group: 'random-res',
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 kissFuck = msg.channel.nsfw ? 'fuck' : 'kiss';
const things = shuffle([first, second, third]);
return msg.say(`I'd ${kissFuck} ${things[0]}, marry ${things[1]}, and kill ${things[2]}.`);
}
};
+30
View File
@@ -0,0 +1,30 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
module.exports = class LightNovelTitleCommand extends Command {
constructor(client) {
super(client, {
name: 'light-novel-title',
aliases: ['ln-title'],
group: 'random-res',
memberName: 'light-novel-title',
description: 'Responds with a randomly generated Light Novel title.',
credit: [
{
name: 'LN title generator',
url: 'https://salty-salty-studios.com/shiz/ln.php',
reason: 'API'
}
]
});
}
async run(msg) {
try {
const { text } = await request.get('https://salty-salty-studios.com/shiz/ln.php');
return msg.say(text.match(/<h1>(.+)<\/h1>/i)[1]);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+38
View File
@@ -0,0 +1,38 @@
const Command = require('../../structures/Command');
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-res',
memberName: 'magic-conch',
description: 'Asks your question to the Magic Conch.',
credit: [
{
name: 'Nickelodeon',
url: 'https://www.nick.com/',
reason: 'Original "Spongebob Squarepants" Show',
reasonURL: 'https://www.nick.com/shows/spongebob-squarepants'
}
],
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)]} 🐚
`);
}
};
+32
View File
@@ -0,0 +1,32 @@
const Command = require('../../structures/Command');
const { list } = require('../../util/Util');
const names = require('../../assets/json/name');
const all = [].concat(names.male, names.female);
const genders = ['male', 'female', 'both'];
module.exports = class NameCommand extends Command {
constructor(client) {
super(client, {
name: 'name',
group: 'random-res',
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',
oneOf: genders,
parse: gender => gender.toLowerCase()
}
]
});
}
run(msg, { gender }) {
const lastName = names.last[Math.floor(Math.random() * names.last.length)];
if (gender === 'both') return msg.say(`${all[Math.floor(Math.random() * all.length)]} ${lastName}`);
return msg.say(`${names[gender][Math.floor(Math.random() * names[gender].length)]} ${lastName}`);
}
};
+37
View File
@@ -0,0 +1,37 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
module.exports = class NumberFactCommand extends Command {
constructor(client) {
super(client, {
name: 'number-fact',
group: 'random-res',
memberName: 'number-fact',
description: 'Responds with a random fact about a specific number.',
credit: [
{
name: 'Numbers API',
url: 'http://numbersapi.com/',
reason: 'Trivia API'
}
],
args: [
{
key: 'number',
prompt: 'What number do you want to get a fact for?',
type: 'integer'
}
]
});
}
async run(msg, { number }) {
try {
const { text } = await request.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!`);
}
}
};
+18
View File
@@ -0,0 +1,18 @@
const Command = require('../../structures/Command');
const genders = ['boy', 'girl'];
module.exports = class OffspringCommand extends Command {
constructor(client) {
super(client, {
name: 'offspring',
aliases: ['sex'],
group: 'random-res',
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)]}!`);
}
};
+29
View File
@@ -0,0 +1,29 @@
const Command = require('../../structures/Command');
const { stripIndents } = require('common-tags');
const opinions = ['👍', '👎'];
module.exports = class OpinionCommand extends Command {
constructor(client) {
super(client, {
name: 'opinion',
group: 'random-res',
memberName: 'opinion',
description: 'Determines the opinion on something.',
args: [
{
key: 'question',
prompt: 'What do you want to get an opinion on?',
type: 'string',
max: 1950
}
]
});
}
run(msg, { question }) {
return msg.say(stripIndents`
${question}
${opinions[Math.floor(Math.random() * opinions.length)]}
`);
}
};
+25
View File
@@ -0,0 +1,25 @@
const Command = require('../../structures/Command');
const quotes = require('../../assets/json/oracle-turret');
module.exports = class OracleTurretCommand extends Command {
constructor(client) {
super(client, {
name: 'oracle-turret',
group: 'random-res',
memberName: 'oracle-turret',
description: 'Responds with a random Oracle Turret quote.',
credit: [
{
name: 'Valve',
url: 'https://www.valvesoftware.com/en/',
reasonURL: 'http://www.thinkwithportals.com/',
reason: 'Original "Portal 2" Game'
}
]
});
}
run(msg) {
return msg.say(quotes[Math.floor(Math.random() * quotes.length)]);
}
};
+17
View File
@@ -0,0 +1,17 @@
const Command = require('../../structures/Command');
const puns = require('../../assets/json/pun');
module.exports = class PunCommand extends Command {
constructor(client) {
super(client, {
name: 'pun',
group: 'random-res',
memberName: 'pun',
description: 'Responds with a random pun.'
});
}
run(msg) {
return msg.say(puns[Math.floor(Math.random() * puns.length)]);
}
};
+18
View File
@@ -0,0 +1,18 @@
const Command = require('../../structures/Command');
const sides = [NaN, 0, null, undefined, ''];
module.exports = class QuantumCoinCommand extends Command {
constructor(client) {
super(client, {
name: 'quantum-coin',
aliases: ['q-coin'],
group: 'random-res',
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)]}.`);
}
};
+18
View File
@@ -0,0 +1,18 @@
const Command = require('../../structures/Command');
const quotes = require('../../assets/json/quote');
module.exports = class QuoteCommand extends Command {
constructor(client) {
super(client, {
name: 'quote',
group: 'random-res',
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}_`);
}
};
+21
View File
@@ -0,0 +1,21 @@
const Command = require('../../structures/Command');
module.exports = class RandomUserCommand extends Command {
constructor(client) {
super(client, {
name: 'random-user',
aliases: ['member-roulette', 'user-roulette', 'random-member', 'someone', '@someone'],
group: 'random-res',
memberName: 'random-user',
description: 'Randomly chooses a member of the server.'
});
}
run(msg) {
if (msg.channel.type === 'dm') {
const members = [this.client.user, msg.channel.recipient];
return msg.say(`I choose ${members[Math.floor(Math.random() * members.length)].username}!`);
}
return msg.say(`I choose ${msg.guild.members.cache.random().displayName}!`);
}
};
+25
View File
@@ -0,0 +1,25 @@
const Command = require('../../structures/Command');
module.exports = class RateCommand extends Command {
constructor(client) {
super(client, {
name: 'rate',
aliases: ['rate-waifu'],
group: 'random-res',
memberName: 'rate',
description: 'Rates something.',
args: [
{
key: 'thing',
prompt: 'What do you want to rate?',
type: 'string',
max: 1950
}
]
});
}
run(msg, { thing }) {
return msg.say(`I'd give ${thing} a ${Math.floor(Math.random() * 10) + 1}/10!`);
}
};
+26
View File
@@ -0,0 +1,26 @@
const Command = require('../../structures/Command');
const roasts = require('../../assets/json/roast');
module.exports = class RoastCommand extends Command {
constructor(client) {
super(client, {
name: 'roast',
aliases: ['insult'],
group: 'random-res',
memberName: 'roast',
description: 'Roasts a user.',
args: [
{
key: 'user',
prompt: 'What user do you want to roast?',
type: 'user',
default: msg => msg.author
}
]
});
}
run(msg, { user }) {
return msg.say(`${user.username}, ${roasts[Math.floor(Math.random() * roasts.length)]}`);
}
};
+27
View File
@@ -0,0 +1,27 @@
const Command = require('../../structures/Command');
const { formatNumber } = require('../../util/Util');
module.exports = class RollCommand extends Command {
constructor(client) {
super(client, {
name: 'roll',
aliases: ['dice'],
group: 'random-res',
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 ${formatNumber(Math.floor(Math.random() * value) + 1)}.`);
}
};
+18
View File
@@ -0,0 +1,18 @@
const Command = require('../../structures/Command');
const crypto = require('crypto');
module.exports = class SecurityKeyCommand extends Command {
constructor(client) {
super(client, {
name: 'security-key',
aliases: ['crypto', 'random-bytes'],
group: 'random-res',
memberName: 'security-key',
description: 'Responds with a random security key.'
});
}
run(msg) {
return msg.say(crypto.randomBytes(15).toString('hex'));
}
};
+25
View File
@@ -0,0 +1,25 @@
const SubredditCommand = require('../../structures/commands/Subreddit');
module.exports = class ShowerThoughtCommand extends SubredditCommand {
constructor(client) {
super(client, {
name: 'shower-thought',
aliases: ['shower-thoughts'],
group: 'random-res',
memberName: 'shower-thought',
description: 'Responds with a random shower thought, directly from r/Showerthoughts.',
subreddit: 'Showerthoughts',
credit: [
{
name: 'r/Showerthoughts',
url: 'https://www.reddit.com/r/showerthoughts',
reason: 'Shower Thought Data'
}
]
});
}
generateText(post) {
return post.title;
}
};
+32
View File
@@ -0,0 +1,32 @@
const Command = require('../../structures/Command');
const { start, end } = require('../../assets/json/smw-level');
module.exports = class SmwLevelCommand extends Command {
constructor(client) {
super(client, {
name: 'smw-level',
aliases: ['super-mario-world-level'],
group: 'random-res',
memberName: 'smw-level',
description: 'Responds with a random Super Mario World level name.',
credit: [
{
name: 'Nintendo',
url: 'https://www.nintendo.com/',
reason: 'Original "Super Mario World" Game',
reasonURL: 'https://www.nintendo.co.jp/n02/shvc/mw/index.html'
},
{
name: 'SMWiki',
url: 'http://www.smwiki.net/',
reason: 'Level Name Data',
reasonURL: 'http://old.smwiki.net/wiki/List_of_Super_Mario_World_levels'
}
]
});
}
run(msg) {
return msg.say(`${start[Math.floor(Math.random() * start.length)]} ${end[Math.floor(Math.random() * end.length)]}`);
}
};
+36
View File
@@ -0,0 +1,36 @@
const SubredditCommandBase = require('../../structures/commands/Subreddit');
const { MessageEmbed } = require('discord.js');
const { formatNumber } = require('../../util/Util');
module.exports = class SubredditCommand extends SubredditCommandBase {
constructor(client) {
super(client, {
name: 'subreddit',
aliases: ['r/', 'sub'],
group: 'random-res',
memberName: 'subreddit',
description: 'Responds with a random post from a subreddit.',
clientPermissions: ['EMBED_LINKS'],
getIcon: true,
args: [
{
key: 'subreddit',
prompt: 'What subreddit would you like to get a post from?',
type: 'string',
parse: subreddit => encodeURIComponent(subreddit)
}
]
});
}
generateText(post, subreddit, icon) {
return new MessageEmbed()
.setColor(0xFF4500)
.setAuthor(`r/${subreddit}`, icon, `https://www.reddit.com/r/${subreddit}/`)
.setTitle(post.title)
.setImage(post.post_hint === 'image' ? post.url : null)
.setURL(`https://www.reddit.com${post.permalink}`)
.setTimestamp(post.created_utc * 1000)
.setFooter(`${formatNumber(post.ups)}`);
}
};
+22
View File
@@ -0,0 +1,22 @@
const Command = require('../../structures/Command');
const { stripIndents } = require('common-tags');
module.exports = class SuggestCommandCommand extends Command {
constructor(client) {
super(client, {
name: 'suggest-command',
aliases: ['command-suggestion', 'command-suggest'],
group: 'random-res',
memberName: 'suggest-command',
description: 'Suggests a random command for you to try.'
});
}
run(msg) {
const command = this.client.registry.commands.random();
return msg.say(stripIndents`
Have you tried **${command.name}**?
_${command.description}_
`);
}
};
+62
View File
@@ -0,0 +1,62 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
const { stripIndents } = require('common-tags');
const { shorten } = require('../../util/Util');
module.exports = class SuperpowerCommand extends Command {
constructor(client) {
super(client, {
name: 'superpower',
group: 'random-res',
memberName: 'superpower',
description: 'Responds with a random superpower.',
credit: [
{
name: 'Superpower Wiki',
url: 'https://powerlisting.fandom.com/wiki/Superpower_Wiki',
reason: 'Superpower Data'
},
{
name: 'FANDOM',
url: 'https://www.fandom.com/',
reason: 'API',
reasonURL: 'https://powerlisting.fandom.com/api.php'
}
]
});
}
async run(msg) {
try {
const id = await this.random();
const article = await this.fetchSuperpower(id);
return msg.reply(stripIndents`
Your superpower is... **${article.title}**!
_${shorten(article.content.map(section => section.text).join('\n\n'), 1950)}_
`);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
async random() {
const { body } = await request
.get('http://powerlisting.wikia.com/api.php')
.query({
action: 'query',
list: 'random',
rnnamespace: 0,
rnlimit: 1,
format: 'json',
formatversion: 2
});
return body.query.random[0].id;
}
async fetchSuperpower(id) {
const { body } = await request
.get('http://powerlisting.wikia.com/api/v1/Articles/AsSimpleJson/')
.query({ id });
return body.sections[0];
}
};
+32
View File
@@ -0,0 +1,32 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
module.exports = class ThisForThatCommand extends Command {
constructor(client) {
super(client, {
name: 'this-for-that',
aliases: ['its-this-for-that'],
group: 'random-res',
memberName: 'this-for-that',
description: 'So, basically, it\'s like a bot command for this dumb meme.',
credit: [
{
name: 'Wait, what does your startup do?',
url: 'http://itsthisforthat.com/',
reason: 'API',
reasonURL: 'http://itsthisforthat.com/api.php'
}
]
});
}
async run(msg) {
try {
const { text } = await request.get('http://itsthisforthat.com/api.php?json');
const body = JSON.parse(text);
return msg.say(`So, basically, it's like a ${body.this} for ${body.that}.`);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+33
View File
@@ -0,0 +1,33 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const request = require('node-superfetch');
const { shorten } = require('../../util/Util');
module.exports = class WaifuCommand extends Command {
constructor(client) {
super(client, {
name: 'waifu',
aliases: ['this-waifu-does-not-exist'],
group: 'random-res',
memberName: 'waifu',
description: 'Responds with a randomly generated waifu and backstory.',
clientPermissions: ['EMBED_LINKS'],
credit: [
{
name: 'This Waifu Does Not Exist',
url: 'https://www.thiswaifudoesnotexist.net/',
reason: 'API'
}
]
});
}
async run(msg) {
const num = Math.floor(Math.random() * 100000);
const { text } = await request.get(`https://www.thiswaifudoesnotexist.net/snippet-${num}.txt`);
const embed = new MessageEmbed()
.setDescription(shorten(text, 1000))
.setThumbnail(`https://www.thiswaifudoesnotexist.net/example-${num}.jpg`);
return msg.embed(embed);
}
};
+18
View File
@@ -0,0 +1,18 @@
const Command = require('../../structures/Command');
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', 'wyr'],
group: 'random-res',
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)]);
}
};