This commit is contained in:
Daniel Odendahl Jr
2017-09-26 14:09:05 +00:00
parent 55e615b5b4
commit da63a908e7
14 changed files with 228 additions and 103 deletions
+2 -1
View File
@@ -41,11 +41,12 @@ module.exports = class TypingGameCommand extends Command {
**You have ${time / 1000} seconds to type this sentence.**
${sentence}
`);
const now = Date.now();
const msgs = await msg.channel.awaitMessages(res => res.author.id === msg.author.id, {
max: 1,
time
});
if (!msgs.size || msgs.first().content !== sentence) return msg.say('Sorry! You lose!');
return msg.say('Nice job! 10/10! You deserve some cake!');
return msg.say(`Nice job! 10/10! You deserve some cake! (Took ${(Date.now() - now) / 1000} seconds)`);
}
};
+3 -10
View File
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
const snekfetch = require('snekfetch');
const facts = require('../../assets/json/cat-fact');
module.exports = class CatFactCommand extends Command {
constructor(client) {
@@ -12,14 +12,7 @@ module.exports = class CatFactCommand extends Command {
});
}
async run(msg) {
try {
const { body } = await snekfetch
.get('https://catfact.ninja/fact')
.query({ max_length: 2000 });
return msg.say(body.fact);
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
run(msg) {
return msg.say(facts[Math.floor(Math.random() * facts.length)]);
}
};
+3 -9
View File
@@ -1,5 +1,5 @@
const Command = require('../../structures/Command');
const snekfetch = require('snekfetch');
const facts = require('../../assets/json/dog-fact');
module.exports = class DogFactCommand extends Command {
constructor(client) {
@@ -12,13 +12,7 @@ module.exports = class DogFactCommand extends Command {
});
}
async run(msg) {
try {
const { body } = await snekfetch
.get('https://dog-api.kinduff.com/api/facts');
return msg.say(body.facts[0]);
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
run(msg) {
return msg.say(facts[Math.floor(Math.random() * facts.length)]);
}
};
+1
View File
@@ -7,6 +7,7 @@ module.exports = class NameCommand extends Command {
constructor(client) {
super(client, {
name: 'name',
aliases: ['random-person'],
group: 'random-res',
memberName: 'name',
description: 'Responds with a random name, with the gender of your choice.',
-68
View File
@@ -1,68 +0,0 @@
const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const snekfetch = require('snekfetch');
const { stripIndents } = require('common-tags');
const { list } = require('../../structures/Util');
const genders = ['male', 'female', 'both'];
module.exports = class RandomPersonCommand extends Command {
constructor(client) {
super(client, {
name: 'random-person',
group: 'random-res',
memberName: 'random-person',
description: 'Responds with a randomly generated person.',
clientPermissions: ['EMBED_LINKS'],
args: [
{
key: 'gender',
prompt: `What gender do you want to generate a name for? Either ${list(genders, 'or')}.`,
type: 'string',
default: 'both'
}
]
});
}
async run(msg, { gender }) {
try {
const { body } = await snekfetch
.get('https://randomuser.me/api/')
.query({
gender,
nat: 'us,gb,au',
noinfo: ''
});
const data = body.results[0];
const embed = new MessageEmbed()
.setColor(0x9797FF)
.setThumbnail(data.picture.large)
.addField(' First Name',
data.name.first.toUpperCase(), true)
.addField(' Last Name',
data.name.last.toUpperCase(), true)
.addField(' Title',
`${data.name.title.toUpperCase()}.`, true)
.addField(' Gender',
data.gender.toUpperCase(), true)
.addField(' Username',
data.login.username, true)
.addField(' Password',
data.login.password, true)
.addField(' Phone',
data.phone, true)
.addField(' Cell',
data.cell, true)
.addField(' Birthday',
new Date(data.dob).toDateString(), true)
.addField(' Address',
stripIndents`
${data.location.street.toUpperCase()}
${data.location.city.toUpperCase()}, ${data.location.state.toUpperCase()} ${data.location.postcode}
`);
return msg.embed(embed);
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
@@ -1,11 +1,11 @@
const Command = require('../../structures/Command');
const snekfetch = require('snekfetch');
module.exports = class GenderCommand extends Command {
module.exports = class GenderGuessCommand extends Command {
constructor(client) {
super(client, {
name: 'gender',
aliases: ['gender-guess', 'guess-gender'],
name: 'gender-guess',
aliases: ['gender', 'guess-gender'],
group: 'random',
memberName: 'gender',
description: 'Determines the gender of name.',
+1 -1
View File
@@ -7,7 +7,7 @@ module.exports = class DefineCommand extends Command {
constructor(client) {
super(client, {
name: 'define',
aliases: ['dictionary', 'wordnik'],
aliases: ['dictionary', 'wordnik', 'define-wordnik'],
group: 'search',
memberName: 'define',
description: 'Defines a word.',
@@ -1,11 +1,11 @@
const Command = require('../../structures/Command');
const { stripIndents } = require('common-tags');
module.exports = class DiscrimCommand extends Command {
module.exports = class DiscriminatorCommand extends Command {
constructor(client) {
super(client, {
name: 'discrim',
aliases: ['discriminator', 'search-discrim', 'search-discriminator'],
name: 'discriminator',
aliases: ['discrim', 'search-discrim', 'search-discriminator'],
group: 'search',
memberName: 'discrim',
description: 'Searches for other users with a certain discriminator.',
@@ -2,11 +2,11 @@ const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const snekfetch = require('snekfetch');
module.exports = class JapaneseDictionaryCommand extends Command {
module.exports = class JapaneseDefineCommand extends Command {
constructor(client) {
super(client, {
name: 'japanese-dictionary',
aliases: ['japanese-define', 'define-japanese', 'define-jpn', 'jpn-define', 'jisho'],
name: 'japanese-define',
aliases: ['japanese-dictionary', 'define-japanese', 'define-jpn', 'jpn-define', 'jisho'],
group: 'search',
memberName: 'japanese-dictionary',
description: 'Defines a word, but with Japanese.',
+1 -1
View File
@@ -6,7 +6,7 @@ module.exports = class MapCommand extends Command {
constructor(client) {
super(client, {
name: 'map',
aliases: ['google-maps'],
aliases: ['google-maps', 'google-map'],
group: 'search',
memberName: 'map',
description: 'Responds with a map based upon your query.',
@@ -3,11 +3,11 @@ const { MessageEmbed } = require('discord.js');
const snekfetch = require('snekfetch');
const { shorten } = require('../../structures/Util');
module.exports = class GhibliCommand extends Command {
module.exports = class StudioGhibliCommand extends Command {
constructor(client) {
super(client, {
name: 'ghibli',
aliases: ['studio-ghibli', 'ghibli-film', 'studio-ghibli-film'],
name: 'studio-ghibli',
aliases: ['ghibli', 'ghibli-film', 'studio-ghibli-film'],
group: 'search',
memberName: 'ghibli',
description: 'Searches Studio Ghibli films for your query.',