mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 15:07:42 +02:00
Space after conditionals
This commit is contained in:
@@ -5,9 +5,7 @@ module.exports = class YearsCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: '3000years',
|
||||
aliases: [
|
||||
'az'
|
||||
],
|
||||
aliases: ['az'],
|
||||
group: 'avataredit',
|
||||
memberName: '3000years',
|
||||
description: 'It\'s been 3000 years...',
|
||||
@@ -22,12 +20,12 @@ module.exports = class YearsCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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.');
|
||||
const { user } = args;
|
||||
const avatarURL = user.avatarURL('png', 2048);
|
||||
if(!avatarURL) return msg.say('This user has no avatar.');
|
||||
if (!avatarURL) return msg.say('This user has no avatar.');
|
||||
let images = [];
|
||||
images.push(Jimp.read(avatarURL));
|
||||
images.push(Jimp.read('https://i.imgur.com/eScwGFS.png'));
|
||||
@@ -35,9 +33,9 @@ module.exports = class YearsCommand extends Command {
|
||||
avatar.resize(200, 200);
|
||||
az.composite(avatar, 461, 127);
|
||||
az.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if(err) return msg.say(`An Error Occurred: ${err}`);
|
||||
if (err) return msg.say(`An Error Occurred: ${err}`);
|
||||
return msg.channel.send({ files: [{ attachment: buff, name: 'az.png' }] })
|
||||
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||
.catch (err => msg.say(`An Error Occurred: ${err}`));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,9 +5,7 @@ module.exports = class BeautifulCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'beautiful',
|
||||
aliases: [
|
||||
'grunkle-stan'
|
||||
],
|
||||
aliases: ['grunkle-stan'],
|
||||
group: 'avataredit',
|
||||
memberName: 'beautiful',
|
||||
description: 'Oh, this? This is beautiful.',
|
||||
@@ -22,12 +20,12 @@ module.exports = class BeautifulCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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.');
|
||||
const { user } = args;
|
||||
const avatarURL = user.avatarURL('png', 2048);
|
||||
if(!avatarURL) return msg.say('This user has no avatar.');
|
||||
if (!avatarURL) return msg.say('This user has no avatar.');
|
||||
let images = [];
|
||||
images.push(Jimp.read(avatarURL));
|
||||
images.push(Jimp.read('https://i.imgur.com/71qLwPf.png'));
|
||||
@@ -36,9 +34,9 @@ module.exports = class BeautifulCommand extends Command {
|
||||
grunkle.composite(avatar, 341, 35);
|
||||
grunkle.composite(avatar, 342, 301);
|
||||
grunkle.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if(err) return msg.say(`An Error Occurred: ${err}`);
|
||||
if (err) return msg.say(`An Error Occurred: ${err}`);
|
||||
return msg.channel.send({ files: [{ attachment: buff, name: 'beautiful.png' }] })
|
||||
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||
.catch (err => msg.say(`An Error Occurred: ${err}`));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,9 +5,7 @@ module.exports = class BobRossCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'bob-ross',
|
||||
aliases: [
|
||||
'ross'
|
||||
],
|
||||
aliases: ['ross'],
|
||||
group: 'avataredit',
|
||||
memberName: 'bob-ross',
|
||||
description: 'Make Bob Ross draw an avatar.',
|
||||
@@ -22,12 +20,12 @@ module.exports = class BobRossCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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.');
|
||||
const { user } = args;
|
||||
const avatarURL = user.avatarURL('png', 2048);
|
||||
if(!avatarURL) return msg.say('This user has no avatar.');
|
||||
if (!avatarURL) return msg.say('This user has no avatar.');
|
||||
const blank = new Jimp(600, 775, 0xFFFFFFFF);
|
||||
let images = [];
|
||||
images.push(Jimp.read(avatarURL));
|
||||
@@ -38,9 +36,9 @@ module.exports = class BobRossCommand extends Command {
|
||||
blank.composite(avatar, 44, 85);
|
||||
blank.composite(bob, 0, 0);
|
||||
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if(err) return msg.say(`An Error Occurred: ${err}`);
|
||||
if (err) return msg.say(`An Error Occurred: ${err}`);
|
||||
return msg.channel.send({ files: [{ attachment: buff, name: 'bobross.png' }] })
|
||||
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||
.catch (err => msg.say(`An Error Occurred: ${err}`));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,9 +5,7 @@ module.exports = class GreyscaleCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'greyscale',
|
||||
aliases: [
|
||||
'grayscale'
|
||||
],
|
||||
aliases: ['grayscale'],
|
||||
group: 'avataredit',
|
||||
memberName: 'greyscale',
|
||||
description: 'Greyscale a user\'s avatar colors.',
|
||||
@@ -22,18 +20,18 @@ module.exports = class GreyscaleCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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.');
|
||||
const { user } = args;
|
||||
const avatarURL = user.avatarURL('png', 2048);
|
||||
if(!avatarURL) return msg.say('This user has no avatar.');
|
||||
if (!avatarURL) return msg.say('This user has no avatar.');
|
||||
const avatar = await Jimp.read(avatarURL);
|
||||
avatar.greyscale();
|
||||
avatar.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if(err) return msg.say(`An Error Occurred: ${err}`);
|
||||
if (err) return msg.say(`An Error Occurred: ${err}`);
|
||||
return msg.channel.send({ files: [{ attachment: buff, name: 'greyscale.png' }] })
|
||||
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||
.catch (err => msg.say(`An Error Occurred: ${err}`));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -19,18 +19,18 @@ module.exports = class InvertCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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.');
|
||||
const { user } = args;
|
||||
const avatarURL = user.avatarURL('png', 2048);
|
||||
if(!avatarURL) return msg.say('This user has no avatar.');
|
||||
if (!avatarURL) return msg.say('This user has no avatar.');
|
||||
const avatar = await Jimp.read(avatarURL);
|
||||
avatar.invert();
|
||||
avatar.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if(err) return msg.say(`An Error Occurred: ${err}`);
|
||||
if (err) return msg.say(`An Error Occurred: ${err}`);
|
||||
return msg.channel.send({ files: [{ attachment: buff, name: 'invert.png' }] })
|
||||
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||
.catch (err => msg.say(`An Error Occurred: ${err}`));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,10 +5,7 @@ module.exports = class RIPCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'rip',
|
||||
aliases: [
|
||||
'grave',
|
||||
'grave-stone'
|
||||
],
|
||||
aliases: ['grave', 'grave-stone'],
|
||||
group: 'avataredit',
|
||||
memberName: 'rip',
|
||||
description: 'Puts a user\'s avatar over a gravestone.',
|
||||
@@ -23,12 +20,12 @@ module.exports = class RIPCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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.');
|
||||
const { user } = args;
|
||||
const avatarURL = user.avatarURL('png', 2048);
|
||||
if(!avatarURL) return msg.say('This user has no avatar.');
|
||||
if (!avatarURL) return msg.say('This user has no avatar.');
|
||||
let images = [];
|
||||
images.push(Jimp.read(avatarURL));
|
||||
images.push(Jimp.read('https://i.imgur.com/KriteWm.jpg'));
|
||||
@@ -37,9 +34,9 @@ module.exports = class RIPCommand extends Command {
|
||||
avatar.resize(200, 200);
|
||||
grave.composite(avatar, 158, 51);
|
||||
grave.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if(err) return msg.say(`An Error Occurred: ${err}`);
|
||||
if (err) return msg.say(`An Error Occurred: ${err}`);
|
||||
return msg.channel.send({ files: [{ attachment: buff, name: 'rip.png' }] })
|
||||
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||
.catch (err => msg.say(`An Error Occurred: ${err}`));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,9 +5,7 @@ module.exports = class SteamCardCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'steam-card',
|
||||
aliases: [
|
||||
'card'
|
||||
],
|
||||
aliases: ['card'],
|
||||
group: 'avataredit',
|
||||
memberName: 'steam-card',
|
||||
description: 'Put an avatar on a Steam Card.',
|
||||
@@ -22,13 +20,13 @@ module.exports = class SteamCardCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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.');
|
||||
const { user } = args;
|
||||
const username = msg.guild ? msg.guild.member(user).displayName : user.username;
|
||||
const avatarURL = user.avatarURL('png', 2048);
|
||||
if(!avatarURL) return msg.say('This user has no avatar.');
|
||||
if (!avatarURL) return msg.say('This user has no avatar.');
|
||||
const blank = new Jimp(494, 568, 0xFFFFFFFF);
|
||||
let images = [];
|
||||
images.push(Jimp.read(avatarURL));
|
||||
@@ -40,9 +38,9 @@ module.exports = class SteamCardCommand extends Command {
|
||||
blank.composite(card, 0, 0);
|
||||
blank.print(font, 38, 20, username);
|
||||
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if(err) return msg.say(`An Error Occurred: ${err}`);
|
||||
if (err) return msg.say(`An Error Occurred: ${err}`);
|
||||
return msg.channel.send({ files: [{ attachment: buff, name: 'steamcard.png' }] })
|
||||
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||
.catch (err => msg.say(`An Error Occurred: ${err}`));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -19,12 +19,12 @@ module.exports = class TriggeredCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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.');
|
||||
const { user } = args;
|
||||
const avatarURL = user.avatarURL('png', 2048);
|
||||
if(!avatarURL) return msg.say('This user has no avatar.');
|
||||
if (!avatarURL) return msg.say('This user has no avatar.');
|
||||
const blank = new Jimp(320, 371, 0xFFFFFFFF);
|
||||
let images = [];
|
||||
images.push(Jimp.read(avatarURL));
|
||||
@@ -34,9 +34,9 @@ module.exports = class TriggeredCommand extends Command {
|
||||
blank.composite(avatar, 0, 0);
|
||||
blank.composite(triggered, 0, 0);
|
||||
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if(err) return msg.say(`An Error Occurred: ${err}`);
|
||||
if (err) return msg.say(`An Error Occurred: ${err}`);
|
||||
return msg.channel.send({ files: [{ attachment: buff, name: 'triggered.png' }] })
|
||||
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||
.catch (err => msg.say(`An Error Occurred: ${err}`));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -19,12 +19,12 @@ module.exports = class WantedCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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.');
|
||||
const { user } = args;
|
||||
const avatarURL = user.avatarURL('png', 2048);
|
||||
if(!avatarURL) return msg.say('This user has no avatar.');
|
||||
if (!avatarURL) return msg.say('This user has no avatar.');
|
||||
let images = [];
|
||||
images.push(Jimp.read(avatarURL));
|
||||
images.push(Jimp.read('https://i.imgur.com/ca09TG5.jpg'));
|
||||
@@ -32,9 +32,9 @@ module.exports = class WantedCommand extends Command {
|
||||
avatar.resize(500, 500);
|
||||
wanted.composite(avatar, 189, 438);
|
||||
wanted.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if(err) return msg.say(`An Error Occurred: ${err}`);
|
||||
if (err) return msg.say(`An Error Occurred: ${err}`);
|
||||
return msg.channel.send({ files: [{ attachment: buff, name: 'wanted.png' }] })
|
||||
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||
.catch (err => msg.say(`An Error Occurred: ${err}`));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -12,7 +12,7 @@ module.exports = class LotteryCommand extends Command {
|
||||
|
||||
run(msg) {
|
||||
const lottery = Math.floor(Math.random() * 100) + 1;
|
||||
if(lottery < 99) return msg.say(`Nope, sorry ${msg.author.username}, you lost.`);
|
||||
if (lottery < 99) return msg.say(`Nope, sorry ${msg.author.username}, you lost.`);
|
||||
return msg.say(`Wow ${msg.author.username}! You actually won! Great job!`);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -16,7 +16,7 @@ module.exports = class MathGameCommand extends Command {
|
||||
prompt: 'What should the difficulty of the game be? `Easy`, `Medium`, `Hard`, `Extreme`, or `Impossible`?',
|
||||
type: 'string',
|
||||
validate: difficulty => {
|
||||
if(['easy', 'medium', 'hard', 'extreme', 'impossible'].includes(difficulty.toLowerCase())) return true;
|
||||
if (['easy', 'medium', 'hard', 'extreme', 'impossible'].includes(difficulty.toLowerCase())) return true;
|
||||
return 'The difficulty must be either `easy`, `medium`, `hard`, `extreme`, or `impossible`.';
|
||||
},
|
||||
parse: difficulty => difficulty.toLowerCase()
|
||||
@@ -26,8 +26,8 @@ module.exports = class MathGameCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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 { difficulty } = args;
|
||||
const operation = operations[Math.floor(Math.random() * operations.length)];
|
||||
@@ -61,10 +61,10 @@ module.exports = class MathGameCommand extends Command {
|
||||
time: 10000,
|
||||
errors: ['time']
|
||||
});
|
||||
if(collected.first().content !== solved)
|
||||
if (collected.first().content !== solved)
|
||||
return msg.say(`Nope! The correct answer is: ${solved}.`);
|
||||
return msg.say(`Perfect! ${solved} is the correct answer!`);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`Time! The correct answer is ${solved}.`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,7 @@ module.exports = class QuizCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'quiz',
|
||||
aliases: [
|
||||
'jeopardy'
|
||||
],
|
||||
aliases: ['jeopardy'],
|
||||
group: 'games',
|
||||
memberName: 'quiz',
|
||||
description: 'Answer a quiz question.'
|
||||
@@ -17,8 +15,8 @@ module.exports = class QuizCommand 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
|
||||
@@ -37,13 +35,13 @@ module.exports = class QuizCommand extends Command {
|
||||
time: 15000,
|
||||
errors: ['time']
|
||||
});
|
||||
if(collected.first().content.toLowerCase() !== answer)
|
||||
if (collected.first().content.toLowerCase() !== answer)
|
||||
return msg.say(`The correct answer is: ${answer}.`);
|
||||
return msg.say(`Perfect! The correct answer is: ${answer}.`);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`Time! The correct answer is: ${answer}`);
|
||||
}
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}.`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,7 @@ module.exports = class RockPaperScissorsCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'rock-paper-scissors',
|
||||
aliases: [
|
||||
'rps'
|
||||
],
|
||||
aliases: ['rps'],
|
||||
group: 'games',
|
||||
memberName: 'rock-paper-scissors',
|
||||
description: 'Play Rock-Paper-Scissors.',
|
||||
@@ -17,7 +15,7 @@ module.exports = class RockPaperScissorsCommand extends Command {
|
||||
prompt: '`Rock`, `Paper`, or `Scissors`?',
|
||||
type: 'string',
|
||||
validate: choice => {
|
||||
if(['rock', 'paper', 'scissors'].includes(choice.toLowerCase())) return true;
|
||||
if (['rock', 'paper', 'scissors'].includes(choice.toLowerCase())) return true;
|
||||
return 'Please enter either `rock`, `paper`, or `scissors`.';
|
||||
},
|
||||
parse: choice => choice.toLowerCase()
|
||||
@@ -29,18 +27,18 @@ module.exports = class RockPaperScissorsCommand extends Command {
|
||||
run(msg, args) {
|
||||
const { choice } = args;
|
||||
const response = responses[Math.floor(Math.random() * responses.length)];
|
||||
if(choice === 'rock') {
|
||||
if(response === 'Rock') return msg.say('Rock! Aw, it\'s a tie!');
|
||||
if(response === 'Paper') return msg.say('Paper! Yes! I win!');
|
||||
if(response === 'Scissors') return msg.say('Scissors! Aw... I lose...');
|
||||
} else if(choice === 'paper') {
|
||||
if(response === 'Rock') return msg.say('Rock! Aw... I lose...');
|
||||
if(response === 'Paper') return msg.say('Paper! Aw, it\'s a tie!');
|
||||
if(response === 'Scissors') return msg.say('Scissors! Yes! I win!');
|
||||
} else if(choice === 'scissors') {
|
||||
if(response === 'Rock') return msg.say('Rock! Yes! I win!');
|
||||
if(response === 'Paper') return msg.say('Paper! Aw... I lose...');
|
||||
if(response === 'Scissors') return msg.say('Scissors! Aw, it\'s a tie!');
|
||||
if (choice === 'rock') {
|
||||
if (response === 'Rock') return msg.say('Rock! Aw, it\'s a tie!');
|
||||
if (response === 'Paper') return msg.say('Paper! Yes! I win!');
|
||||
if (response === 'Scissors') return msg.say('Scissors! Aw... I lose...');
|
||||
} else if (choice === 'paper') {
|
||||
if (response === 'Rock') return msg.say('Rock! Aw... I lose...');
|
||||
if (response === 'Paper') return msg.say('Paper! Aw, it\'s a tie!');
|
||||
if (response === 'Scissors') return msg.say('Scissors! Yes! I win!');
|
||||
} else if (choice === 'scissors') {
|
||||
if (response === 'Rock') return msg.say('Rock! Yes! I win!');
|
||||
if (response === 'Paper') return msg.say('Paper! Aw... I lose...');
|
||||
if (response === 'Scissors') return msg.say('Scissors! Aw, it\'s a tie!');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -16,7 +16,7 @@ module.exports = class SlotsCommand extends Command {
|
||||
const slotOne = slotThing[Math.floor(Math.random() * slotThing.length)];
|
||||
const slotTwo = slotThing[Math.floor(Math.random() * slotThing.length)];
|
||||
const slotThree = slotThing[Math.floor(Math.random() * slotThing.length)];
|
||||
if(slotOne === slotTwo && slotOne === slotThree)
|
||||
if (slotOne === slotTwo && slotOne === slotThree)
|
||||
return msg.say(stripIndents`
|
||||
${slotOne}|${slotTwo}|${slotThree}
|
||||
Wow! You won! Great job... er... luck!
|
||||
|
||||
@@ -15,7 +15,7 @@ module.exports = class TypingGameCommand extends Command {
|
||||
prompt: 'What should the difficulty of the game be? `Easy`, `Medium`, `Hard`, `Extreme`, or `Impossible`?',
|
||||
type: 'string',
|
||||
validate: difficulty => {
|
||||
if(['easy', 'medium', 'hard', 'extreme', 'impossible'].includes(difficulty.toLowerCase())) return true;
|
||||
if (['easy', 'medium', 'hard', 'extreme', 'impossible'].includes(difficulty.toLowerCase())) return true;
|
||||
return 'The difficulty must be either `easy`, `medium`, `hard`, `extreme`, or `impossible`.';
|
||||
},
|
||||
parse: difficulty => difficulty.toLowerCase()
|
||||
@@ -25,8 +25,8 @@ module.exports = class TypingGameCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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 { difficulty } = args;
|
||||
const sentence = sentences[Math.floor(Math.random() * sentences.length)];
|
||||
@@ -58,10 +58,10 @@ module.exports = class TypingGameCommand extends Command {
|
||||
time: time,
|
||||
errors: ['time']
|
||||
});
|
||||
if(collected.first().content !== sentence)
|
||||
if (collected.first().content !== sentence)
|
||||
return msg.say('Nope, your sentence does not match the original. Try again next time!');
|
||||
return msg.say(`Good Job! You won!`);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say('Time! Try again next time!');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,7 @@ module.exports = class GuildInfoCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'server',
|
||||
aliases: [
|
||||
'guild',
|
||||
'server-info',
|
||||
'guild-info'
|
||||
],
|
||||
aliases: ['guild', 'server-info', 'guild-info'],
|
||||
group: 'guildinfo',
|
||||
memberName: 'server',
|
||||
description: 'Gives some info on the current server.',
|
||||
@@ -21,7 +17,7 @@ module.exports = class GuildInfoCommand extends Command {
|
||||
}
|
||||
|
||||
run(msg) {
|
||||
if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0x00AE86)
|
||||
|
||||
@@ -6,9 +6,7 @@ module.exports = class BanCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'ban',
|
||||
aliases: [
|
||||
'banne'
|
||||
],
|
||||
aliases: ['banne'],
|
||||
group: 'moderation',
|
||||
memberName: 'ban',
|
||||
description: 'Bans a user and logs the ban to the mod logs.',
|
||||
@@ -24,7 +22,7 @@ module.exports = class BanCommand extends Command {
|
||||
prompt: 'What do you want to set the reason as?',
|
||||
type: 'string',
|
||||
validate: reason => {
|
||||
if(reason.length < 140) return true;
|
||||
if (reason.length < 140) return true;
|
||||
return 'Invalid Reason. Reason must be under 140 characters.';
|
||||
}
|
||||
}
|
||||
@@ -37,23 +35,23 @@ module.exports = class BanCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
if(!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS'))
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS'))
|
||||
return msg.say('This Command requires the `Ban Members` Permission.');
|
||||
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
|
||||
if(!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
|
||||
if(!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
|
||||
if (!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
|
||||
if (!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
|
||||
return msg.say('This Command requires the `Send Messages` Permission for the Mod Log Channel.');
|
||||
if(!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { member, reason } = args;
|
||||
if(!member.bannable) return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
|
||||
if (!member.bannable) return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
|
||||
try {
|
||||
try {
|
||||
await member.send(stripIndents`
|
||||
You were banned from ${msg.guild.name}!
|
||||
Reason: ${reason}.
|
||||
`);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
await msg.say('Failed to send DM to the user.');
|
||||
}
|
||||
await member.ban({ days: 7, reason });
|
||||
@@ -68,7 +66,7 @@ module.exports = class BanCommand extends Command {
|
||||
**Reason:** ${reason}
|
||||
`);
|
||||
return modlogs.send({ embed });
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = class KickCommand extends Command {
|
||||
prompt: 'What do you want to set the reason as?',
|
||||
type: 'string',
|
||||
validate: reason => {
|
||||
if(reason.length < 140) return true;
|
||||
if (reason.length < 140) return true;
|
||||
return 'Invalid Reason. Reason must be under 140 characters.';
|
||||
}
|
||||
}
|
||||
@@ -34,23 +34,23 @@ module.exports = class KickCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
if(!msg.channel.permissionsFor(this.client.user).has('KICK_MEMBERS'))
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('KICK_MEMBERS'))
|
||||
return msg.say('This Command requires the `Kick Members` Permission.');
|
||||
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
|
||||
if(!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
|
||||
if(!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
|
||||
if (!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
|
||||
if (!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
|
||||
return msg.say('This Command requires the `Send Messages` Permission for the Mod Log Channel.');
|
||||
if(!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { member, reason } = args;
|
||||
if(!member.kickable) return msg.say('This member is not kickable. Perhaps they have a higher role than me?');
|
||||
if (!member.kickable) return msg.say('This member is not kickable. Perhaps they have a higher role than me?');
|
||||
try {
|
||||
try {
|
||||
await member.send(stripIndents`
|
||||
You were kicked from ${msg.guild.name}!
|
||||
Reason: ${reason}.
|
||||
`);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
await msg.say('Failed to send DM.');
|
||||
}
|
||||
await member.kick({ reason });
|
||||
@@ -65,7 +65,7 @@ module.exports = class KickCommand extends Command {
|
||||
**Reason:** ${reason}
|
||||
`);
|
||||
return modlogs.send({ embed });
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ module.exports = class LockdownCommand extends Command {
|
||||
prompt: 'Please enter either `start` or `stop`.',
|
||||
type: 'string',
|
||||
validate: type => {
|
||||
if(['start', 'stop'].includes(type.toLowerCase())) return true;
|
||||
if (['start', 'stop'].includes(type.toLowerCase())) return true;
|
||||
return 'Please enter either `start` or `stop`.';
|
||||
},
|
||||
parse: type => type.toLowerCase()
|
||||
@@ -29,24 +29,24 @@ module.exports = class LockdownCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
if(!msg.channel.permissionsFor(this.client.user).has('ADMINISTRATOR'))
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('ADMINISTRATOR'))
|
||||
return msg.say('This Command requires the `Administrator` Permission.');
|
||||
const { type } = args;
|
||||
if(type === 'start') {
|
||||
if (type === 'start') {
|
||||
try {
|
||||
await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: false });
|
||||
return msg.say(stripIndents`
|
||||
Lockdown Started, users without Administrator can no longer post messages.
|
||||
Please use \`lockdown stop\` to end the lockdown.
|
||||
`);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
} else if(type === 'stop') {
|
||||
} else if (type === 'stop') {
|
||||
try {
|
||||
await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: true });
|
||||
return msg.say('Lockdown Ended, users without Administrator can now post messages.');
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ module.exports = class PruneCommand extends Command {
|
||||
prompt: 'How many messages do you want to delete? Limit of up to 99.',
|
||||
type: 'integer',
|
||||
validate: count => {
|
||||
if(count < 100 && count > 0) return true;
|
||||
if (count < 100 && count > 0) return true;
|
||||
return 'Invalid Count. Count must be from 1-99.';
|
||||
}
|
||||
}
|
||||
@@ -32,16 +32,16 @@ module.exports = class PruneCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
if(!msg.channel.permissionsFor(this.client.user).has('READ_MESSAGE_HISTORY'))
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('READ_MESSAGE_HISTORY'))
|
||||
return msg.say('This Command requires the `Read Message History` Permission.');
|
||||
if(!msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES'))
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES'))
|
||||
return msg.say('This Command requires the `Manage Messages` Permission.');
|
||||
const { count } = args;
|
||||
try {
|
||||
const messages = await msg.channel.fetchMessages({ limit: count + 1 });
|
||||
await msg.channel.bulkDelete(messages, true);
|
||||
return null;
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say('There are no messages younger than two weeks that can be deleted.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ module.exports = class SoftbanCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'softban',
|
||||
aliases: ['softbanne'],
|
||||
group: 'moderation',
|
||||
memberName: 'softban',
|
||||
description: 'Kicks a user and deletes their messages, and logs the softban to the mod logs.',
|
||||
@@ -21,7 +22,7 @@ module.exports = class SoftbanCommand extends Command {
|
||||
prompt: 'What do you want to set the reason as?',
|
||||
type: 'string',
|
||||
validate: reason => {
|
||||
if(reason.length < 140) return true;
|
||||
if (reason.length < 140) return true;
|
||||
return 'Invalid Reason. Reason must be under 140 characters.';
|
||||
}
|
||||
}
|
||||
@@ -34,25 +35,25 @@ module.exports = class SoftbanCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
if(!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS'))
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS'))
|
||||
return msg.say('This Command requires the `Ban Members` Permission.');
|
||||
if(!msg.channel.permissionsFor(this.client.user).has('KICK_MEMBERS'))
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('KICK_MEMBERS'))
|
||||
return msg.say('This Command requires the `Kick Members` Permission.');
|
||||
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
|
||||
if(!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
|
||||
if(!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
|
||||
if (!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
|
||||
if (!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
|
||||
return msg.say('This Command requires the `Send Messages` Permission for the Mod Log Channel.');
|
||||
if(!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { member, reason } = args;
|
||||
if(!member.bannable) return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
|
||||
if (!member.bannable) return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
|
||||
try {
|
||||
try {
|
||||
await member.send(stripIndents`
|
||||
You were softbanned from ${msg.guild.name}!
|
||||
Reason: ${reason}.
|
||||
`);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
await msg.say('Failed to send DM to user.');
|
||||
}
|
||||
await member.ban({ days: 7, reason });
|
||||
@@ -68,7 +69,7 @@ module.exports = class SoftbanCommand extends Command {
|
||||
**Reason:** ${reason}
|
||||
`);
|
||||
return modlogs.send({ embed });
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,7 @@ module.exports = class UnbanCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'unban',
|
||||
aliases: [
|
||||
'unbanne'
|
||||
],
|
||||
aliases: ['unbanne'],
|
||||
group: 'moderation',
|
||||
memberName: 'unban',
|
||||
description: 'Unbans a user and logs the unban to the mod logs.',
|
||||
@@ -19,7 +17,7 @@ module.exports = class UnbanCommand extends Command {
|
||||
prompt: 'What member do you want to unban? Please enter the ID of the user.',
|
||||
type: 'string',
|
||||
validate: id => {
|
||||
if(id.length === 18) return true;
|
||||
if (id.length === 18) return true;
|
||||
return 'Invalid ID.';
|
||||
}
|
||||
},
|
||||
@@ -28,7 +26,7 @@ module.exports = class UnbanCommand extends Command {
|
||||
prompt: 'What do you want to set the reason as?',
|
||||
type: 'string',
|
||||
validate: reason => {
|
||||
if(reason.length < 140) return true;
|
||||
if (reason.length < 140) return true;
|
||||
return 'Invalid Reason. Reason must be under 140 characters.';
|
||||
}
|
||||
}
|
||||
@@ -41,17 +39,17 @@ module.exports = class UnbanCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
if(!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS'))
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('BAN_MEMBERS'))
|
||||
return msg.say('This Command requires the `Ban Members` Permission.');
|
||||
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
|
||||
if(!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
|
||||
if(!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
|
||||
if (!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
|
||||
if (!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
|
||||
return msg.say('This Command requires the `Send Messages` Permission for the Mod Log Channel.');
|
||||
if(!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { id, reason } = args;
|
||||
const bans = await msg.guild.fetchBans();
|
||||
if(!bans.has(id)) return msg.say('This ID is not in the Guild Banlist.');
|
||||
if (!bans.has(id)) return msg.say('This ID is not in the Guild Banlist.');
|
||||
const member = bans.get(id);
|
||||
try {
|
||||
await msg.guild.unban(member);
|
||||
@@ -66,7 +64,7 @@ module.exports = class UnbanCommand extends Command {
|
||||
**Reason:** ${reason}
|
||||
`);
|
||||
return modlogs.send({ embed });
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ module.exports = class WarnCommand extends Command {
|
||||
prompt: 'What do you want to set the reason as?',
|
||||
type: 'string',
|
||||
validate: reason => {
|
||||
if(reason.length < 140) return true;
|
||||
if (reason.length < 140) return true;
|
||||
return 'Invalid Reason. Reason must be under 140 characters.';
|
||||
}
|
||||
}
|
||||
@@ -35,10 +35,10 @@ module.exports = class WarnCommand extends Command {
|
||||
|
||||
async run(msg, args) {
|
||||
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
|
||||
if(!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
|
||||
if(!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
|
||||
if (!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
|
||||
if (!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
|
||||
return msg.say('This Command requires the `Send Messages` Permission for the Mod Log Channel.');
|
||||
if(!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
|
||||
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||
const { member, reason } = args;
|
||||
try {
|
||||
@@ -53,7 +53,7 @@ module.exports = class WarnCommand extends Command {
|
||||
**Reason:** ${reason}
|
||||
`);
|
||||
return modlogs.send({ embed });
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ module.exports = class CurrencyCommand extends Command {
|
||||
prompt: 'What currency code do you want to use as the base?',
|
||||
type: 'string',
|
||||
validate: base => {
|
||||
if(codes.includes(base.toUpperCase())) return true;
|
||||
if (codes.includes(base.toUpperCase())) return true;
|
||||
return 'Invalid Currency Code. Use `help currency` to view a list of currency codes.';
|
||||
},
|
||||
parse: base => base.toUpperCase()
|
||||
@@ -26,7 +26,7 @@ module.exports = class CurrencyCommand extends Command {
|
||||
prompt: 'What currency code do you want to convert to?',
|
||||
type: 'string',
|
||||
validate: to => {
|
||||
if(codes.includes(to.toUpperCase())) return true;
|
||||
if (codes.includes(to.toUpperCase())) return true;
|
||||
return 'Invalid Currency Code. Use `help currency` to view a list of currency codes.';
|
||||
},
|
||||
parse: to => to.toUpperCase()
|
||||
@@ -42,13 +42,13 @@ module.exports = class CurrencyCommand extends Command {
|
||||
|
||||
async run(msg, args) {
|
||||
const { base, to, amount } = args;
|
||||
if(base === to) return msg.say(`Converting ${base} to ${to} is the same value, dummy.`);
|
||||
if (base === to) return msg.say(`Converting ${base} to ${to} is the same value, dummy.`);
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`http://api.fixer.io/latest?base=${base}&symbols=${to}`);
|
||||
const rate = body.rates[to];
|
||||
return msg.say(`${amount} ${base} is ${amount * rate} ${to}.`);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,7 +13,7 @@ module.exports = class TemperatureCommand extends Command {
|
||||
prompt: 'What temperature unit do you want to use as the base?',
|
||||
type: 'string',
|
||||
validate: base => {
|
||||
if(['celsius', 'fahrenheit', 'kelvin'].includes(base.toLowerCase())) return true;
|
||||
if (['celsius', 'fahrenheit', 'kelvin'].includes(base.toLowerCase())) return true;
|
||||
return 'Please enter either `celsius`, `fahrenheit`, or `kelvin`.';
|
||||
},
|
||||
parse: base => base.toLowerCase()
|
||||
@@ -23,7 +23,7 @@ module.exports = class TemperatureCommand extends Command {
|
||||
prompt: 'What temperature unit do you want to convert to?',
|
||||
type: 'string',
|
||||
validate: to => {
|
||||
if(['celsius', 'fahrenheit', 'kelvin'].includes(to.toLowerCase())) return true;
|
||||
if (['celsius', 'fahrenheit', 'kelvin'].includes(to.toLowerCase())) return true;
|
||||
return 'Please enter either `celsius`, `fahrenheit`, or `kelvin`.';
|
||||
},
|
||||
parse: to => to.toLowerCase()
|
||||
@@ -39,16 +39,16 @@ module.exports = class TemperatureCommand extends Command {
|
||||
|
||||
run(msg, args) {
|
||||
const { base, to, amount } = args;
|
||||
if(base === to) return msg.say(`Converting ${base} to ${to} is the same value, dummy.`);
|
||||
if(base === 'celsius') {
|
||||
if(to === 'fahrenheit') return msg.say(`${amount}°C is ${(amount * 1.8) + 32}°F.`);
|
||||
if(to === 'kelvin') return msg.say(`${amount}°C is ${amount + 273.15}°K.`);
|
||||
} else if(base === 'fahrenheit') {
|
||||
if(to === 'celsius') return msg.say(`${amount}°F is ${(amount - 32) / 1.8}°C.`);
|
||||
if(to === 'kelvin') return msg.say(`${amount}°F is ${(amount + 459.67) * (5 / 9)}°K.`);
|
||||
} else if(base === 'kelvin') {
|
||||
if(to === 'celsius') return msg.say(`${amount}°K is ${amount - 273.15}°C.`);
|
||||
if(to === 'fahrenheit') return msg.say(`${amount}°K is ${(amount * 1.8) - 459.67}°F.`);
|
||||
if (base === to) return msg.say(`Converting ${base} to ${to} is the same value, dummy.`);
|
||||
if (base === 'celsius') {
|
||||
if (to === 'fahrenheit') return msg.say(`${amount}°C is ${(amount * 1.8) + 32}°F.`);
|
||||
if (to === 'kelvin') return msg.say(`${amount}°C is ${amount + 273.15}°K.`);
|
||||
} else if (base === 'fahrenheit') {
|
||||
if (to === 'celsius') return msg.say(`${amount}°F is ${(amount - 32) / 1.8}°C.`);
|
||||
if (to === 'kelvin') return msg.say(`${amount}°F is ${(amount + 459.67) * (5 / 9)}°K.`);
|
||||
} else if (base === 'kelvin') {
|
||||
if (to === 'celsius') return msg.say(`${amount}°K is ${amount - 273.15}°C.`);
|
||||
if (to === 'fahrenheit') return msg.say(`${amount}°K is ${(amount * 1.8) - 459.67}°F.`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,9 +5,7 @@ module.exports = class EasterEggCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'easter-egg',
|
||||
aliases: [
|
||||
'tag'
|
||||
],
|
||||
aliases: ['tag'],
|
||||
group: 'random',
|
||||
memberName: 'easter-egg',
|
||||
description: 'Can you discover all the easter eggs?',
|
||||
@@ -17,7 +15,7 @@ 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;
|
||||
if (eastereggs[tag.toLowerCase()]) return true;
|
||||
return 'Nope, that\'s not a valid easter egg. Try again!';
|
||||
},
|
||||
parse: tag => tag.toLowerCase()
|
||||
|
||||
@@ -15,7 +15,7 @@ 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;
|
||||
if (codes.includes(type.toLowerCase())) return true;
|
||||
return 'Invalid meme type. Use `help meme` to view a list of meme types.';
|
||||
},
|
||||
parse: type => type.toLowerCase()
|
||||
@@ -37,11 +37,11 @@ module.exports = class MemeCommand extends Command {
|
||||
}
|
||||
|
||||
run(msg, args) {
|
||||
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.');
|
||||
const { type, top, bottom } = args;
|
||||
return msg.channel.send({ files: [`https://memegen.link/${type}/${top}/${bottom}.jpg`] })
|
||||
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||
.catch (err => msg.say(`An Error Occurred: ${err}`));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,8 +13,8 @@ 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')
|
||||
|
||||
@@ -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'] })
|
||||
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||
.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) return true;
|
||||
if (title.length < 200) return true;
|
||||
return 'Invalid Title. Title must be under 200 characters.';
|
||||
}
|
||||
},
|
||||
@@ -25,7 +25,7 @@ module.exports = class StrawpollCommand extends Command {
|
||||
type: 'string',
|
||||
infinite: true,
|
||||
validate: choice => {
|
||||
if(choice.length < 160) return true;
|
||||
if (choice.length < 160) return true;
|
||||
return 'Invalid Choice. Choices must be under 140 characters each.';
|
||||
}
|
||||
}
|
||||
@@ -35,8 +35,8 @@ module.exports = class StrawpollCommand extends Command {
|
||||
|
||||
async run(msg, args) {
|
||||
const { title, options } = args;
|
||||
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.');
|
||||
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.');
|
||||
try {
|
||||
const { body } = await request
|
||||
.post('https://strawpoll.me/api/v2/polls')
|
||||
@@ -45,7 +45,7 @@ module.exports = class StrawpollCommand extends Command {
|
||||
${body.title}
|
||||
http://strawpoll.me/${body.id}
|
||||
`);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,7 @@ module.exports = class WouldYouRatherCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'would-you-rather',
|
||||
aliases: [
|
||||
'wyrather'
|
||||
],
|
||||
aliases: ['wyrather'],
|
||||
group: 'random',
|
||||
memberName: 'would-you-rather',
|
||||
description: 'Gets a random would you rather question.'
|
||||
@@ -16,8 +14,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 +26,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 Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,7 @@ module.exports = class CatCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'cat',
|
||||
aliases: [
|
||||
'neko'
|
||||
],
|
||||
aliases: ['neko'],
|
||||
group: 'randomimg',
|
||||
memberName: 'cat',
|
||||
description: 'Sends a random cat image.'
|
||||
@@ -15,15 +13,15 @@ module.exports = class CatCommand extends Command {
|
||||
}
|
||||
|
||||
async 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.');
|
||||
try {
|
||||
const { body } = await request
|
||||
.get('http://random.cat/meow');
|
||||
return msg.channel.send({ files: [body.file] })
|
||||
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||
} catch(err) {
|
||||
.catch (err => msg.say(`An Error Occurred: ${err}`));
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,15 +12,15 @@ module.exports = class DogCommand extends Command {
|
||||
}
|
||||
|
||||
async 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.');
|
||||
try {
|
||||
const { body } = await request
|
||||
.get('https://random.dog/woof.json');
|
||||
return msg.channel.send({ files: [body.url] })
|
||||
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||
} catch(err) {
|
||||
.catch (err => msg.say(`An Error Occurred: ${err}`));
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,7 @@ module.exports = class XiaoCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'xiao-pai',
|
||||
aliases: [
|
||||
'xiao'
|
||||
],
|
||||
aliases: ['xiao'],
|
||||
group: 'randomimg',
|
||||
memberName: 'xiao-pai',
|
||||
description: 'Sends a random image of Xiao Pai.'
|
||||
@@ -15,11 +13,11 @@ module.exports = class XiaoCommand 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.');
|
||||
const xiao = xiaos[Math.floor(Math.random() * xiaos.length)];
|
||||
return msg.channel.send({ files: [xiao] })
|
||||
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||
.catch (err => msg.say(`An Error Occurred: ${err}`));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,10 +5,7 @@ module.exports = class CoinFlipCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'coin',
|
||||
aliases: [
|
||||
'coin-flip',
|
||||
'flip'
|
||||
],
|
||||
aliases: ['coin-flip', 'flip'],
|
||||
group: 'response',
|
||||
memberName: 'coin',
|
||||
description: 'Flips a coin.'
|
||||
|
||||
@@ -14,7 +14,7 @@ module.exports = class RandomNameCommand extends Command {
|
||||
prompt: 'Which gender do you want to generate a name for?',
|
||||
type: 'string',
|
||||
validate: gender => {
|
||||
if(['male', 'female'].includes(gender.toLowerCase())) return true;
|
||||
if (['male', 'female'].includes(gender.toLowerCase())) return true;
|
||||
return 'Please enter either `male` or `female`.';
|
||||
},
|
||||
parse: gender => gender.toLowerCase()
|
||||
@@ -26,10 +26,10 @@ module.exports = class RandomNameCommand extends Command {
|
||||
run(msg, args) {
|
||||
const { gender } = args;
|
||||
const lastName = lastNames[Math.floor(Math.random() * lastNames.length)];
|
||||
if(gender === 'male') {
|
||||
if (gender === 'male') {
|
||||
const name = maleNames[Math.floor(Math.random() * maleNames.length)];
|
||||
return msg.say(`${name} ${lastName}`);
|
||||
} else if(gender === 'female') {
|
||||
} else if (gender === 'female') {
|
||||
const name = femaleNames[Math.floor(Math.random() * femaleNames.length)];
|
||||
return msg.say(`${name} ${lastName}`);
|
||||
}
|
||||
|
||||
@@ -5,9 +5,7 @@ module.exports = class QuantumCoinCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'quantum-coin',
|
||||
aliases: [
|
||||
'qcoin'
|
||||
],
|
||||
aliases: ['qcoin'],
|
||||
group: 'response',
|
||||
memberName: 'quantum-coin',
|
||||
description: 'Flips a coin that lands on nothing.'
|
||||
|
||||
@@ -4,9 +4,7 @@ module.exports = class RateWaifuCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'rate-waifu',
|
||||
aliases: [
|
||||
'waifu'
|
||||
],
|
||||
aliases: ['waifu'],
|
||||
group: 'response',
|
||||
memberName: 'rate-waifu',
|
||||
description: 'Rates your Waifu.',
|
||||
|
||||
@@ -4,9 +4,7 @@ module.exports = class RollCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'roll',
|
||||
aliases: [
|
||||
'dice'
|
||||
],
|
||||
aliases: ['dice'],
|
||||
group: 'response',
|
||||
memberName: 'roll',
|
||||
description: 'Rolls a dice with a maximum value you specify.',
|
||||
|
||||
@@ -4,9 +4,7 @@ module.exports = class ShipCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'ship',
|
||||
aliases: [
|
||||
'rate'
|
||||
],
|
||||
aliases: ['rate'],
|
||||
group: 'response',
|
||||
memberName: 'ship',
|
||||
description: 'Ships things/people together.',
|
||||
|
||||
@@ -20,8 +20,8 @@ module.exports = class BotSearchCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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 { bot } = args;
|
||||
try {
|
||||
@@ -41,7 +41,7 @@ module.exports = class BotSearchCommand extends Command {
|
||||
.addField('**Prefix:**',
|
||||
body.prefix, true);
|
||||
return msg.embed(embed);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,20 +21,20 @@ module.exports = class DefineCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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 { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`http://api.wordnik.com:80/v4/word.json/${query}/definitions?limit=1&includeRelated=false&useCanonical=false&api_key=${process.env.WORDNIK_KEY}`);
|
||||
if(body.length === 0) throw new Error('No Results.');
|
||||
if (body.length === 0) throw new Error('No Results.');
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0x9797FF)
|
||||
.setTitle(body[0].word)
|
||||
.setDescription(body[0].text);
|
||||
return msg.embed(embed);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,7 @@ module.exports = class DiscrimCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'discrim',
|
||||
aliases: [
|
||||
'discriminator',
|
||||
'search-discrim'
|
||||
],
|
||||
aliases: ['discriminator', 'search-discrim'],
|
||||
group: 'search',
|
||||
memberName: 'discrim',
|
||||
description: 'Searches for other users with a certain discriminator.',
|
||||
@@ -18,7 +15,7 @@ module.exports = class DiscrimCommand extends Command {
|
||||
prompt: 'Which discriminator would you like to search for?',
|
||||
type: 'string',
|
||||
validate: discrim => {
|
||||
if(/[0-9]+$/g.test(discrim) && discrim.length === 4) return true;
|
||||
if (/[0-9]+$/g.test(discrim) && discrim.length === 4) return true;
|
||||
return `${discrim} is not a valid discriminator.`;
|
||||
}
|
||||
}
|
||||
@@ -27,8 +24,8 @@ module.exports = class DiscrimCommand extends Command {
|
||||
}
|
||||
|
||||
run(msg, args) {
|
||||
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 { discrim } = args;
|
||||
const users = this.client.users.filter(u => u.discriminator === discrim).map(u => u.username).sort();
|
||||
|
||||
@@ -20,14 +20,14 @@ module.exports = class ForecastCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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 { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where u=\'f\' AND woeid in (select woeid from geo.places(1) where text="${query}")&format=json`);
|
||||
if(body.query.count === 0) throw new Error('Location Not Found.');
|
||||
if (body.query.count === 0) throw new Error('Location Not Found.');
|
||||
const forecasts = body.query.results.channel.item.forecast;
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0x0000FF)
|
||||
@@ -49,7 +49,7 @@ module.exports = class ForecastCommand extends Command {
|
||||
.addField(`**${forecasts[6].day} - ${forecasts[6].date}:**`,
|
||||
`**High:** ${forecasts[6].high}°F, **Low:** ${forecasts[6].low}°F, **Condition:** ${forecasts[6].text}`);
|
||||
return msg.embed(embed);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,10 +29,10 @@ module.exports = class GoogleCommand extends Command {
|
||||
.get(`https://www.google.com/search?q=${query}`);
|
||||
const $ = cheerio.load(text);
|
||||
let href = $('.r').first().find('a').first().attr('href');
|
||||
if(!href) throw new Error('No Results.');
|
||||
if (!href) throw new Error('No Results.');
|
||||
href = querystring.parse(href.replace('/url?', ''));
|
||||
return message.edit(href.q);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return message.edit('An Error Occurred: No Results.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,14 +21,14 @@ module.exports = class IMDBCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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 { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`http://www.omdbapi.com/?t=${query}&plot=full`);
|
||||
if(body.Error) throw new Error('No Results.');
|
||||
if (body.Error) throw new Error('No Results.');
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0xDBA628)
|
||||
.setAuthor('IMDB', 'https://i.imgur.com/sXwwIQs.png')
|
||||
@@ -50,7 +50,7 @@ module.exports = class IMDBCommand extends Command {
|
||||
.addField('**Actors:**',
|
||||
body.Actors);
|
||||
return msg.embed(embed);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ module.exports = class MapCommand extends Command {
|
||||
prompt: 'What would you like the zoom level for the map to be? Limit 1-20.',
|
||||
type: 'integer',
|
||||
validate: zoom => {
|
||||
if(zoom < 21 && zoom > 0)
|
||||
if (zoom < 21 && zoom > 0)
|
||||
return true;
|
||||
return 'Please enter a zoom value from 1-20';
|
||||
}
|
||||
@@ -31,16 +31,16 @@ module.exports = class MapCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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.');
|
||||
const { zoom, query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`https://maps.googleapis.com/maps/api/staticmap?center=${query}&zoom=${zoom}&size=500x500&key=${process.env.GOOGLE_KEY}`);
|
||||
return msg.channel.send({ files: [{ attachment: body, name: 'map.png' }] })
|
||||
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||
} catch(err) {
|
||||
.catch (err => msg.say(`An Error Occurred: ${err}`));
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,9 +27,9 @@ module.exports = class NeopetCommand extends Command {
|
||||
.get(`http://www.sunnyneo.com/petimagefinder.php?name=${query}&size=5&mood=1`);
|
||||
const $ = cheerio.load(text);
|
||||
const link = $('textarea').first().text();
|
||||
if(!link.includes('cp')) throw new Error('Invalid Pet Name.');
|
||||
if (!link.includes('cp')) throw new Error('Invalid Pet Name.');
|
||||
return msg.say(link);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,14 +21,14 @@ module.exports = class OsuCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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 { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`https://osu.ppy.sh/api/get_user?k=${process.env.OSU_KEY}&u=${query}&type=string`);
|
||||
if(body.length === 0) throw new Error('No Results.');
|
||||
if (body.length === 0) throw new Error('No Results.');
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0xFF66AA)
|
||||
.setAuthor('osu!', 'https://i.imgur.com/EmnUp00.png')
|
||||
@@ -58,7 +58,7 @@ module.exports = class OsuCommand extends Command {
|
||||
.addField('**A:**',
|
||||
body[0].count_rank_a, true);
|
||||
return msg.embed(embed);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,14 +21,14 @@ module.exports = class SoundCloudCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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 { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`https://api.soundcloud.com/tracks?q=${query}&client_id=${process.env.SOUNDCLOUD_KEY}`);
|
||||
if(body.length === 0) throw new Error('No Results.');
|
||||
if (body.length === 0) throw new Error('No Results.');
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0xF15A22)
|
||||
.setAuthor(body[0].title, 'https://i.imgur.com/lFIz7RU.png')
|
||||
@@ -45,7 +45,7 @@ module.exports = class SoundCloudCommand extends Command {
|
||||
.addField('**Favorited Count:**',
|
||||
body[0].favoritings_count, true);
|
||||
return msg.embed(embed);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,14 +21,14 @@ module.exports = class UrbanCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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 { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`http://api.urbandictionary.com/v0/define?term=${query}`);
|
||||
if(body.list.length === 0) throw new Error('No Results.');
|
||||
if (body.list.length === 0) throw new Error('No Results.');
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0x32a8f0)
|
||||
.setAuthor('Urban Dictionary', 'https://i.imgur.com/fzFuuL7.png')
|
||||
@@ -38,7 +38,7 @@ module.exports = class UrbanCommand extends Command {
|
||||
.addField('**Example:**',
|
||||
body.list[0].example.substr(0, 2000) || 'None');
|
||||
return msg.embed(embed);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,15 +21,15 @@ module.exports = class WattpadCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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 { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`https://api.wattpad.com:443/v4/stories?query=${query}&limit=1`)
|
||||
.set({ 'Authorization': `Basic ${process.env.WATTPAD_KEY}` });
|
||||
if(body.stories.length === 0) throw new Error('No Results.');
|
||||
if (body.stories.length === 0) throw new Error('No Results.');
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0xF89C34)
|
||||
.setAuthor('Wattpad', 'https://i.imgur.com/Rw9vRQB.png')
|
||||
@@ -49,7 +49,7 @@ module.exports = class WattpadCommand extends Command {
|
||||
.addField('**Comments:**',
|
||||
body.stories[0].commentCount, true);
|
||||
return msg.embed(embed);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,14 +20,14 @@ module.exports = class WeatherCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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 { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`https://query.yahooapis.com/v1/public/yql?q=select * from weather.forecast where u=\'f\' AND woeid in (select woeid from geo.places(1) where text="${query}")&format=json`);
|
||||
if(body.query.count === 0) throw new Error('Location Not Found.');
|
||||
if (body.query.count === 0) throw new Error('Location Not Found.');
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0x0000FF)
|
||||
.setAuthor(body.query.results.channel.title, 'https://i.imgur.com/2MT0ViC.png')
|
||||
@@ -58,7 +58,7 @@ module.exports = class WeatherCommand extends Command {
|
||||
.addField('**Wind Speed:**',
|
||||
body.query.results.channel.wind.speed, true);
|
||||
return msg.embed(embed);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,14 +21,14 @@ module.exports = class WikipediaCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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 { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`https://en.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&titles=${query}&exintro=&explaintext=&redirects=&formatversion=2`);
|
||||
if(body.query.pages[0].missing) throw new Error('No Results.');
|
||||
if (body.query.pages[0].missing) throw new Error('No Results.');
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0xE7E7E7)
|
||||
.setTitle(body.query.pages[0].title)
|
||||
@@ -36,7 +36,7 @@ module.exports = class WikipediaCommand extends Command {
|
||||
.setAuthor('Wikipedia', 'https://i.imgur.com/a4eeEhh.png')
|
||||
.setDescription(body.query.pages[0].extract.substr(0, 2000).replace(/[\n]/g, '\n\n'));
|
||||
return msg.embed(embed);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,14 +21,14 @@ module.exports = class YouTubeCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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 { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&maxResults=1&q=${query}&key=${process.env.GOOGLE_KEY}`);
|
||||
if(body.items.length === 0) throw new Error('No Results.');
|
||||
if (body.items.length === 0) throw new Error('No Results.');
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0xDD2825)
|
||||
.setTitle(body.items[0].snippet.title)
|
||||
@@ -37,7 +37,7 @@ module.exports = class YouTubeCommand extends Command {
|
||||
.setURL(`https://www.youtube.com/watch?v=${body.items[0].id.videoId}`)
|
||||
.setThumbnail(body.items[0].snippet.thumbnails.default.url);
|
||||
return msg.embed(embed);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,15 +21,15 @@ module.exports = class YuGiOhCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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 { query } = args;
|
||||
try {
|
||||
const { body } = await request
|
||||
.get(`http://yugiohprices.com/api/card_data/${query}`);
|
||||
if(body.status === 'fail') throw new Error('No Results.');
|
||||
if(body.data.card_type === 'monster') {
|
||||
if (body.status === 'fail') throw new Error('No Results.');
|
||||
if (body.data.card_type === 'monster') {
|
||||
const embed = new RichEmbed()
|
||||
.setColor(0xBE5F1F)
|
||||
.setTitle(body.data.name)
|
||||
@@ -57,7 +57,7 @@ module.exports = class YuGiOhCommand extends Command {
|
||||
.addField('**Card Type:**',
|
||||
body.data.card_type, true);
|
||||
return msg.embed(embed);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ module.exports = class BinaryCommand extends Command {
|
||||
prompt: 'What text would you like to convert to binary?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if(binary(text).length < 2000) return true;
|
||||
if (binary(text).length < 2000) return true;
|
||||
return 'Your text is too long.';
|
||||
},
|
||||
parse: text => binary(text)
|
||||
|
||||
@@ -14,7 +14,7 @@ module.exports = class CowsayCommand extends Command {
|
||||
prompt: 'What text would you like the cow to say?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if(text.length < 1500) return true;
|
||||
if (text.length < 1500) return true;
|
||||
return 'Invalid Text. Text must be under 1500 characters.';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ module.exports = class EmbedCommand extends Command {
|
||||
}
|
||||
|
||||
run(msg, args) {
|
||||
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 { text } = args;
|
||||
const embed = new RichEmbed()
|
||||
|
||||
@@ -15,7 +15,7 @@ module.exports = class MorseCommand extends Command {
|
||||
prompt: 'What text would you like to convert to morse?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if(letterTrans(text, dictionary, ' ').length < 1999) return true;
|
||||
if (letterTrans(text, dictionary, ' ').length < 1999) return true;
|
||||
return 'Your text is too long.';
|
||||
},
|
||||
parse: text => letterTrans(text.toLowerCase(), dictionary, ' ')
|
||||
|
||||
@@ -15,7 +15,7 @@ module.exports = class PirateCommand extends Command {
|
||||
prompt: 'What text would you like to convert to pirate?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if(wordTrans(text, dictionary).length < 1999) return true;
|
||||
if (wordTrans(text, dictionary).length < 1999) return true;
|
||||
return 'Your text is too long.';
|
||||
},
|
||||
parse: text => wordTrans(text, dictionary)
|
||||
|
||||
@@ -4,10 +4,7 @@ module.exports = class SayCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'say',
|
||||
aliases: [
|
||||
'copy',
|
||||
'echo'
|
||||
],
|
||||
aliases: ['copy', 'echo'],
|
||||
group: 'textedit',
|
||||
memberName: 'say',
|
||||
description: 'Make XiaoBot say what you wish.',
|
||||
@@ -23,7 +20,7 @@ module.exports = class SayCommand extends Command {
|
||||
}
|
||||
|
||||
run(msg, args) {
|
||||
if(!msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES'))
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES'))
|
||||
return msg.say('This Command requires the `Manage Messages` Permission.');
|
||||
const { text } = args;
|
||||
msg.delete();
|
||||
|
||||
@@ -15,7 +15,7 @@ module.exports = class TemmieCommand extends Command {
|
||||
prompt: 'What text would you like to convert to Temmie speak?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if(wordTrans(text, dictionary).length < 1999) return true;
|
||||
if (wordTrans(text, dictionary).length < 1999) return true;
|
||||
return 'Your text is too long.';
|
||||
},
|
||||
parse: text => wordTrans(text, dictionary)
|
||||
|
||||
@@ -6,9 +6,7 @@ module.exports = class UpsideDownCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'upside-down',
|
||||
aliases: [
|
||||
'udown'
|
||||
],
|
||||
aliases: ['udown'],
|
||||
group: 'textedit',
|
||||
memberName: 'upside-down',
|
||||
description: 'Flips text upside-down.',
|
||||
|
||||
@@ -5,10 +5,7 @@ module.exports = class WebhookCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'webhook',
|
||||
aliases: [
|
||||
'rin',
|
||||
'rin-say'
|
||||
],
|
||||
aliases: ['rin', 'rin-say'],
|
||||
group: 'textedit',
|
||||
memberName: 'webhook',
|
||||
description: 'Posts a message to the webhook defined in your `process.env`.',
|
||||
@@ -28,7 +25,7 @@ module.exports = class WebhookCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
if(!msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES'))
|
||||
if (!msg.channel.permissionsFor(this.client.user).has('MANAGE_MESSAGES'))
|
||||
return msg.say('This Command requires the `Manage Messages` Permission.');
|
||||
const { content } = args;
|
||||
try {
|
||||
@@ -37,7 +34,7 @@ module.exports = class WebhookCommand extends Command {
|
||||
.post(process.env.WEBHOOK_URL)
|
||||
.send({ content });
|
||||
return null;
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say(`An Error Occurred: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ module.exports = class ZalgoCommand extends Command {
|
||||
prompt: 'What text would you like to convert to zalgo?',
|
||||
type: 'string',
|
||||
validate: text => {
|
||||
if(text.length < 500) return true;
|
||||
if (text.length < 500) return true;
|
||||
return 'Invalid Text. Text must be under 500 characters.';
|
||||
},
|
||||
parse: text => zalgo(text)
|
||||
|
||||
@@ -8,11 +8,7 @@ module.exports = class UserInfoCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'user',
|
||||
aliases: [
|
||||
'user-info',
|
||||
'member',
|
||||
'member-info'
|
||||
],
|
||||
aliases: ['user-info', 'member', 'member-info'],
|
||||
group: 'userinfo',
|
||||
memberName: 'user',
|
||||
description: 'Gives some info on a user.',
|
||||
@@ -28,8 +24,8 @@ module.exports = class UserInfoCommand extends Command {
|
||||
}
|
||||
|
||||
run(msg, args) {
|
||||
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 { user } = args;
|
||||
const member = msg.guild.member(user);
|
||||
|
||||
@@ -14,7 +14,7 @@ module.exports = class ClearSettingCommand extends Command {
|
||||
prompt: 'What setting do you want to clear? `modLog`, `memberLog`, `joinMsg`, `leaveMsg`, `staffRole`, or `singleRole`?',
|
||||
type: 'string',
|
||||
validate: setting => {
|
||||
if(['modLog', 'memberLog', 'joinMsg', 'leaveMsg', 'staffRole', 'singleRole'].includes(setting)) return true;
|
||||
if (['modLog', 'memberLog', 'joinMsg', 'leaveMsg', 'staffRole', 'singleRole'].includes(setting)) return true;
|
||||
return 'Please enter either `modLog`, `memberLog`, `joinMsg`, `leaveMsg`, `staffRole`, or `singleRole`.';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,9 +6,7 @@ module.exports = class HelpCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'help',
|
||||
aliases: [
|
||||
'commands'
|
||||
],
|
||||
aliases: ['commands'],
|
||||
group: 'util',
|
||||
memberName: 'help',
|
||||
description: 'Displays a list of available commands, or detailed information for a specified command.',
|
||||
@@ -28,8 +26,8 @@ module.exports = class HelpCommand extends Command {
|
||||
const { command } = args;
|
||||
const commands = this.client.registry.findCommands(command, false, msg);
|
||||
const showAll = command && command.toLowerCase() === 'all';
|
||||
if(command && !showAll) {
|
||||
if(commands.length === 1) {
|
||||
if (command && !showAll) {
|
||||
if (commands.length === 1) {
|
||||
return msg.say(stripIndents`
|
||||
__Command **${commands[0].name}**:__ *${commands[0].description}*
|
||||
${commands[0].guildOnly ? 'Usable Only in Servers' : 'Usable in Servers and DM'}
|
||||
@@ -38,7 +36,7 @@ module.exports = class HelpCommand extends Command {
|
||||
**Group:** ${commands[0].group.name}
|
||||
${commands[0].details || ''}
|
||||
`);
|
||||
} else if(commands.length > 1) {
|
||||
} else if (commands.length > 1) {
|
||||
return msg.say(`Multiple Commands Found. Please be more specific: ${commands.map(c => `"${c.name}"`).join(', ')}`);
|
||||
} else {
|
||||
return msg.say(`Could not identify command. Use ${msg.usage(null)} to view a list of commands you can use.`);
|
||||
@@ -48,7 +46,7 @@ module.exports = class HelpCommand extends Command {
|
||||
.setTitle(!showAll ? `Commands Available in ${msg.guild ? msg.guild.name : 'this DM'}` : 'All Commands')
|
||||
.setDescription(`Use ${msg.usage('<command>')} to view detailed information about a specific command.`)
|
||||
.setColor(0x00AE86);
|
||||
for(const group of this.client.registry.groups.array()) {
|
||||
for (const group of this.client.registry.groups.array()) {
|
||||
embed.addField(group.name,
|
||||
!showAll ?
|
||||
group.commands.filter(c => c.isUsable(msg)).map(c => `\`${c.name}\``).join(', ') || 'None Available' :
|
||||
@@ -57,7 +55,7 @@ module.exports = class HelpCommand extends Command {
|
||||
try {
|
||||
await msg.author.send({ embed });
|
||||
return msg.say(':mailbox_with_mail: Sent you a DM with information.');
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return msg.say('Failed to send DM. You probably have DMs disabled.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,7 @@ module.exports = class InfoCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'info',
|
||||
aliases: [
|
||||
'information'
|
||||
],
|
||||
aliases: ['information'],
|
||||
group: 'util',
|
||||
memberName: 'info',
|
||||
description: 'Gives some bot info for your shard.'
|
||||
@@ -19,8 +17,8 @@ module.exports = class InfoCommand 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.');
|
||||
const guilds = await this.client.shard.fetchClientValues('guilds.size');
|
||||
const memory = await this.client.shard.broadcastEval('Math.round(process.memoryUsage().heapUsed / 1024 / 1024)');
|
||||
|
||||
@@ -4,9 +4,7 @@ module.exports = class MemberMsgCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'member-message',
|
||||
aliases: [
|
||||
'member-msg'
|
||||
],
|
||||
aliases: ['member-msg'],
|
||||
group: 'util',
|
||||
memberName: 'member-message',
|
||||
description: 'Sets the message for either join/leave logs to use.',
|
||||
@@ -18,7 +16,7 @@ module.exports = class MemberMsgCommand extends Command {
|
||||
prompt: 'Which message would you like to change? Please enter either `joinMsg` or `leaveMsg`.',
|
||||
type: 'string',
|
||||
validate: type => {
|
||||
if(['joinMsg', 'leaveMsg'].includes(type)) return true;
|
||||
if (['joinMsg', 'leaveMsg'].includes(type)) return true;
|
||||
return 'Please enter either `joinMsg` or `leaveMsg`.';
|
||||
}
|
||||
},
|
||||
@@ -27,7 +25,7 @@ module.exports = class MemberMsgCommand extends Command {
|
||||
prompt: 'What should be sent to the channel? Use <user>, <server>, and <mention> as placeholders.',
|
||||
type: 'string',
|
||||
validate: message => {
|
||||
if(message.length < 1000) return true;
|
||||
if (message.length < 1000) return true;
|
||||
return 'Invalid Message. Message must be under 1000 characters.';
|
||||
}
|
||||
}
|
||||
@@ -41,10 +39,10 @@ module.exports = class MemberMsgCommand extends Command {
|
||||
|
||||
run(msg, args) {
|
||||
const { type, message } = args;
|
||||
if(type === 'joinMsg') {
|
||||
if (type === 'joinMsg') {
|
||||
msg.guild.settings.set('joinMsg', message);
|
||||
return msg.say(`Join Message set to "${message}".`);
|
||||
} else if(type === 'leaveMsg') {
|
||||
} else if (type === 'leaveMsg') {
|
||||
msg.guild.settings.set('leaveMsg', message);
|
||||
return msg.say(`Leave Message set to "${message}".`);
|
||||
}
|
||||
|
||||
@@ -7,9 +7,7 @@ module.exports = class ShardInfoCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'shard-info',
|
||||
aliases: [
|
||||
'shard'
|
||||
],
|
||||
aliases: ['shard'],
|
||||
group: 'util',
|
||||
memberName: 'shard-info',
|
||||
description: 'Gives some bot info for the Shard you specify.',
|
||||
@@ -19,7 +17,7 @@ module.exports = class ShardInfoCommand extends Command {
|
||||
prompt: 'Which Shard would you like to get data for?',
|
||||
type: 'integer',
|
||||
validate: shard => {
|
||||
if(shard < this.client.options.shardCount && shard > -1) return true;
|
||||
if (shard < this.client.options.shardCount && shard > -1) return true;
|
||||
return 'Invalid Shard ID';
|
||||
}
|
||||
}
|
||||
@@ -28,8 +26,8 @@ module.exports = class ShardInfoCommand extends Command {
|
||||
}
|
||||
|
||||
async run(msg, args) {
|
||||
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 { shard } = args;
|
||||
const memory = await this.client.shard.broadcastEval('Math.round(process.memoryUsage().heapUsed / 1024 / 1024)');
|
||||
|
||||
@@ -36,19 +36,19 @@ client.registry
|
||||
.registerCommandsIn(path.join(__dirname, 'commands'));
|
||||
|
||||
client.dispatcher.addInhibitor(msg => {
|
||||
if(msg.channel.type === 'dm') return false;
|
||||
if (msg.channel.type === 'dm') return false;
|
||||
const role = msg.guild.settings.get('singleRole');
|
||||
if(!role) return false;
|
||||
if(client.isOwner(msg.author)) return false;
|
||||
if(msg.member.hasPermission('ADMINISTRATOR')) return false;
|
||||
if(!msg.member.roles.has(role))
|
||||
if (!role) return false;
|
||||
if (client.isOwner(msg.author)) return false;
|
||||
if (msg.member.hasPermission('ADMINISTRATOR')) return false;
|
||||
if (!msg.member.roles.has(role))
|
||||
return ['singleRole', msg.reply(`Only the ${msg.guild.roles.get(role).name} role may use commands.`)];
|
||||
});
|
||||
|
||||
client.on('guildMemberAdd', (member) => {
|
||||
const channel = member.guild.channels.get(member.guild.settings.get('memberLog'));
|
||||
if(!channel) return;
|
||||
if(!channel.permissionsFor(client.user).has('SEND_MESSAGES')) return;
|
||||
if (!channel) return;
|
||||
if (!channel.permissionsFor(client.user).has('SEND_MESSAGES')) return;
|
||||
const msg = member.guild.settings.get('joinMsg', 'Welcome <user>!')
|
||||
.replace(/(<user>)/gi, member.user.username)
|
||||
.replace(/(<server>)/gi, member.guild.name)
|
||||
@@ -58,8 +58,8 @@ client.on('guildMemberAdd', (member) => {
|
||||
|
||||
client.on('guildMemberRemove', (member) => {
|
||||
const channel = member.guild.channels.get(member.guild.settings.get('memberLog'));
|
||||
if(!channel) return;
|
||||
if(!channel.permissionsFor(client.user).has('SEND_MESSAGES')) return;
|
||||
if (!channel) return;
|
||||
if (!channel.permissionsFor(client.user).has('SEND_MESSAGES')) return;
|
||||
const msg = member.guild.settings.get('leaveMsg', 'Bye <user>...')
|
||||
.replace(/(<user>)/gi, member.user.username)
|
||||
.replace(/(<server>)/gi, member.guild.name)
|
||||
@@ -67,7 +67,7 @@ client.on('guildMemberRemove', (member) => {
|
||||
return channel.send(msg);
|
||||
});
|
||||
|
||||
client.on('guildCreate', async(guild) => {
|
||||
client.on('guildCreate', async (guild) => {
|
||||
console.log(`[Guild] I have joined ${guild.name}! (${guild.id})`);
|
||||
const guilds = await client.shard.fetchClientValues('guilds.size');
|
||||
const count = guilds.reduce((prev, val) => prev + val, 0);
|
||||
@@ -75,18 +75,18 @@ client.on('guildCreate', async(guild) => {
|
||||
try {
|
||||
await carbon(count);
|
||||
console.log('[Carbon] Successfully posted to Carbon.');
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
console.log(`[Carbon] Failed to post to Carbon. ${err}`);
|
||||
}
|
||||
try {
|
||||
await discordBots(count, client.user.id);
|
||||
console.log('[Discord Bots] Successfully posted to Discord Bots.');
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
console.log(`[Discord Bots] Failed to post to Discord Bots. ${err}`);
|
||||
}
|
||||
});
|
||||
|
||||
client.on('guildDelete', async(guild) => {
|
||||
client.on('guildDelete', async (guild) => {
|
||||
console.log(`[Guild] I have left ${guild.name}... (${guild.id})`);
|
||||
const guilds = await client.shard.fetchClientValues('guilds.size');
|
||||
const count = guilds.reduce((prev, val) => prev + val, 0);
|
||||
@@ -94,13 +94,13 @@ client.on('guildDelete', async(guild) => {
|
||||
try {
|
||||
await carbon(count);
|
||||
console.log('[Carbon] Successfully posted to Carbon.');
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
console.log(`[Carbon] Failed to post to Carbon. ${err}`);
|
||||
}
|
||||
try {
|
||||
await discordBots(count, client.user.id);
|
||||
console.log('[Discord Bots] Successfully posted to Discord Bots.');
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
console.log(`[Discord Bots] Failed to post to Discord Bots. ${err}`);
|
||||
}
|
||||
});
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiaobot",
|
||||
"version": "18.6.2",
|
||||
"version": "18.6.3",
|
||||
"description": "A Discord Bot",
|
||||
"main": "shardingmanager.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -229,7 +229,7 @@ class SequelizeProvider extends SettingProvider {
|
||||
key = JSON.stringify(key);
|
||||
val = typeof val !== 'undefined' ? JSON.stringify(val) : 'undefined';
|
||||
this.client.shard.broadcastEval(`
|
||||
if(this.shard.id !== ${this.client.shard.id} && this.provider && this.provider.settings) {
|
||||
if (this.shard.id !== ${this.client.shard.id} && this.provider && this.provider.settings) {
|
||||
this.provider.settings.global[${key}] = ${val};
|
||||
}
|
||||
`);
|
||||
|
||||
@@ -12,10 +12,10 @@ class Database {
|
||||
.then(() => console.log('[Database] Synchronizing...'))
|
||||
.then(() => database.sync()
|
||||
.then(() => console.log('[Database] Synchronizing complete!'))
|
||||
.catch(err => console.error(`[Database] Error synchronizing: ${err}`))
|
||||
.catch (err => console.error(`[Database] Error synchronizing: ${err}`))
|
||||
)
|
||||
.then(() => console.log('[Database] Ready!'))
|
||||
.catch(err => console.error(`[Database] Unable to connect: ${err}`));
|
||||
.catch (err => console.error(`[Database] Unable to connect: ${err}`));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user