Why does this even work

This commit is contained in:
Daniel Odendahl Jr
2018-06-10 01:26:20 +00:00
parent c8d78901c7
commit 2dd81a23ea
9 changed files with 22 additions and 19 deletions
+2 -7
View File
@@ -48,13 +48,8 @@ module.exports = class GoogleFeudCommand extends Command {
break;
}
const choice = msgs.first().content.toLowerCase();
if (suggestions.includes(choice)) {
await msg.say('Nice job!');
display[suggestions.indexOf(choice)] = choice;
} else {
--tries;
if (tries) await msg.say(`Nope! ${tries} tries remaining!`);
}
if (suggestions.includes(choice)) display[suggestions.indexOf(choice)] = choice;
else --tries;
}
this.playing.delete(msg.channel.id);
if (!display.includes('???')) return msg.say('You win! Nice job, master of Google!');
+2 -1
View File
@@ -24,9 +24,10 @@ module.exports = class KitsuAnimeCommand extends Command {
async run(msg, { query }) {
try {
const { body } = await request
const { text } = await request
.get('https://kitsu.io/api/edge/anime')
.query({ 'filter[text]': query });
const body = JSON.parse(text);
if (!body.data.length) return msg.say('Could not find any results.');
const data = body.data[0].attributes;
const embed = new MessageEmbed()
+2 -1
View File
@@ -24,9 +24,10 @@ module.exports = class KitsuMangaCommand extends Command {
async run(msg, { query }) {
try {
const { body } = await request
const { text } = await request
.get('https://kitsu.io/api/edge/manga')
.query({ 'filter[text]': query });
const body = JSON.parse(text);
if (!body.data.length) return msg.say('Could not find any results.');
const data = body.data[0].attributes;
const embed = new MessageEmbed()
@@ -8,7 +8,7 @@ module.exports = class LeagueOfLegendsChampionCommand extends Command {
constructor(client) {
super(client, {
name: 'league-of-legends-champion',
aliases: ['lol-champion', 'league-of-legends-champ', 'lol-champ'],
aliases: ['lol-champion', 'league-of-legends-champ', 'lol-champ', 'league-champ'],
group: 'search',
memberName: 'league-of-legends-champion',
description: 'Responds with information on a League of Legends champion.',
+1 -1
View File
@@ -24,7 +24,7 @@ module.exports = class NeopetsItemCommand extends Command {
async run(msg, { item }) {
try {
const data = await this.fetchItem(item);
if (!data) return msg.say('Could not find any results');
if (!data) return msg.say('Could not find any results.');
const embed = new MessageEmbed()
.setColor(0xFFCE31)
.setAuthor('Neopets', 'https://i.imgur.com/BP8qxJH.png', 'http://www.neopets.com/')
+1 -1
View File
@@ -7,7 +7,7 @@ module.exports = class RottenTomatoesCommand extends Command {
constructor(client) {
super(client, {
name: 'rotten-tomatoes',
aliases: ['tomato-meter'],
aliases: ['tomato-meter', 'r-tomatoes'],
group: 'search',
memberName: 'rotten-tomatoes',
description: 'Searches Rotten Tomatoes for your query.',
+1 -1
View File
@@ -5,7 +5,7 @@ module.exports = class RuleOfTheInternetCommand extends Command {
constructor(client) {
super(client, {
name: 'rule-of-the-internet',
aliases: ['rules-of-the-internet', 'internet-rule', 'rule'],
aliases: ['rules-of-the-internet', 'internet-rule', 'rule', 'rules'],
group: 'search',
memberName: 'rule-of-the-internet',
description: 'Responds with a rule of the internet.',
+1 -1
View File
@@ -7,7 +7,7 @@ module.exports = class YoutubeCommand extends Command {
constructor(client) {
super(client, {
name: 'youtube',
aliases: ['youtube-video'],
aliases: ['youtube-video', 'y-tube', 'u-tube'],
group: 'search',
memberName: 'youtube',
description: 'Searches YouTube for your query.',
+11 -5
View File
@@ -35,11 +35,17 @@ module.exports = class DECTalkCommand extends Command {
if (this.client.voiceConnections.has(channel.guild.id)) return msg.say('I am already playing a sound.');
try {
const connection = await channel.join();
const { headers } = await request
.get('http://tts.cyzon.us/tts')
.query({ text })
.redirects(0);
const dispatcher = connection.play(`http://tts.cyzon.us${headers.location}`);
let url = 'http://tts.cyzon.us';
try {
await request
.get('http://tts.cyzon.us/tts')
.query({ text })
.redirects(0);
} catch (err) {
if (err.headers.location) url += err.headers.location;
else throw err;
}
const dispatcher = connection.play(url);
dispatcher.once('finish', () => channel.leave());
dispatcher.once('error', () => channel.leave());
return null;