Fix Everything

This commit is contained in:
Daniel Odendahl Jr
2017-06-01 18:31:20 +00:00
parent 66706d9c7b
commit 4e1f83a30f
85 changed files with 721 additions and 851 deletions
+2 -5
View File
@@ -15,11 +15,8 @@ module.exports = class EasterEggCommand extends Command {
prompt: 'What easter egg do you want to view?',
type: 'string',
validate: (tag) => {
if (eastereggs[tag.toLowerCase()]) {
return true;
} else {
return 'Nope, that\'s not a valid easter egg. Try again!';
}
if (eastereggs[tag.toLowerCase()]) return true;
else return 'Nope, that\'s not a valid easter egg. Try again!';
},
parse: (tag) => tag.toLowerCase()
}
+2 -5
View File
@@ -18,11 +18,8 @@ module.exports = class HoroscopeCommand extends Command {
prompt: 'Which sign would you like to get the horoscope for?',
type: 'string',
validate: (sign) => {
if (signs.includes(sign.toLowerCase())) {
return true;
} else {
return 'Invalid sign. Use `help horoscope` for a list of signs.';
}
if (signs.includes(sign.toLowerCase())) return true;
else return 'Invalid sign. Use `help horoscope` for a list of signs.';
},
parse: (sign) => sign.toLowerCase()
}
+2 -5
View File
@@ -16,11 +16,8 @@ module.exports = class MemeCommand extends Command {
prompt: 'What meme type do you want to use?',
type: 'string',
validate: (type) => {
if (codes.includes(type.toLowerCase())) {
return true;
} else {
return 'Invalid meme type. Use `help meme` to view a list of meme types.';
}
if (codes.includes(type.toLowerCase())) return true;
else return 'Invalid meme type. Use `help meme` to view a list of meme types.';
},
parse: (type) => type.toLowerCase()
},
+8 -16
View File
@@ -23,11 +23,8 @@ module.exports = class SoundboardCommand extends Command {
prompt: 'What sound would you like to play?',
type: 'string',
validate: (sound) => {
if (names.includes(sound.toLowerCase())) {
return true;
} else {
return 'Invalid Sound. Use `help soundboard` for a list of sounds.';
}
if (names.includes(sound.toLowerCase())) return true;
else return 'Invalid Sound. Use `help soundboard` for a list of sounds.';
},
parse: (sound) => sound.toLowerCase()
}
@@ -37,17 +34,12 @@ module.exports = class SoundboardCommand extends Command {
async run(msg, args) {
const voiceChannel = msg.member.voiceChannel;
if (!voiceChannel) {
return msg.say('Please enter a Voice Channel first.');
} else if (!voiceChannel.permissionsFor(this.client.user).has('CONNECT')) {
return msg.say('This Command requires the `CONNECT` Permission.');
} else if (!voiceChannel.permissionsFor(this.client.user).has('SPEAK')) {
return msg.say('This Command requires the `SPEAK` Permission.');
} else if (!voiceChannel.joinable) {
return msg.say('This Voice Channel is not joinable.');
} else if (this.client.voiceConnections.get(voiceChannel.guild.id)) {
return msg.say('I am already playing a sound.');
if (!voiceChannel) return msg.say('Please enter a Voice Channel first.');
if (!voiceChannel.permissionsFor(this.client.user).has(['CONNECT', 'SPEAK'])) {
return msg.say('Missing the `CONNECT` or `SPEAK` Permission for the Voice Channel.');
}
if (!voiceChannel.joinable) return msg.say('This Voice Channel is not joinable.');
if (this.client.voiceConnections.get(voiceChannel.guild.id)) return msg.say('I am already playing a sound.');
const { sound } = args;
const connection = await voiceChannel.join();
msg.react('🔊');
@@ -55,7 +47,7 @@ module.exports = class SoundboardCommand extends Command {
dispatcher.on('end', () => {
voiceChannel.leave();
msg.react('✅');
return null;
});
return null;
}
};
+2 -5
View File
@@ -25,11 +25,8 @@ module.exports = class StarCommand extends Command {
async run(msg, args, reaction) {
const { id } = args;
const channel = msg.guild.channels.get(msg.guild.settings.get('starboard'));
if (!channel || this.starred.includes(id)) {
return null;
} else if (!channel.permissionsFor(this.client.user).has('SEND_MESSAGES')) {
return msg.say('I do not have Permission to send the message.');
}
if (!channel || this.starred.includes(id)) return null;
if (!channel.permissionsFor(this.client.user).has('SEND_MESSAGES')) return null;
const message = await msg.channel.fetchMessage(id);
if (!reaction && msg.author.id === message.author.id) {
return msg.reply('You cannot star your own messages, baka.');
+6 -16
View File
@@ -1,5 +1,4 @@
const Command = require('../../structures/Command');
const { FriendlyError } = require('discord.js-commando');
const { stripIndents } = require('common-tags');
const snekfetch = require('snekfetch');
@@ -16,11 +15,8 @@ module.exports = class StrawpollCommand extends Command {
prompt: 'What would you like the title of the Strawpoll to be?',
type: 'string',
validate: (title) => {
if (title.length < 200) {
return true;
} else {
return 'Invalid Title. Title must be under 200 characters.';
}
if (title.length < 200) return true;
else return 'Title must be under 200 characters.';
}
},
{
@@ -29,11 +25,8 @@ module.exports = class StrawpollCommand extends Command {
type: 'string',
infinite: true,
validate: (choice) => {
if (choice.length < 160) {
return true;
} else {
return 'Invalid Choice. Choices must be under 140 characters each.';
}
if (choice.length < 160) return true;
else return 'Choices must be under 140 characters each.';
}
}
]
@@ -42,11 +35,8 @@ module.exports = class StrawpollCommand extends Command {
async run(msg, args) {
const { title, options } = args;
if (options.length < 2) {
throw new FriendlyError('You provided less than two choices.');
} else if (options.length > 31) {
throw new FriendlyError('You provided more than thirty choices.');
}
if (options.length < 2) return msg.say('You provided less than two choices.');
if (options.length > 31) return msg.say('You provided more than thirty choices.');
const { body } = await snekfetch
.post('https://strawpoll.me/api/v2/polls')
.send({ title, options });