mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-19 13:56:43 +02:00
Make Code Prettier
This commit is contained in:
@@ -17,7 +17,7 @@ module.exports = class EasterEggCommand extends Command {
|
||||
prompt: 'What easter egg do you want to view?',
|
||||
type: 'string',
|
||||
validate: tag => {
|
||||
if (eastereggs[tag.toLowerCase()])
|
||||
if(eastereggs[tag.toLowerCase()])
|
||||
return true;
|
||||
return 'Nope, that\'s not a valid easter egg. Try again!';
|
||||
},
|
||||
|
||||
@@ -24,7 +24,7 @@ module.exports = class MathCommand extends Command {
|
||||
const solved = math.eval(expression);
|
||||
return msg.say(solved)
|
||||
.catch(() => msg.say('Invalid statement.'));
|
||||
} catch (err) {
|
||||
} catch(err) {
|
||||
return msg.say('Invalid statement.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,12 +13,12 @@ module.exports = class NitroCommand extends Command {
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
if(msg.channel.type !== 'dm')
|
||||
if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const embed = new RichEmbed()
|
||||
.setAuthor('Discord Nitro')
|
||||
.setThumbnail('https://pbs.twimg.com/profile_images/814184180649197568/y2eZcVMq.jpg')
|
||||
.setThumbnail('https://i.imgur.com/wzhMMnl.jpg')
|
||||
.setColor(0x748BD9)
|
||||
.setURL('https://discordapp.com/nitro')
|
||||
.setDescription(stripIndents`
|
||||
|
||||
@@ -11,10 +11,10 @@ module.exports = class SpamCommand extends Command {
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||
if(msg.channel.type !== 'dm')
|
||||
if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||
return msg.channel.send({files: ['https://i.imgur.com/2JFu5xE.jpg']})
|
||||
return msg.channel.send({ files: ['https://i.imgur.com/2JFu5xE.jpg'] })
|
||||
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ 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)
|
||||
if(title.length < 200)
|
||||
return true;
|
||||
return `Please keep your title under 200 characters, you have ${title.length}.`;
|
||||
}
|
||||
@@ -26,7 +26,7 @@ module.exports = class StrawpollCommand extends Command {
|
||||
type: 'string',
|
||||
infinite: true,
|
||||
validate: choice => {
|
||||
if (choice.length < 160)
|
||||
if(choice.length < 160)
|
||||
return true;
|
||||
return `Please keep your options under 160 characters each, you have ${choice.length}.`;
|
||||
}
|
||||
@@ -37,22 +37,19 @@ module.exports = class StrawpollCommand extends Command {
|
||||
|
||||
async run(msg, args) {
|
||||
const { title, options } = args;
|
||||
if (options.length < 2)
|
||||
if(options.length < 2)
|
||||
return msg.say('You provided less than two choices.');
|
||||
if (options.length > 31)
|
||||
if(options.length > 31)
|
||||
return msg.say('You provided more than thirty choices.');
|
||||
try {
|
||||
const { body } = await request
|
||||
.post('https://strawpoll.me/api/v2/polls')
|
||||
.send({
|
||||
title,
|
||||
options
|
||||
});
|
||||
.send({ title, options });
|
||||
return msg.say(stripIndents`
|
||||
${body.title}
|
||||
http://strawpoll.me/${body.id}
|
||||
`);
|
||||
} catch (err) {
|
||||
} catch(err) {
|
||||
return msg.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ module.exports = class TodayCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
if(msg.channel.type !== 'dm')
|
||||
if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
try {
|
||||
const { text } = await request
|
||||
@@ -30,7 +30,7 @@ module.exports = class TodayCommand extends Command {
|
||||
.setTimestamp()
|
||||
.setDescription(`${events[random].year}: ${events[random].text}`);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
} catch(err) {
|
||||
return msg.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@ module.exports = class WouldYouRatherCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg) {
|
||||
if (msg.channel.type !== 'dm')
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
if(msg.channel.type !== 'dm')
|
||||
if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
try {
|
||||
const { body } = await request
|
||||
@@ -28,7 +28,7 @@ module.exports = class WouldYouRatherCommand extends Command {
|
||||
.setColor(0x9797FF)
|
||||
.setDescription(`${body.choicea} OR ${body.choiceb}?`);
|
||||
return msg.embed(embed);
|
||||
} catch (err) {
|
||||
} catch(err) {
|
||||
return msg.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user