mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Make Code Prettier
This commit is contained in:
@@ -22,12 +22,12 @@ module.exports = class YearsCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||||
const { user } = args;
|
const { user } = args;
|
||||||
const avatarURL = user.avatarURL('png', 2048);
|
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 = [];
|
let images = [];
|
||||||
images.push(Jimp.read(avatarURL));
|
images.push(Jimp.read(avatarURL));
|
||||||
images.push(Jimp.read('https://i.imgur.com/eScwGFS.png'));
|
images.push(Jimp.read('https://i.imgur.com/eScwGFS.png'));
|
||||||
@@ -35,8 +35,8 @@ module.exports = class YearsCommand extends Command {
|
|||||||
avatar.resize(200, 200);
|
avatar.resize(200, 200);
|
||||||
az.composite(avatar, 461, 127);
|
az.composite(avatar, 461, 127);
|
||||||
az.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
az.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||||
if (err) return msg.say('An Unknown Error Occurred.');
|
if(err) return msg.say('An Unknown Error Occurred.');
|
||||||
return msg.channel.send({files: [{attachment: buff}]})
|
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}`));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ module.exports = class BeautifulCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||||
const { user } = args;
|
const { user } = args;
|
||||||
const avatarURL = user.avatarURL('png', 2048);
|
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 = [];
|
let images = [];
|
||||||
images.push(Jimp.read(avatarURL));
|
images.push(Jimp.read(avatarURL));
|
||||||
images.push(Jimp.read('https://i.imgur.com/71qLwPf.png'));
|
images.push(Jimp.read('https://i.imgur.com/71qLwPf.png'));
|
||||||
@@ -36,8 +36,8 @@ module.exports = class BeautifulCommand extends Command {
|
|||||||
grunkle.composite(avatar, 341, 35);
|
grunkle.composite(avatar, 341, 35);
|
||||||
grunkle.composite(avatar, 342, 301);
|
grunkle.composite(avatar, 342, 301);
|
||||||
grunkle.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
grunkle.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||||
if (err) return msg.say('An Unknown Error Occurred.');
|
if(err) return msg.say('An Unknown Error Occurred.');
|
||||||
return msg.channel.send({files: [{attachment: buff}]})
|
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}`));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,12 +22,12 @@ module.exports = class BobRossCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||||
const { user } = args;
|
const { user } = args;
|
||||||
const avatarURL = user.avatarURL('png', 2048);
|
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);
|
const blank = new Jimp(600, 775, 0xFFFFFFFF);
|
||||||
let images = [];
|
let images = [];
|
||||||
images.push(Jimp.read(avatarURL));
|
images.push(Jimp.read(avatarURL));
|
||||||
@@ -38,8 +38,8 @@ module.exports = class BobRossCommand extends Command {
|
|||||||
blank.composite(avatar, 44, 85);
|
blank.composite(avatar, 44, 85);
|
||||||
blank.composite(bob, 0, 0);
|
blank.composite(bob, 0, 0);
|
||||||
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||||
if (err) return msg.say('An Unknown Error Occurred.');
|
if(err) return msg.say('An Unknown Error Occurred.');
|
||||||
return msg.channel.send({files: [{attachment: buff}]})
|
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}`));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,17 +19,17 @@ module.exports = class GreyscaleCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||||
const { user } = args;
|
const { user } = args;
|
||||||
const avatarURL = user.avatarURL('png', 2048);
|
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);
|
const avatar = await Jimp.read(avatarURL);
|
||||||
avatar.greyscale();
|
avatar.greyscale();
|
||||||
avatar.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
avatar.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||||
if (err) return msg.say('An Unknown Error Occurred.');
|
if(err) return msg.say('An Unknown Error Occurred.');
|
||||||
return msg.channel.send({files: [{attachment: buff}]})
|
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,17 +19,17 @@ module.exports = class InvertCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||||
const { user } = args;
|
const { user } = args;
|
||||||
const avatarURL = user.avatarURL('png', 2048);
|
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);
|
const avatar = await Jimp.read(avatarURL);
|
||||||
avatar.invert();
|
avatar.invert();
|
||||||
avatar.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
avatar.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||||
if (err) return msg.say('An Unknown Error Occurred.');
|
if(err) return msg.say('An Unknown Error Occurred.');
|
||||||
return msg.channel.send({files: [{attachment: buff}]})
|
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}`));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ module.exports = class RIPCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||||
const { user } = args;
|
const { user } = args;
|
||||||
const avatarURL = user.avatarURL('png', 2048);
|
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 = [];
|
let images = [];
|
||||||
images.push(Jimp.read(avatarURL));
|
images.push(Jimp.read(avatarURL));
|
||||||
images.push(Jimp.read('https://i.imgur.com/KriteWm.jpg'));
|
images.push(Jimp.read('https://i.imgur.com/KriteWm.jpg'));
|
||||||
@@ -37,8 +37,8 @@ module.exports = class RIPCommand extends Command {
|
|||||||
avatar.resize(200, 200);
|
avatar.resize(200, 200);
|
||||||
grave.composite(avatar, 158, 51);
|
grave.composite(avatar, 158, 51);
|
||||||
grave.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
grave.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||||
if (err) return msg.say('An Unknown Error Occurred.');
|
if(err) return msg.say('An Unknown Error Occurred.');
|
||||||
return msg.channel.send({files: [{attachment: buff}]})
|
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}`));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,13 +22,13 @@ module.exports = class SteamCardCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||||
const { user } = args;
|
const { user } = args;
|
||||||
const username = msg.guild ? msg.guild.member(user).displayName : user.username;
|
const username = msg.guild ? msg.guild.member(user).displayName : user.username;
|
||||||
const avatarURL = user.avatarURL('png', 2048);
|
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);
|
const blank = new Jimp(494, 568, 0xFFFFFFFF);
|
||||||
let images = [];
|
let images = [];
|
||||||
images.push(Jimp.read(avatarURL));
|
images.push(Jimp.read(avatarURL));
|
||||||
@@ -40,8 +40,8 @@ module.exports = class SteamCardCommand extends Command {
|
|||||||
blank.composite(card, 0, 0);
|
blank.composite(card, 0, 0);
|
||||||
blank.print(font, 38, 20, username);
|
blank.print(font, 38, 20, username);
|
||||||
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||||
if (err) return msg.say('An Unknown Error Occurred.');
|
if(err) return msg.say('An Unknown Error Occurred.');
|
||||||
return msg.channel.send({files: [{attachment: buff}]})
|
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) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||||
const { user } = args;
|
const { user } = args;
|
||||||
const avatarURL = user.avatarURL('png', 2048);
|
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);
|
const blank = new Jimp(320, 371, 0xFFFFFFFF);
|
||||||
let images = [];
|
let images = [];
|
||||||
images.push(Jimp.read(avatarURL));
|
images.push(Jimp.read(avatarURL));
|
||||||
@@ -34,8 +34,8 @@ module.exports = class TriggeredCommand extends Command {
|
|||||||
blank.composite(avatar, 0, 0);
|
blank.composite(avatar, 0, 0);
|
||||||
blank.composite(triggered, 0, 0);
|
blank.composite(triggered, 0, 0);
|
||||||
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||||
if (err) return msg.say('An Unknown Error Occurred.');
|
if(err) return msg.say('An Unknown Error Occurred.');
|
||||||
return msg.channel.send({files: [{attachment: buff}]})
|
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) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||||
const { user } = args;
|
const { user } = args;
|
||||||
const avatarURL = user.avatarURL('png', 2048);
|
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 = [];
|
let images = [];
|
||||||
images.push(Jimp.read(avatarURL));
|
images.push(Jimp.read(avatarURL));
|
||||||
images.push(Jimp.read('https://i.imgur.com/ca09TG5.jpg'));
|
images.push(Jimp.read('https://i.imgur.com/ca09TG5.jpg'));
|
||||||
@@ -32,8 +32,8 @@ module.exports = class WantedCommand extends Command {
|
|||||||
avatar.resize(500, 500);
|
avatar.resize(500, 500);
|
||||||
wanted.composite(avatar, 189, 438);
|
wanted.composite(avatar, 189, 438);
|
||||||
wanted.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
wanted.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||||
if (err) return msg.say('An Unknown Error Occurred.');
|
if(err) return msg.say('An Unknown Error Occurred.');
|
||||||
return msg.channel.send({files: [{attachment: buff}]})
|
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,8 +12,7 @@ module.exports = class LotteryCommand extends Command {
|
|||||||
|
|
||||||
run(msg) {
|
run(msg) {
|
||||||
const lottery = Math.floor(Math.random() * 100) + 1;
|
const lottery = Math.floor(Math.random() * 100) + 1;
|
||||||
if (lottery < 99)
|
if(lottery < 99) return msg.say(`Nope, sorry ${msg.author.username}, you lost.`);
|
||||||
return msg.say(`Nope, sorry ${msg.author.username}, you lost.`);
|
|
||||||
return msg.say(`Wow ${msg.author.username}! You actually won! Great job!`);
|
return msg.say(`Wow ${msg.author.username}! You actually won! Great job!`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ module.exports = class MathGameCommand extends Command {
|
|||||||
prompt: 'What should the difficulty of the math game be? `Easy`, `Medium`, `Hard`, `Extreme`, or `Impossible`?',
|
prompt: 'What should the difficulty of the math game be? `Easy`, `Medium`, `Hard`, `Extreme`, or `Impossible`?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: difficulty => {
|
validate: difficulty => {
|
||||||
if (['easy', 'medium', 'hard', 'extreme', 'impossible'].includes(difficulty.toLowerCase()))
|
if(['easy', 'medium', 'hard', 'extreme', 'impossible'].includes(difficulty.toLowerCase()))
|
||||||
return true;
|
return true;
|
||||||
return 'Please set the difficulty to either `easy`, `medium`, `hard`, `extreme`, or `impossible`.';
|
return 'Please set the difficulty to either `easy`, `medium`, `hard`, `extreme`, or `impossible`.';
|
||||||
},
|
},
|
||||||
@@ -28,13 +28,13 @@ module.exports = class MathGameCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { difficulty } = args;
|
const { difficulty } = args;
|
||||||
const operation = operations[Math.floor(Math.random() * operations.length)];
|
const operation = operations[Math.floor(Math.random() * operations.length)];
|
||||||
let value;
|
let value;
|
||||||
switch (difficulty) {
|
switch(difficulty) {
|
||||||
case 'easy':
|
case 'easy':
|
||||||
value = 10;
|
value = 10;
|
||||||
break;
|
break;
|
||||||
@@ -63,13 +63,13 @@ module.exports = class MathGameCommand extends Command {
|
|||||||
time: 10000,
|
time: 10000,
|
||||||
errors: ['time']
|
errors: ['time']
|
||||||
});
|
});
|
||||||
if (collected.first().content !== solved)
|
if(collected.first().content !== solved)
|
||||||
return msg.say(stripIndents`
|
return msg.say(stripIndents`
|
||||||
Aw... Too bad, try again next time!
|
Aw... Too bad, try again next time!
|
||||||
The correct answer is: ${solved}
|
The correct answer is: ${solved}
|
||||||
`);
|
`);
|
||||||
return msg.say(`Good Job! You won! ${solved} is the correct answer!`);
|
return msg.say(`Good Job! You won! ${solved} is the correct answer!`);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say(stripIndents`
|
return msg.say(stripIndents`
|
||||||
Aw... Too bad, try again next time!
|
Aw... Too bad, try again next time!
|
||||||
The correct answer is: ${solved}
|
The correct answer is: ${solved}
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ module.exports = class QuizCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg) {
|
async run(msg) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
try {
|
try {
|
||||||
const { body } = await request
|
const { body } = await request
|
||||||
@@ -37,16 +37,16 @@ module.exports = class QuizCommand extends Command {
|
|||||||
time: 15000,
|
time: 15000,
|
||||||
errors: ['time']
|
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(`The correct answer is: ${answer}`);
|
||||||
return msg.say(`Perfect! The correct answer is: ${answer}`);
|
return msg.say(`Perfect! The correct answer is: ${answer}`);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say(stripIndents`
|
return msg.say(stripIndents`
|
||||||
Aw... Too bad, try again next time!
|
Aw... Too bad, try again next time!
|
||||||
The Correct Answer was: ${answer}
|
The Correct Answer was: ${answer}
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Unknown Error Occurred.');
|
return msg.say('An Unknown Error Occurred.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ module.exports = class RockPaperScissorsCommand extends Command {
|
|||||||
prompt: '`Rock`, `Paper`, or `Scissors`?',
|
prompt: '`Rock`, `Paper`, or `Scissors`?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: choice => {
|
validate: choice => {
|
||||||
if (['rock', 'paper', 'scissors'].includes(choice.toLowerCase()))
|
if(['rock', 'paper', 'scissors'].includes(choice.toLowerCase()))
|
||||||
return true;
|
return true;
|
||||||
return 'Please enter either `rock`, `paper`, or `scissors`.';
|
return 'Please enter either `rock`, `paper`, or `scissors`.';
|
||||||
},
|
},
|
||||||
@@ -30,26 +30,26 @@ module.exports = class RockPaperScissorsCommand extends Command {
|
|||||||
run(msg, args) {
|
run(msg, args) {
|
||||||
const { choice } = args;
|
const { choice } = args;
|
||||||
const response = responses[Math.floor(Math.random() * responses.length)];
|
const response = responses[Math.floor(Math.random() * responses.length)];
|
||||||
if (choice === 'rock') {
|
if(choice === 'rock') {
|
||||||
if (response === 'Rock')
|
if(response === 'Rock')
|
||||||
return msg.say('Rock! Aw, it\'s a tie!');
|
return msg.say('Rock! Aw, it\'s a tie!');
|
||||||
if (response === 'Paper')
|
if(response === 'Paper')
|
||||||
return msg.say('Paper! Yes! I win!');
|
return msg.say('Paper! Yes! I win!');
|
||||||
if (response === 'Scissors')
|
if(response === 'Scissors')
|
||||||
return msg.say('Scissors! Aw... I lose...');
|
return msg.say('Scissors! Aw... I lose...');
|
||||||
} else if (choice === 'paper') {
|
} else if(choice === 'paper') {
|
||||||
if (response === 'Rock')
|
if(response === 'Rock')
|
||||||
return msg.say('Rock! Aw... I lose...');
|
return msg.say('Rock! Aw... I lose...');
|
||||||
if (response === 'Paper')
|
if(response === 'Paper')
|
||||||
return msg.say('Paper! Aw, it\'s a tie!');
|
return msg.say('Paper! Aw, it\'s a tie!');
|
||||||
if (response === 'Scissors')
|
if(response === 'Scissors')
|
||||||
return msg.say('Scissors! Yes! I win!');
|
return msg.say('Scissors! Yes! I win!');
|
||||||
} else if (choice === 'scissors') {
|
} else if(choice === 'scissors') {
|
||||||
if (response === 'Rock')
|
if(response === 'Rock')
|
||||||
return msg.say('Rock! Yes! I win!');
|
return msg.say('Rock! Yes! I win!');
|
||||||
if (response === 'Paper')
|
if(response === 'Paper')
|
||||||
return msg.say('Paper! Aw... I lose...');
|
return msg.say('Paper! Aw... I lose...');
|
||||||
if (response === 'Scissors')
|
if(response === 'Scissors')
|
||||||
return msg.say('Scissors! Aw, it\'s a tie!');
|
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 slotOne = slotThing[Math.floor(Math.random() * slotThing.length)];
|
||||||
const slotTwo = 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)];
|
const slotThree = slotThing[Math.floor(Math.random() * slotThing.length)];
|
||||||
if (slotOne === slotTwo && slotOne === slotThree)
|
if(slotOne === slotTwo && slotOne === slotThree)
|
||||||
return msg.say(stripIndents`
|
return msg.say(stripIndents`
|
||||||
${slotOne}|${slotTwo}|${slotThree}
|
${slotOne}|${slotTwo}|${slotThree}
|
||||||
Wow! You won! Great job... er... luck!
|
Wow! You won! Great job... er... luck!
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ module.exports = class TypingGameCommand extends Command {
|
|||||||
prompt: 'What should the difficulty of the typing game be? `Easy`, `Medium`, `Hard`, `Extreme`, or `Impossible`?',
|
prompt: 'What should the difficulty of the typing game be? `Easy`, `Medium`, `Hard`, `Extreme`, or `Impossible`?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: difficulty => {
|
validate: difficulty => {
|
||||||
if (['easy', 'medium', 'hard', 'extreme', 'impossible'].includes(difficulty.toLowerCase()))
|
if(['easy', 'medium', 'hard', 'extreme', 'impossible'].includes(difficulty.toLowerCase()))
|
||||||
return true;
|
return true;
|
||||||
return 'Please set the difficulty to either `easy`, `medium`, `hard`, `extreme`, or `impossible`.';
|
return 'Please set the difficulty to either `easy`, `medium`, `hard`, `extreme`, or `impossible`.';
|
||||||
},
|
},
|
||||||
@@ -26,13 +26,13 @@ module.exports = class TypingGameCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { difficulty } = args;
|
const { difficulty } = args;
|
||||||
const sentence = sentences[Math.floor(Math.random() * sentences.length)];
|
const sentence = sentences[Math.floor(Math.random() * sentences.length)];
|
||||||
let time;
|
let time;
|
||||||
switch (difficulty) {
|
switch(difficulty) {
|
||||||
case 'easy':
|
case 'easy':
|
||||||
time = 25000;
|
time = 25000;
|
||||||
break;
|
break;
|
||||||
@@ -59,10 +59,10 @@ module.exports = class TypingGameCommand extends Command {
|
|||||||
time: time,
|
time: time,
|
||||||
errors: ['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('Nope, your sentence does not match the original. Try again next time!');
|
||||||
return msg.say(`Good Job! You won!`);
|
return msg.say(`Good Job! You won!`);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('Aw... Too bad, try again next time!');
|
return msg.say('Aw... Too bad, try again next time!');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ module.exports = class GuildInfoCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run(msg) {
|
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const embed = new RichEmbed()
|
const embed = new RichEmbed()
|
||||||
.setColor(0x00AE86)
|
.setColor(0x00AE86)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ module.exports = class MemeCommand extends Command {
|
|||||||
prompt: 'What meme type do you want to use?',
|
prompt: 'What meme type do you want to use?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: type => {
|
validate: type => {
|
||||||
if (codes.includes(type.toLowerCase()))
|
if(codes.includes(type.toLowerCase()))
|
||||||
return true;
|
return true;
|
||||||
return `${type.toLowerCase()} is not a valid meme type. Use \`help meme\` to view a list of types.`;
|
return `${type.toLowerCase()} is not a valid meme type. Use \`help meme\` to view a list of types.`;
|
||||||
},
|
},
|
||||||
@@ -26,7 +26,7 @@ module.exports = class MemeCommand extends Command {
|
|||||||
prompt: 'What should the top row of the meme to be?',
|
prompt: 'What should the top row of the meme to be?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: top => {
|
validate: top => {
|
||||||
if (/[a-zA-Z0-9.,!?'\s]+$/g.test(top) && top.length < 100)
|
if(/[a-zA-Z0-9.,!?'\s]+$/g.test(top) && top.length < 100)
|
||||||
return true;
|
return true;
|
||||||
return `Please do not use special characters and keep the rows under 100 characters each, top row has ${top.length}.`;
|
return `Please do not use special characters and keep the rows under 100 characters each, top row has ${top.length}.`;
|
||||||
},
|
},
|
||||||
@@ -37,7 +37,7 @@ module.exports = class MemeCommand extends Command {
|
|||||||
prompt: 'What should the bottom row of the meme to be?',
|
prompt: 'What should the bottom row of the meme to be?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: bottom => {
|
validate: bottom => {
|
||||||
if (/[a-zA-Z0-9.,!?'\s]+$/g.test(bottom) && bottom.length < 100)
|
if(/[a-zA-Z0-9.,!?'\s]+$/g.test(bottom) && bottom.length < 100)
|
||||||
return true;
|
return true;
|
||||||
return `Please do not use special characters and keep the rows under 100 characters each, bottom row has ${bottom.length}.`;
|
return `Please do not use special characters and keep the rows under 100 characters each, bottom row has ${bottom.length}.`;
|
||||||
},
|
},
|
||||||
@@ -48,11 +48,11 @@ module.exports = class MemeCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run(msg, args) {
|
run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||||
const { type, top, bottom } = args;
|
const { type, top, bottom } = args;
|
||||||
return msg.channel.send({files: [`https://memegen.link/${type}/${top}/${bottom}.jpg`]})
|
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}`));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ module.exports = class BanCommand extends Command {
|
|||||||
prompt: 'What do you want to set the reason as?',
|
prompt: 'What do you want to set the reason as?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: reason => {
|
validate: reason => {
|
||||||
if (reason.length < 140) {
|
if(reason.length < 140) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return `Please keep your reason under 140 characters, you have ${reason.length}.`;
|
return `Please keep your reason under 140 characters, you have ${reason.length}.`;
|
||||||
@@ -39,15 +39,15 @@ module.exports = class BanCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
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.');
|
return msg.say('This Command requires the `Ban Members` Permission.');
|
||||||
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
|
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
|
||||||
if (!modlogs)
|
if(!modlogs)
|
||||||
return msg.say('This Command requires a channel set with the `modchannel` command.');
|
return msg.say('This Command requires a channel set with the `modchannel` command.');
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { member, reason } = args;
|
const { member, reason } = args;
|
||||||
if (!member.bannable)
|
if(!member.bannable)
|
||||||
return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
|
return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
@@ -55,13 +55,10 @@ module.exports = class BanCommand extends Command {
|
|||||||
You were banned from ${msg.guild.name}!
|
You were banned from ${msg.guild.name}!
|
||||||
Reason: ${reason}.
|
Reason: ${reason}.
|
||||||
`);
|
`);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
await msg.say('Failed to send DM to user.');
|
await msg.say('Failed to send DM to user.');
|
||||||
}
|
}
|
||||||
await member.ban({
|
await member.ban({ days: 7, reason });
|
||||||
days: 7,
|
|
||||||
reason
|
|
||||||
});
|
|
||||||
await msg.say(':ok_hand:');
|
await msg.say(':ok_hand:');
|
||||||
const embed = new RichEmbed()
|
const embed = new RichEmbed()
|
||||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||||
@@ -72,8 +69,8 @@ module.exports = class BanCommand extends Command {
|
|||||||
**Action:** Ban
|
**Action:** Ban
|
||||||
**Reason:** ${reason}
|
**Reason:** ${reason}
|
||||||
`);
|
`);
|
||||||
return modlogs.send({embed});
|
return modlogs.send({ embed });
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Unknown Error Occurred.');
|
return msg.say('An Unknown Error Occurred.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ module.exports = class KickCommand extends Command {
|
|||||||
prompt: 'What do you want to set the reason as?',
|
prompt: 'What do you want to set the reason as?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: reason => {
|
validate: reason => {
|
||||||
if (reason.length < 140) {
|
if(reason.length < 140) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return `Please keep your reason under 140 characters, you have ${reason.length}.`;
|
return `Please keep your reason under 140 characters, you have ${reason.length}.`;
|
||||||
@@ -36,15 +36,15 @@ module.exports = class KickCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
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.');
|
return msg.say('This Command requires the `Kick Members` Permission.');
|
||||||
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
|
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
|
||||||
if (!modlogs)
|
if(!modlogs)
|
||||||
return msg.say('This Command requires a channel set with the `modchannel` command.');
|
return msg.say('This Command requires a channel set with the `modchannel` command.');
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { member, reason } = args;
|
const { member, reason } = args;
|
||||||
if (!member.kickable)
|
if(!member.kickable)
|
||||||
return msg.say('This member is not kickable. Perhaps they have a higher role than me?');
|
return msg.say('This member is not kickable. Perhaps they have a higher role than me?');
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
@@ -52,12 +52,10 @@ module.exports = class KickCommand extends Command {
|
|||||||
You were kicked from ${msg.guild.name}!
|
You were kicked from ${msg.guild.name}!
|
||||||
Reason: ${reason}.
|
Reason: ${reason}.
|
||||||
`);
|
`);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
await msg.say('Failed to send DM.');
|
await msg.say('Failed to send DM.');
|
||||||
}
|
}
|
||||||
await member.kick({
|
await member.kick({ reason });
|
||||||
reason
|
|
||||||
});
|
|
||||||
await msg.say(':ok_hand:');
|
await msg.say(':ok_hand:');
|
||||||
const embed = new RichEmbed()
|
const embed = new RichEmbed()
|
||||||
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
|
||||||
@@ -68,8 +66,8 @@ module.exports = class KickCommand extends Command {
|
|||||||
**Action:** Kick
|
**Action:** Kick
|
||||||
**Reason:** ${reason}
|
**Reason:** ${reason}
|
||||||
`);
|
`);
|
||||||
return modlogs.send({embed});
|
return modlogs.send({ embed });
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Unknown Error Occurred.');
|
return msg.say('An Unknown Error Occurred.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
const { Command } = require('discord.js-commando');
|
const { Command } = require('discord.js-commando');
|
||||||
|
const { stripIndents } = require('common-tags');
|
||||||
|
|
||||||
module.exports = class LockdownCommand extends Command {
|
module.exports = class LockdownCommand extends Command {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
@@ -14,7 +15,7 @@ module.exports = class LockdownCommand extends Command {
|
|||||||
prompt: 'Please enter either `start` or `stop`.',
|
prompt: 'Please enter either `start` or `stop`.',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: type => {
|
validate: type => {
|
||||||
if (['start', 'stop'].includes(type.toLowerCase()))
|
if(['start', 'stop'].includes(type.toLowerCase()))
|
||||||
return true;
|
return true;
|
||||||
return 'Please enter either `start` or `stop`.';
|
return 'Please enter either `start` or `stop`.';
|
||||||
},
|
},
|
||||||
@@ -29,25 +30,24 @@ module.exports = class LockdownCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
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.');
|
return msg.say('This Command requires the `Administrator` Permission.');
|
||||||
const { type } = args;
|
const { type } = args;
|
||||||
if (type === 'start') {
|
if(type === 'start') {
|
||||||
try {
|
try {
|
||||||
await msg.channel.overwritePermissions(msg.guild.defaultRole, {
|
await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: false });
|
||||||
SEND_MESSAGES: false
|
return msg.say(stripIndents`
|
||||||
});
|
Lockdown Started, users without Administrator can no longer post messages.
|
||||||
return msg.say('Lockdown Started, users without Administrator can no longer post messages. Please use `;lockdown stop` to end the lockdown.');
|
Please use \`;lockdown stop\` to end the lockdown.
|
||||||
} catch (err) {
|
`);
|
||||||
|
} catch(err) {
|
||||||
return msg.say('Something went wrong!');
|
return msg.say('Something went wrong!');
|
||||||
}
|
}
|
||||||
} else if (type === 'stop') {
|
} else if(type === 'stop') {
|
||||||
try {
|
try {
|
||||||
await msg.channel.overwritePermissions(msg.guild.defaultRole, {
|
await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: true });
|
||||||
SEND_MESSAGES: true
|
|
||||||
});
|
|
||||||
return msg.say('Lockdown Ended, users without Administrator can now post messages.');
|
return msg.say('Lockdown Ended, users without Administrator can now post messages.');
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Unknown Error Occurred.');
|
return msg.say('An Unknown Error Occurred.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ module.exports = class PruneCommand extends Command {
|
|||||||
prompt: 'How many messages do you want to delete? Limit of up to 99.',
|
prompt: 'How many messages do you want to delete? Limit of up to 99.',
|
||||||
type: 'integer',
|
type: 'integer',
|
||||||
validate: count => {
|
validate: count => {
|
||||||
if (count < 100 && count > 0)
|
if(count < 100 && count > 0)
|
||||||
return true;
|
return true;
|
||||||
return `${count} is not a valid amount of messages. Limit 1-99.`;
|
return `${count} is not a valid amount of messages. Limit 1-99.`;
|
||||||
}
|
}
|
||||||
@@ -33,18 +33,16 @@ module.exports = class PruneCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
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.');
|
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.');
|
return msg.say('This Command requires the `Manage Messages` Permission.');
|
||||||
const { count } = args;
|
const { count } = args;
|
||||||
try {
|
try {
|
||||||
const messages = await msg.channel.fetchMessages({
|
const messages = await msg.channel.fetchMessages({ limit: count + 1 });
|
||||||
limit: count + 1
|
|
||||||
});
|
|
||||||
await msg.channel.bulkDelete(messages, true);
|
await msg.channel.bulkDelete(messages, true);
|
||||||
return null;
|
return null;
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('There are no messages younger than two weeks that can be deleted.');
|
return msg.say('There are no messages younger than two weeks that can be deleted.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ module.exports = class SoftbanCommand extends Command {
|
|||||||
prompt: 'What do you want to set the reason as?',
|
prompt: 'What do you want to set the reason as?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: reason => {
|
validate: reason => {
|
||||||
if (reason.length < 140) {
|
if(reason.length < 140) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return `Please keep your reason under 140 characters, you have ${reason.length}.`;
|
return `Please keep your reason under 140 characters, you have ${reason.length}.`;
|
||||||
@@ -36,17 +36,17 @@ module.exports = class SoftbanCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
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.');
|
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.');
|
return msg.say('This Command requires the `Kick Members` Permission.');
|
||||||
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
|
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
|
||||||
if (!modlogs)
|
if(!modlogs)
|
||||||
return msg.say('This Command requires a channel set with the `modchannel` command.');
|
return msg.say('This Command requires a channel set with the `modchannel` command.');
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { member, reason } = args;
|
const { member, reason } = args;
|
||||||
if (!member.bannable)
|
if(!member.bannable)
|
||||||
return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
|
return msg.say('This member is not bannable. Perhaps they have a higher role than me?');
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
@@ -54,13 +54,10 @@ module.exports = class SoftbanCommand extends Command {
|
|||||||
You were softbanned from ${msg.guild.name}!
|
You were softbanned from ${msg.guild.name}!
|
||||||
Reason: ${reason}.
|
Reason: ${reason}.
|
||||||
`);
|
`);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
await msg.say('Failed to send DM to user.');
|
await msg.say('Failed to send DM to user.');
|
||||||
}
|
}
|
||||||
await member.ban({
|
await member.ban({ days: 7, reason });
|
||||||
days: 7,
|
|
||||||
reason
|
|
||||||
});
|
|
||||||
await msg.guild.unban(member.user);
|
await msg.guild.unban(member.user);
|
||||||
await msg.say(':ok_hand:');
|
await msg.say(':ok_hand:');
|
||||||
const embed = new RichEmbed()
|
const embed = new RichEmbed()
|
||||||
@@ -72,8 +69,8 @@ module.exports = class SoftbanCommand extends Command {
|
|||||||
**Action:** Softban
|
**Action:** Softban
|
||||||
**Reason:** ${reason}
|
**Reason:** ${reason}
|
||||||
`);
|
`);
|
||||||
return modlogs.send({embed});
|
return modlogs.send({ embed });
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Unknown Error Occurred.');
|
return msg.say('An Unknown Error Occurred.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ module.exports = class UnbanCommand extends Command {
|
|||||||
prompt: 'What member do you want to unban? Please enter the ID of the user.',
|
prompt: 'What member do you want to unban? Please enter the ID of the user.',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: id => {
|
validate: id => {
|
||||||
if (id.length === 18)
|
if(id.length === 18)
|
||||||
return true;
|
return true;
|
||||||
return `${id} is not a valid ID. Please enter the user you wish to unban's ID.`;
|
return `${id} is not a valid ID. Please enter the user you wish to unban's ID.`;
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@ module.exports = class UnbanCommand extends Command {
|
|||||||
prompt: 'What do you want to set the reason as?',
|
prompt: 'What do you want to set the reason as?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: reason => {
|
validate: reason => {
|
||||||
if (reason.length < 140)
|
if(reason.length < 140)
|
||||||
return true;
|
return true;
|
||||||
return `Please keep your reason under 140 characters, you have ${reason.length}.`;
|
return `Please keep your reason under 140 characters, you have ${reason.length}.`;
|
||||||
}
|
}
|
||||||
@@ -43,16 +43,16 @@ module.exports = class UnbanCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
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.');
|
return msg.say('This Command requires the `Ban Members` Permission.');
|
||||||
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog', 'mod_logs'));
|
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog', 'mod_logs'));
|
||||||
if (!modlogs)
|
if(!modlogs)
|
||||||
return msg.say('This Command requires a channel set with the `modchannel` command.');
|
return msg.say('This Command requires a channel set with the `modchannel` command.');
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { id, reason } = args;
|
const { id, reason } = args;
|
||||||
const bans = await msg.guild.fetchBans();
|
const bans = await msg.guild.fetchBans();
|
||||||
if (!bans.has(id))
|
if(!bans.has(id))
|
||||||
return msg.say('This ID is not in the Guild Banlist.');
|
return msg.say('This ID is not in the Guild Banlist.');
|
||||||
const member = bans.get(id);
|
const member = bans.get(id);
|
||||||
try {
|
try {
|
||||||
@@ -67,8 +67,8 @@ module.exports = class UnbanCommand extends Command {
|
|||||||
**Action:** Unban
|
**Action:** Unban
|
||||||
**Reason:** ${reason}
|
**Reason:** ${reason}
|
||||||
`);
|
`);
|
||||||
return modlogs.send({embed});
|
return modlogs.send({ embed });
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Unknown Error Occurred.');
|
return msg.say('An Unknown Error Occurred.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ module.exports = class WarnCommand extends Command {
|
|||||||
prompt: 'What do you want to set the reason as?',
|
prompt: 'What do you want to set the reason as?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: reason => {
|
validate: reason => {
|
||||||
if (reason.length < 140)
|
if(reason.length < 140)
|
||||||
return true;
|
return true;
|
||||||
return `Please keep your reason under 140 characters, you have ${reason.length}.`;
|
return `Please keep your reason under 140 characters, you have ${reason.length}.`;
|
||||||
}
|
}
|
||||||
@@ -36,9 +36,9 @@ module.exports = class WarnCommand extends Command {
|
|||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog', 'mod_logs'));
|
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog', 'mod_logs'));
|
||||||
if (!modlogs)
|
if(!modlogs)
|
||||||
return msg.say('This Command requires a channel set with the `modchannel` command.');
|
return msg.say('This Command requires a channel set with the `modchannel` command.');
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { member, reason } = args;
|
const { member, reason } = args;
|
||||||
try {
|
try {
|
||||||
@@ -52,8 +52,8 @@ module.exports = class WarnCommand extends Command {
|
|||||||
**Action:** Warn
|
**Action:** Warn
|
||||||
**Reason:** ${reason}
|
**Reason:** ${reason}
|
||||||
`);
|
`);
|
||||||
return modlogs.send({embed});
|
return modlogs.send({ embed });
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Unknown Error Occurred.');
|
return msg.say('An Unknown Error Occurred.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ module.exports = class EasterEggCommand extends Command {
|
|||||||
prompt: 'What easter egg do you want to view?',
|
prompt: 'What easter egg do you want to view?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: tag => {
|
validate: tag => {
|
||||||
if (eastereggs[tag.toLowerCase()])
|
if(eastereggs[tag.toLowerCase()])
|
||||||
return true;
|
return true;
|
||||||
return 'Nope, that\'s not a valid easter egg. Try again!';
|
return 'Nope, that\'s not a valid easter egg. Try again!';
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ module.exports = class MathCommand extends Command {
|
|||||||
const solved = math.eval(expression);
|
const solved = math.eval(expression);
|
||||||
return msg.say(solved)
|
return msg.say(solved)
|
||||||
.catch(() => msg.say('Invalid statement.'));
|
.catch(() => msg.say('Invalid statement.'));
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('Invalid statement.');
|
return msg.say('Invalid statement.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,12 +13,12 @@ module.exports = class NitroCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run(msg) {
|
run(msg) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const embed = new RichEmbed()
|
const embed = new RichEmbed()
|
||||||
.setAuthor('Discord Nitro')
|
.setAuthor('Discord Nitro')
|
||||||
.setThumbnail('https://pbs.twimg.com/profile_images/814184180649197568/y2eZcVMq.jpg')
|
.setThumbnail('https://i.imgur.com/wzhMMnl.jpg')
|
||||||
.setColor(0x748BD9)
|
.setColor(0x748BD9)
|
||||||
.setURL('https://discordapp.com/nitro')
|
.setURL('https://discordapp.com/nitro')
|
||||||
.setDescription(stripIndents`
|
.setDescription(stripIndents`
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ module.exports = class SpamCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run(msg) {
|
run(msg) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||||
return msg.channel.send({files: ['https://i.imgur.com/2JFu5xE.jpg']})
|
return msg.channel.send({ files: ['https://i.imgur.com/2JFu5xE.jpg'] })
|
||||||
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
.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?',
|
prompt: 'What would you like the title of the Strawpoll to be?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: title => {
|
validate: title => {
|
||||||
if (title.length < 200)
|
if(title.length < 200)
|
||||||
return true;
|
return true;
|
||||||
return `Please keep your title under 200 characters, you have ${title.length}.`;
|
return `Please keep your title under 200 characters, you have ${title.length}.`;
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,7 @@ module.exports = class StrawpollCommand extends Command {
|
|||||||
type: 'string',
|
type: 'string',
|
||||||
infinite: true,
|
infinite: true,
|
||||||
validate: choice => {
|
validate: choice => {
|
||||||
if (choice.length < 160)
|
if(choice.length < 160)
|
||||||
return true;
|
return true;
|
||||||
return `Please keep your options under 160 characters each, you have ${choice.length}.`;
|
return `Please keep your options under 160 characters each, you have ${choice.length}.`;
|
||||||
}
|
}
|
||||||
@@ -37,22 +37,19 @@ module.exports = class StrawpollCommand extends Command {
|
|||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
const { title, options } = args;
|
const { title, options } = args;
|
||||||
if (options.length < 2)
|
if(options.length < 2)
|
||||||
return msg.say('You provided less than two choices.');
|
return msg.say('You provided less than two choices.');
|
||||||
if (options.length > 31)
|
if(options.length > 31)
|
||||||
return msg.say('You provided more than thirty choices.');
|
return msg.say('You provided more than thirty choices.');
|
||||||
try {
|
try {
|
||||||
const { body } = await request
|
const { body } = await request
|
||||||
.post('https://strawpoll.me/api/v2/polls')
|
.post('https://strawpoll.me/api/v2/polls')
|
||||||
.send({
|
.send({ title, options });
|
||||||
title,
|
|
||||||
options
|
|
||||||
});
|
|
||||||
return msg.say(stripIndents`
|
return msg.say(stripIndents`
|
||||||
${body.title}
|
${body.title}
|
||||||
http://strawpoll.me/${body.id}
|
http://strawpoll.me/${body.id}
|
||||||
`);
|
`);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Unknown Error Occurred.');
|
return msg.say('An Unknown Error Occurred.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ module.exports = class TodayCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg) {
|
async run(msg) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
try {
|
try {
|
||||||
const { text } = await request
|
const { text } = await request
|
||||||
@@ -30,7 +30,7 @@ module.exports = class TodayCommand extends Command {
|
|||||||
.setTimestamp()
|
.setTimestamp()
|
||||||
.setDescription(`${events[random].year}: ${events[random].text}`);
|
.setDescription(`${events[random].year}: ${events[random].text}`);
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Unknown Error Occurred.');
|
return msg.say('An Unknown Error Occurred.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ module.exports = class WouldYouRatherCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg) {
|
async run(msg) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
try {
|
try {
|
||||||
const { body } = await request
|
const { body } = await request
|
||||||
@@ -28,7 +28,7 @@ module.exports = class WouldYouRatherCommand extends Command {
|
|||||||
.setColor(0x9797FF)
|
.setColor(0x9797FF)
|
||||||
.setDescription(`${body.choicea} OR ${body.choiceb}?`);
|
.setDescription(`${body.choicea} OR ${body.choiceb}?`);
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Unknown Error Occurred.');
|
return msg.say('An Unknown Error Occurred.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,15 +15,15 @@ module.exports = class CatCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg) {
|
async run(msg) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||||
try {
|
try {
|
||||||
const { body } = await request
|
const { body } = await request
|
||||||
.get('http://random.cat/meow');
|
.get('http://random.cat/meow');
|
||||||
return msg.channel.send({files: [body.file]})
|
return msg.channel.send({ files: [body.file] })
|
||||||
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Unknown Error Occurred.');
|
return msg.say('An Unknown Error Occurred.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,15 +12,15 @@ module.exports = class DogCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg) {
|
async run(msg) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||||
try {
|
try {
|
||||||
const { body } = await request
|
const { body } = await request
|
||||||
.get('https://random.dog/woof.json');
|
.get('https://random.dog/woof.json');
|
||||||
return msg.channel.send({files: [body.url]})
|
return msg.channel.send({ files: [body.url] })
|
||||||
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Unknown Error Occurred.');
|
return msg.say('An Unknown Error Occurred.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ module.exports = class XiaoCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run(msg) {
|
run(msg) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||||
const xiao = xiaos[Math.floor(Math.random() * xiaos.length)];
|
const xiao = xiaos[Math.floor(Math.random() * xiaos.length)];
|
||||||
return msg.channel.send({files: [xiao]})
|
return msg.channel.send({ files: [xiao] })
|
||||||
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module.exports = class RandomNameCommand extends Command {
|
|||||||
prompt: 'Which gender do you want to generate a name for?',
|
prompt: 'Which gender do you want to generate a name for?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: gender => {
|
validate: gender => {
|
||||||
if (['male', 'female'].includes(gender.toLowerCase()))
|
if(['male', 'female'].includes(gender.toLowerCase()))
|
||||||
return true;
|
return true;
|
||||||
return 'Please enter either `male` or `female`.';
|
return 'Please enter either `male` or `female`.';
|
||||||
},
|
},
|
||||||
@@ -27,10 +27,10 @@ module.exports = class RandomNameCommand extends Command {
|
|||||||
run(msg, args) {
|
run(msg, args) {
|
||||||
const { gender } = args;
|
const { gender } = args;
|
||||||
const lastName = lastNames[Math.floor(Math.random() * lastNames.length)];
|
const lastName = lastNames[Math.floor(Math.random() * lastNames.length)];
|
||||||
if (gender === 'male') {
|
if(gender === 'male') {
|
||||||
const name = maleNames[Math.floor(Math.random() * maleNames.length)];
|
const name = maleNames[Math.floor(Math.random() * maleNames.length)];
|
||||||
return msg.say(`${name} ${lastName}`);
|
return msg.say(`${name} ${lastName}`);
|
||||||
} else if (gender === 'female') {
|
} else if(gender === 'female') {
|
||||||
const name = femaleNames[Math.floor(Math.random() * femaleNames.length)];
|
const name = femaleNames[Math.floor(Math.random() * femaleNames.length)];
|
||||||
return msg.say(`${name} ${lastName}`);
|
return msg.say(`${name} ${lastName}`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,21 +20,19 @@ module.exports = class BotSearchCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { bot } = args;
|
const { bot } = args;
|
||||||
try {
|
try {
|
||||||
const { body } = await request
|
const { body } = await request
|
||||||
.get(`https://bots.discord.pw/api/bots/${bot.id}`)
|
.get(`https://bots.discord.pw/api/bots/${bot.id}`)
|
||||||
.set({
|
.set({ 'Authorization': process.env.DISCORD_BOTS_KEY });
|
||||||
'Authorization': process.env.DISCORD_BOTS_KEY
|
|
||||||
});
|
|
||||||
const embed = new RichEmbed()
|
const embed = new RichEmbed()
|
||||||
.setColor(0x9797FF)
|
.setColor(0x9797FF)
|
||||||
.setAuthor('Discord Bots', 'https://cdn.discordapp.com/icons/110373943822540800/47336ad0631ac7aac0a48a2ba6246c65.jpg')
|
.setAuthor('Discord Bots', 'https://i.imgur.com/lrKYBQi.jpg')
|
||||||
.setTitle(body.name)
|
.setTitle(body.name)
|
||||||
.setURL('https://bots.discord.pw/')
|
.setURL(`https://bots.discord.pw/bots/${bot.id}`)
|
||||||
.setDescription(body.description)
|
.setDescription(body.description)
|
||||||
.addField('**Library:**',
|
.addField('**Library:**',
|
||||||
body.library, true)
|
body.library, true)
|
||||||
@@ -43,7 +41,7 @@ module.exports = class BotSearchCommand extends Command {
|
|||||||
.addField('**Prefix:**',
|
.addField('**Prefix:**',
|
||||||
body.prefix, true);
|
body.prefix, true);
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Error Occurred. The bot may not have been found.');
|
return msg.say('An Error Occurred. The bot may not have been found.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ module.exports = class DefineCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { query } = args;
|
const { query } = args;
|
||||||
try {
|
try {
|
||||||
@@ -33,7 +33,7 @@ module.exports = class DefineCommand extends Command {
|
|||||||
.setTitle(body[0].word)
|
.setTitle(body[0].word)
|
||||||
.setDescription(body[0].text);
|
.setDescription(body[0].text);
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Error Occurred. The word may not have been found.');
|
return msg.say('An Error Occurred. The word may not have been found.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ module.exports = class DiscrimCommand extends Command {
|
|||||||
prompt: 'Which discriminator would you like to search for?',
|
prompt: 'Which discriminator would you like to search for?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: discrim => {
|
validate: discrim => {
|
||||||
if (/[0-9]+$/g.test(discrim) && discrim.length === 4)
|
if(/[0-9]+$/g.test(discrim) && discrim.length === 4)
|
||||||
return true;
|
return true;
|
||||||
return `${discrim} is not a valid discriminator.`;
|
return `${discrim} is not a valid discriminator.`;
|
||||||
}
|
}
|
||||||
@@ -28,8 +28,8 @@ module.exports = class DiscrimCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { discrim } = args;
|
const { discrim } = args;
|
||||||
const users = await this.client.users.filter(u => u.discriminator === discrim).map(u => u.username).sort();
|
const users = await this.client.users.filter(u => u.discriminator === discrim).map(u => u.username).sort();
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ module.exports = class ForecastCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { query } = args;
|
const { query } = args;
|
||||||
try {
|
try {
|
||||||
@@ -48,7 +48,7 @@ module.exports = class ForecastCommand extends Command {
|
|||||||
.addField(`**${forecasts[6].day} - ${forecasts[6].date}:**`,
|
.addField(`**${forecasts[6].day} - ${forecasts[6].date}:**`,
|
||||||
`**High:** ${forecasts[6].high}°F, **Low:** ${forecasts[6].low}°F, **Condition:** ${forecasts[6].text}`);
|
`**High:** ${forecasts[6].high}°F, **Low:** ${forecasts[6].low}°F, **Condition:** ${forecasts[6].text}`);
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Error Occurred. The location may not have been found.');
|
return msg.say('An Error Occurred. The location may not have been found.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,10 +29,10 @@ module.exports = class GoogleCommand extends Command {
|
|||||||
.get(`https://www.google.com/search?q=${query}`);
|
.get(`https://www.google.com/search?q=${query}`);
|
||||||
const $ = cheerio.load(text);
|
const $ = cheerio.load(text);
|
||||||
let href = $('.r').first().find('a').first().attr('href');
|
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?', ''));
|
href = querystring.parse(href.replace('/url?', ''));
|
||||||
return message.edit(href.q);
|
return message.edit(href.q);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return message.edit('No Results Found.');
|
return message.edit('No Results Found.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ module.exports = class IMDBCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { query } = args;
|
const { query } = args;
|
||||||
try {
|
try {
|
||||||
@@ -30,7 +30,7 @@ module.exports = class IMDBCommand extends Command {
|
|||||||
.get(`http://www.omdbapi.com/?t=${query}&plot=full`);
|
.get(`http://www.omdbapi.com/?t=${query}&plot=full`);
|
||||||
const embed = new RichEmbed()
|
const embed = new RichEmbed()
|
||||||
.setColor(0xDBA628)
|
.setColor(0xDBA628)
|
||||||
.setAuthor('IMDB', 'http://static.wixstatic.com/media/c65cbf_31901b544fe24f1890134553bf40c8be.png')
|
.setAuthor('IMDB', 'https://i.imgur.com/sXwwIQs.png')
|
||||||
.setURL(`http://www.imdb.com/title/${body.imdbID}`)
|
.setURL(`http://www.imdb.com/title/${body.imdbID}`)
|
||||||
.setTitle(`${body.Title} (${body.imdbRating} Score)`)
|
.setTitle(`${body.Title} (${body.imdbRating} Score)`)
|
||||||
.setDescription(body.Plot.substr(0, 2000))
|
.setDescription(body.Plot.substr(0, 2000))
|
||||||
@@ -49,7 +49,7 @@ module.exports = class IMDBCommand extends Command {
|
|||||||
.addField('**Actors:**',
|
.addField('**Actors:**',
|
||||||
body.Actors);
|
body.Actors);
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Error Occurred. The film may not have been found.');
|
return msg.say('An Error Occurred. The film may not have been found.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.',
|
prompt: 'What would you like the zoom level for the map to be? Limit 1-20.',
|
||||||
type: 'integer',
|
type: 'integer',
|
||||||
validate: zoom => {
|
validate: zoom => {
|
||||||
if (zoom < 21 && zoom > 0)
|
if(zoom < 21 && zoom > 0)
|
||||||
return true;
|
return true;
|
||||||
return 'Please enter a zoom value from 1-20';
|
return 'Please enter a zoom value from 1-20';
|
||||||
}
|
}
|
||||||
@@ -31,16 +31,16 @@ module.exports = class MapCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
if(!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||||
return msg.say('This Command requires the `Attach Files` Permission.');
|
return msg.say('This Command requires the `Attach Files` Permission.');
|
||||||
const { zoom, query } = args;
|
const { zoom, query } = args;
|
||||||
try {
|
try {
|
||||||
const { body } = await request
|
const { body } = await request
|
||||||
.get(`https://maps.googleapis.com/maps/api/staticmap?center=${query}&zoom=${zoom}&size=500x500&key=${process.env.GOOGLE_KEY}`);
|
.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}]})
|
return msg.channel.send({ files: [{attachment: body}] })
|
||||||
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
.catch(err => msg.say(`An Error Occurred: ${err}`));
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Error Occurred. The location may not have been found.');
|
return msg.say('An Error Occurred. The location may not have been found.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,10 +27,10 @@ module.exports = class NeopetCommand extends Command {
|
|||||||
.get(`http://www.sunnyneo.com/petimagefinder.php?name=${query}&size=5&mood=1`);
|
.get(`http://www.sunnyneo.com/petimagefinder.php?name=${query}&size=5&mood=1`);
|
||||||
const $ = cheerio.load(text);
|
const $ = cheerio.load(text);
|
||||||
const link = $('textarea').first().text();
|
const link = $('textarea').first().text();
|
||||||
if (!link.includes('cp'))
|
if(!link.includes('cp'))
|
||||||
return msg.say('This is not a valid pet name.');
|
return msg.say('This is not a valid pet name.');
|
||||||
return msg.say(link);
|
return msg.say(link);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Unknown Error Occurred.');
|
return msg.say('An Unknown Error Occurred.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ module.exports = class OsuCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { query } = args;
|
const { query } = args;
|
||||||
try {
|
try {
|
||||||
@@ -30,7 +30,7 @@ module.exports = class OsuCommand extends Command {
|
|||||||
.get(`https://osu.ppy.sh/api/get_user?k=${process.env.OSU_KEY}&u=${query}&type=string`);
|
.get(`https://osu.ppy.sh/api/get_user?k=${process.env.OSU_KEY}&u=${query}&type=string`);
|
||||||
const embed = new RichEmbed()
|
const embed = new RichEmbed()
|
||||||
.setColor(0xFF66AA)
|
.setColor(0xFF66AA)
|
||||||
.setAuthor('osu!', 'http://vignette3.wikia.nocookie.net/osugame/images/c/c9/Logo.png/revision/latest?cb=20151219073209')
|
.setAuthor('osu!', 'https://i.imgur.com/EmnUp00.png')
|
||||||
.setURL('https://osu.ppy.sh/')
|
.setURL('https://osu.ppy.sh/')
|
||||||
.addField('**Username:**',
|
.addField('**Username:**',
|
||||||
body[0].username, true)
|
body[0].username, true)
|
||||||
@@ -57,7 +57,7 @@ module.exports = class OsuCommand extends Command {
|
|||||||
.addField('**A:**',
|
.addField('**A:**',
|
||||||
body[0].count_rank_a, true);
|
body[0].count_rank_a, true);
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Error Occurred. The user may not have been found.');
|
return msg.say('An Error Occurred. The user may not have been found.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ module.exports = class SoundCloudCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { query } = args;
|
const { query } = args;
|
||||||
try {
|
try {
|
||||||
@@ -30,7 +30,7 @@ module.exports = class SoundCloudCommand extends Command {
|
|||||||
.get(`https://api.soundcloud.com/tracks?q=${query}&client_id=${process.env.SOUNDCLOUD_KEY}`);
|
.get(`https://api.soundcloud.com/tracks?q=${query}&client_id=${process.env.SOUNDCLOUD_KEY}`);
|
||||||
const embed = new RichEmbed()
|
const embed = new RichEmbed()
|
||||||
.setColor(0xF15A22)
|
.setColor(0xF15A22)
|
||||||
.setAuthor(body[0].title, 'http://icons.iconarchive.com/icons/danleech/simple/1024/soundcloud-icon.png')
|
.setAuthor(body[0].title, 'https://i.imgur.com/lFIz7RU.png')
|
||||||
.setURL(body[0].permalink_url)
|
.setURL(body[0].permalink_url)
|
||||||
.setThumbnail(body[0].artwork_url)
|
.setThumbnail(body[0].artwork_url)
|
||||||
.addField('**Artist:**',
|
.addField('**Artist:**',
|
||||||
@@ -44,7 +44,7 @@ module.exports = class SoundCloudCommand extends Command {
|
|||||||
.addField('**Favorited Count:**',
|
.addField('**Favorited Count:**',
|
||||||
body[0].favoritings_count, true);
|
body[0].favoritings_count, true);
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Error Occurred. The song may not have been found.');
|
return msg.say('An Error Occurred. The song may not have been found.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ module.exports = class UrbanCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { query } = args;
|
const { query } = args;
|
||||||
try {
|
try {
|
||||||
@@ -30,14 +30,14 @@ module.exports = class UrbanCommand extends Command {
|
|||||||
.get(`http://api.urbandictionary.com/v0/define?term=${query}`);
|
.get(`http://api.urbandictionary.com/v0/define?term=${query}`);
|
||||||
const embed = new RichEmbed()
|
const embed = new RichEmbed()
|
||||||
.setColor(0x32a8f0)
|
.setColor(0x32a8f0)
|
||||||
.setAuthor('Urban Dictionary', 'http://a1.mzstatic.com/eu/r30/Purple71/v4/66/54/68/6654683f-cacd-4a55-1784-f14257f77874/icon175x175.png')
|
.setAuthor('Urban Dictionary', 'https://i.imgur.com/fzFuuL7.png')
|
||||||
.setURL(body.list[0].permalink)
|
.setURL(body.list[0].permalink)
|
||||||
.setTitle(body.list[0].word)
|
.setTitle(body.list[0].word)
|
||||||
.setDescription(body.list[0].definition.substr(0, 2000))
|
.setDescription(body.list[0].definition.substr(0, 2000))
|
||||||
.addField('**Example:**',
|
.addField('**Example:**',
|
||||||
body.list[0].example.substr(0, 2000) || 'None');
|
body.list[0].example.substr(0, 2000) || 'None');
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Error Occurred. The word may not have been found.');
|
return msg.say('An Error Occurred. The word may not have been found.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,19 +21,17 @@ module.exports = class WattpadCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { query } = args;
|
const { query } = args;
|
||||||
try {
|
try {
|
||||||
const { body } = await request
|
const { body } = await request
|
||||||
.get(`https://api.wattpad.com:443/v4/stories?query=${query}&limit=1`)
|
.get(`https://api.wattpad.com:443/v4/stories?query=${query}&limit=1`)
|
||||||
.set({
|
.set({ 'Authorization': `Basic ${process.env.WATTPAD_KEY}` });
|
||||||
'Authorization': `Basic ${process.env.WATTPAD_KEY}`
|
|
||||||
});
|
|
||||||
const embed = new RichEmbed()
|
const embed = new RichEmbed()
|
||||||
.setColor(0xF89C34)
|
.setColor(0xF89C34)
|
||||||
.setAuthor('Wattpad', 'http://www.selfpubtoolbox.com/wp-content/uploads/2015/05/a6044fd3a88acd5043860484db972ca6.png')
|
.setAuthor('Wattpad', 'https://i.imgur.com/Rw9vRQB.png')
|
||||||
.setURL(body.stories[0].url)
|
.setURL(body.stories[0].url)
|
||||||
.setTitle(body.stories[0].title)
|
.setTitle(body.stories[0].title)
|
||||||
.setDescription(body.stories[0].description.substr(0, 2000))
|
.setDescription(body.stories[0].description.substr(0, 2000))
|
||||||
@@ -50,7 +48,7 @@ module.exports = class WattpadCommand extends Command {
|
|||||||
.addField('**Comments:**',
|
.addField('**Comments:**',
|
||||||
body.stories[0].commentCount, true);
|
body.stories[0].commentCount, true);
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Error Occurred. The book may not have been found.');
|
return msg.say('An Error Occurred. The book may not have been found.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ module.exports = class WeatherCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { query } = args;
|
const { query } = args;
|
||||||
try {
|
try {
|
||||||
@@ -57,7 +57,7 @@ module.exports = class WeatherCommand extends Command {
|
|||||||
.addField('**Wind Speed:**',
|
.addField('**Wind Speed:**',
|
||||||
body.query.results.channel.wind.speed, true);
|
body.query.results.channel.wind.speed, true);
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Error Occurred. The location may not have been found.');
|
return msg.say('An Error Occurred. The location may not have been found.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ module.exports = class WikipediaCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { query } = args;
|
const { query } = args;
|
||||||
try {
|
try {
|
||||||
@@ -32,10 +32,10 @@ module.exports = class WikipediaCommand extends Command {
|
|||||||
.setColor(0xE7E7E7)
|
.setColor(0xE7E7E7)
|
||||||
.setTitle(body.query.pages[0].title)
|
.setTitle(body.query.pages[0].title)
|
||||||
.setURL(`https://en.wikipedia.org/wiki/${query}`)
|
.setURL(`https://en.wikipedia.org/wiki/${query}`)
|
||||||
.setAuthor('Wikipedia', 'https://upload.wikimedia.org/wikipedia/en/thumb/8/80/Wikipedia-logo-v2.svg/1122px-Wikipedia-logo-v2.svg.png')
|
.setAuthor('Wikipedia', 'https://i.imgur.com/a4eeEhh.png')
|
||||||
.setDescription(body.query.pages[0].extract.substr(0, 2000).replace(/[\n]/g, '\n\n'));
|
.setDescription(body.query.pages[0].extract.substr(0, 2000).replace(/[\n]/g, '\n\n'));
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Error Occurred. The page may not have been found.');
|
return msg.say('An Error Occurred. The page may not have been found.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ module.exports = class YouTubeCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { query } = args;
|
const { query } = args;
|
||||||
try {
|
try {
|
||||||
@@ -32,11 +32,11 @@ module.exports = class YouTubeCommand extends Command {
|
|||||||
.setColor(0xDD2825)
|
.setColor(0xDD2825)
|
||||||
.setTitle(body.items[0].snippet.title)
|
.setTitle(body.items[0].snippet.title)
|
||||||
.setDescription(body.items[0].snippet.description)
|
.setDescription(body.items[0].snippet.description)
|
||||||
.setAuthor(`YouTube - ${body.items[0].snippet.channelTitle}`, 'https://cdn3.iconfinder.com/data/icons/social-icons-5/607/YouTube_Play.png')
|
.setAuthor(`YouTube - ${body.items[0].snippet.channelTitle}`, 'https://i.imgur.com/hkUafwu.png')
|
||||||
.setURL(`https://www.youtube.com/watch?v=${body.items[0].id.videoId}`)
|
.setURL(`https://www.youtube.com/watch?v=${body.items[0].id.videoId}`)
|
||||||
.setThumbnail(body.items[0].snippet.thumbnails.default.url);
|
.setThumbnail(body.items[0].snippet.thumbnails.default.url);
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Error Occurred. The video may not have been found.');
|
return msg.say('An Error Occurred. The video may not have been found.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,19 +21,19 @@ module.exports = class YuGiOhCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { query } = args;
|
const { query } = args;
|
||||||
try {
|
try {
|
||||||
const { body } = await request
|
const { body } = await request
|
||||||
.get(`http://yugiohprices.com/api/card_data/${query}`);
|
.get(`http://yugiohprices.com/api/card_data/${query}`);
|
||||||
if (body.data.card_type === 'monster') {
|
if(body.data.card_type === 'monster') {
|
||||||
const embed = new RichEmbed()
|
const embed = new RichEmbed()
|
||||||
.setColor(0xBE5F1F)
|
.setColor(0xBE5F1F)
|
||||||
.setTitle(body.data.name)
|
.setTitle(body.data.name)
|
||||||
.setDescription(body.data.text)
|
.setDescription(body.data.text)
|
||||||
.setAuthor('Yu-Gi-Oh!', 'http://vignette3.wikia.nocookie.net/yugioh/images/1/10/Back-TF-EN-VG.png/revision/latest?cb=20120824043558')
|
.setAuthor('Yu-Gi-Oh!', 'https://i.imgur.com/7gPm9Rr.png')
|
||||||
.addField('**Card Type:**',
|
.addField('**Card Type:**',
|
||||||
'Monster', true)
|
'Monster', true)
|
||||||
.addField('**Type:**',
|
.addField('**Type:**',
|
||||||
@@ -52,11 +52,11 @@ module.exports = class YuGiOhCommand extends Command {
|
|||||||
.setColor(0xBE5F1F)
|
.setColor(0xBE5F1F)
|
||||||
.setTitle(body.data.name)
|
.setTitle(body.data.name)
|
||||||
.setDescription(body.data.text)
|
.setDescription(body.data.text)
|
||||||
.setAuthor('Yu-Gi-Oh!', 'http://vignette3.wikia.nocookie.net/yugioh/images/1/10/Back-TF-EN-VG.png/revision/latest?cb=20120824043558')
|
.setAuthor('Yu-Gi-Oh!', 'https://i.imgur.com/7gPm9Rr.png')
|
||||||
.addField('**Card Type:**',
|
.addField('**Card Type:**',
|
||||||
body.data.card_type, true);
|
body.data.card_type, true);
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Error Occurred. The card may not have been found.');
|
return msg.say('An Error Occurred. The card may not have been found.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ module.exports = class BinaryCommand extends Command {
|
|||||||
prompt: 'What text would you like to convert to binary?',
|
prompt: 'What text would you like to convert to binary?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: text => {
|
validate: text => {
|
||||||
if (binary(text).length < 2000)
|
if(binary(text).length < 2000)
|
||||||
return true;
|
return true;
|
||||||
return 'Your message content is too long.';
|
return 'Your message content is too long.';
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module.exports = class CowsayCommand extends Command {
|
|||||||
prompt: 'What text would you like the cow to say?',
|
prompt: 'What text would you like the cow to say?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: text => {
|
validate: text => {
|
||||||
if (text.length < 1500)
|
if(text.length < 1500)
|
||||||
return true;
|
return true;
|
||||||
return `Please keep your content under 1500 characters, you have ${text.length}.`;
|
return `Please keep your content under 1500 characters, you have ${text.length}.`;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ module.exports = class EmbedCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run(msg, args) {
|
run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { text } = args;
|
const { text } = args;
|
||||||
const embed = new RichEmbed()
|
const embed = new RichEmbed()
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ module.exports = class MorseCommand extends Command {
|
|||||||
prompt: 'What text would you like to convert to morse?',
|
prompt: 'What text would you like to convert to morse?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: text => {
|
validate: text => {
|
||||||
if (letterTrans(text, dictionary, ' ').length < 1999)
|
if(letterTrans(text, dictionary, ' ').length < 1999)
|
||||||
return true;
|
return true;
|
||||||
return 'Your message content is too long.';
|
return 'Your message content is too long.';
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ module.exports = class PirateCommand extends Command {
|
|||||||
prompt: 'What text would you like to convert to pirate?',
|
prompt: 'What text would you like to convert to pirate?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: text => {
|
validate: text => {
|
||||||
if (wordTrans(text, dictionary).length < 1999)
|
if(wordTrans(text, dictionary).length < 1999)
|
||||||
return true;
|
return true;
|
||||||
return 'Your message content is too long.';
|
return 'Your message content is too long.';
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ module.exports = class SayCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run(msg, args) {
|
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.');
|
return msg.say('This Command requires the `Manage Messages` Permission.');
|
||||||
const { text } = args;
|
const { text } = args;
|
||||||
msg.delete();
|
msg.delete();
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ module.exports = class TemmieCommand extends Command {
|
|||||||
prompt: 'What text would you like to convert to Temmie speak?',
|
prompt: 'What text would you like to convert to Temmie speak?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: text => {
|
validate: text => {
|
||||||
if (wordTrans(text, dictionary).length < 1999)
|
if(wordTrans(text, dictionary).length < 1999)
|
||||||
return true;
|
return true;
|
||||||
return 'Your message content is too long.';
|
return 'Your message content is too long.';
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -28,16 +28,16 @@ module.exports = class WebhookCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
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.');
|
return msg.say('This Command requires the `Manage Messages` Permission.');
|
||||||
const { content } = args;
|
const { content } = args;
|
||||||
try {
|
try {
|
||||||
msg.delete();
|
msg.delete();
|
||||||
await request
|
await request
|
||||||
.post(process.env.WEBHOOK_URL)
|
.post(process.env.WEBHOOK_URL)
|
||||||
.send({content});
|
.send({ content });
|
||||||
return null;
|
return null;
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
return msg.say('An Unknown Error Occurred.');
|
return msg.say('An Unknown Error Occurred.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module.exports = class ZalgoCommand extends Command {
|
|||||||
prompt: 'What text would you like to convert to zalgo?',
|
prompt: 'What text would you like to convert to zalgo?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: text => {
|
validate: text => {
|
||||||
if (text.length < 500) {
|
if(text.length < 500) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return `Please keep your text under 500 characters, you have ${text.length}.`;
|
return `Please keep your text under 500 characters, you have ${text.length}.`;
|
||||||
|
|||||||
@@ -28,14 +28,14 @@ module.exports = class UserInfoCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { user } = args;
|
const { user } = args;
|
||||||
const member = await msg.guild.fetchMember(user);
|
const member = msg.guild.member(user);
|
||||||
let stat;
|
let stat;
|
||||||
let color;
|
let color;
|
||||||
switch (user.presence.status) {
|
switch(user.presence.status) {
|
||||||
case 'online':
|
case 'online':
|
||||||
stat = '<:vpOnline:212789758110334977> Online';
|
stat = '<:vpOnline:212789758110334977> Online';
|
||||||
color = 0x00AE86;
|
color = 0x00AE86;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ module.exports = class ClearSettingCommand extends Command {
|
|||||||
prompt: 'What setting do you want to clear? `modLog`, `memberLog`, or `staffRole`?',
|
prompt: 'What setting do you want to clear? `modLog`, `memberLog`, or `staffRole`?',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
validate: setting => {
|
validate: setting => {
|
||||||
if (['modLog', 'memberLog', 'staffRole'].includes(setting))
|
if(['modLog', 'memberLog', 'staffRole'].includes(setting))
|
||||||
return true;
|
return true;
|
||||||
return 'Please enter either `modLog`, `memberLog`, or `staffRole`.';
|
return 'Please enter either `modLog`, `memberLog`, or `staffRole`.';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ module.exports = class HelpCommand extends Command {
|
|||||||
const { command } = args;
|
const { command } = args;
|
||||||
const commands = this.client.registry.findCommands(command, false, msg);
|
const commands = this.client.registry.findCommands(command, false, msg);
|
||||||
const showAll = command && command.toLowerCase() === 'all';
|
const showAll = command && command.toLowerCase() === 'all';
|
||||||
if (command && !showAll) {
|
if(command && !showAll) {
|
||||||
if (commands.length === 1) {
|
if(commands.length === 1) {
|
||||||
return msg.say(stripIndents`
|
return msg.say(stripIndents`
|
||||||
__Command **${commands[0].name}**:__ *${commands[0].description}*
|
__Command **${commands[0].name}**:__ *${commands[0].description}*
|
||||||
${commands[0].guildOnly ? 'Usable Only in Servers' : 'Usable in Servers and DM'}
|
${commands[0].guildOnly ? 'Usable Only in Servers' : 'Usable in Servers and DM'}
|
||||||
@@ -38,17 +38,15 @@ module.exports = class HelpCommand extends Command {
|
|||||||
**Group:** ${commands[0].group.name}
|
**Group:** ${commands[0].group.name}
|
||||||
${commands[0].details || ''}
|
${commands[0].details || ''}
|
||||||
`);
|
`);
|
||||||
} else if (commands.length > 1) {
|
} else if(commands.length > 1) {
|
||||||
return msg.say('Multiple Commands Found. Please be more specific.');
|
return msg.say('Multiple Commands Found. Please be more specific.');
|
||||||
} else {
|
} else {
|
||||||
return msg.say(`Could not identify command. Use ${msg.usage(
|
return msg.say(`Could not identify command. Use ${msg.usage(null)} to view a list of commands you can use.`);
|
||||||
null, msg.channel.type === 'dm' ? null : undefined, msg.channel.type === 'dm' ? null : undefined
|
|
||||||
)} to view a list of commands you can use.`);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const embed = new RichEmbed()
|
const embed = new RichEmbed()
|
||||||
.setTitle(!showAll ? `Commands Available in ${msg.guild ? msg.guild.name : 'this DM'}` : 'All Commands')
|
.setTitle(!showAll ? `Commands Available in ${msg.guild ? msg.guild.name : 'this DM'}` : 'All Commands')
|
||||||
.setDescription(`Use ${this.usage('<command>', null, null)} to view detailed information about a specific command.`)
|
.setDescription(`Use ${msg.usage('<command>')} to view detailed information about a specific command.`)
|
||||||
.setColor(0x00AE86);
|
.setColor(0x00AE86);
|
||||||
for (const group of this.client.registry.groups.array()) {
|
for (const group of this.client.registry.groups.array()) {
|
||||||
embed.addField(group.name,
|
embed.addField(group.name,
|
||||||
@@ -57,9 +55,9 @@ module.exports = class HelpCommand extends Command {
|
|||||||
group.commands.map(c => `\`${c.name}\``).join(', '));
|
group.commands.map(c => `\`${c.name}\``).join(', '));
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await msg.author.send({embed});
|
await msg.author.send({ embed });
|
||||||
return msg.say(':mailbox_with_mail: Sent you a DM with information.');
|
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.');
|
return msg.say('Failed to send DM. You probably have DMs disabled.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+43
-5
@@ -1,5 +1,6 @@
|
|||||||
const { Command } = require('discord.js-commando');
|
const { Command } = require('discord.js-commando');
|
||||||
const { RichEmbed } = require('discord.js');
|
const { RichEmbed } = require('discord.js');
|
||||||
|
const { oneLine } = require('common-tags');
|
||||||
const { version } = require('../../package');
|
const { version } = require('../../package');
|
||||||
const moment = require('moment');
|
const moment = require('moment');
|
||||||
require('moment-duration-format');
|
require('moment-duration-format');
|
||||||
@@ -18,14 +19,18 @@ module.exports = class InfoCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg) {
|
async run(msg) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const guilds = await this.client.shard.fetchClientValues('guilds.size');
|
const guilds = await this.client.shard.fetchClientValues('guilds.size');
|
||||||
const memory = await this.client.shard.broadcastEval('Math.round(process.memoryUsage().heapUsed / 1024 / 1024)');
|
const memory = await this.client.shard.broadcastEval('Math.round(process.memoryUsage().heapUsed / 1024 / 1024)');
|
||||||
const embed = new RichEmbed()
|
const embed = new RichEmbed()
|
||||||
.setColor(0x00AE86)
|
.setColor(0x00AE86)
|
||||||
.setFooter(`©2017 dragonfire535 | Version ${version} | Created ${moment.duration(Date.now() - this.client.user.createdTimestamp).format('y[ years], M[ months], w[ weeks, and ]d[ days]')} ago!`)
|
.setFooter(oneLine`
|
||||||
|
©2017 dragonfire535 |
|
||||||
|
Version ${version} |
|
||||||
|
Created ${moment.duration(Date.now() - this.client.user.createdTimestamp).format('y[ years], M[ months], w[ weeks, and ]d[ days]')} ago!
|
||||||
|
`)
|
||||||
.addField('Servers',
|
.addField('Servers',
|
||||||
`${this.client.guilds.size} / ${guilds.reduce((prev, val) => prev + val, 0)}`, true)
|
`${this.client.guilds.size} / ${guilds.reduce((prev, val) => prev + val, 0)}`, true)
|
||||||
.addField('Shards',
|
.addField('Shards',
|
||||||
@@ -45,9 +50,42 @@ module.exports = class InfoCommand extends Command {
|
|||||||
.addField('Library',
|
.addField('Library',
|
||||||
'[discord.js](https://discord.js.org/#/)', true)
|
'[discord.js](https://discord.js.org/#/)', true)
|
||||||
.addField('Modules',
|
.addField('Modules',
|
||||||
'[commando](https://github.com/Gawdl3y/discord.js-commando), [zalgoize](https://github.com/clux/zalgolize), [superagent](https://github.com/visionmedia/superagent), [mathjs](http://mathjs.org/), [moment](http://momentjs.com), [moment-duration-format](https://github.com/jsmreese/moment-duration-format), [jimp](https://github.com/oliver-moran/jimp), [cheerio](https://cheerio.js.org/), [sequelize](http://docs.sequelizejs.com/en/v3/), [pg](https://github.com/brianc/node-postgres)')
|
oneLine`
|
||||||
|
[commando](https://github.com/Gawdl3y/discord.js-commando),
|
||||||
|
[zalgoize](https://github.com/clux/zalgolize),
|
||||||
|
[superagent](https://github.com/visionmedia/superagent),
|
||||||
|
[mathjs](http://mathjs.org/),
|
||||||
|
[moment](http://momentjs.com),
|
||||||
|
[moment-duration-format](https://github.com/jsmreese/moment-duration-format),
|
||||||
|
[jimp](https://github.com/oliver-moran/jimp),
|
||||||
|
[cheerio](https://cheerio.js.org/),
|
||||||
|
[sequelize](http://docs.sequelizejs.com/en/v3/),
|
||||||
|
[pg](https://github.com/brianc/node-postgres)
|
||||||
|
`
|
||||||
|
)
|
||||||
.addField('APIs',
|
.addField('APIs',
|
||||||
'[Wattpad](https://developer.wattpad.com/docs/api), [Wordnik](http://developer.wordnik.com/docs.html), [osu!](https://osu.ppy.sh/p/api), [memegen.link](https://memegen.link/), [Yugioh Prices](http://docs.yugiohprices.apiary.io/#), [YouTube Data](https://developers.google.com/youtube/v3/), [Discord Bots](https://bots.discord.pw/api), [Today in History](http://history.muffinlabs.com/#api), [jService](http://jservice.io/), [Urban Dictionary](https://github.com/zdict/zdict/wiki/Urban-dictionary-API-documentation), [OMDB](http://www.omdbapi.com/), [Yahoo Weather](https://developer.yahoo.com/weather/), [Wikipedia](https://en.wikipedia.org/w/api.php), [Google Static Maps](https://developers.google.com/maps/documentation/static-maps/), [Strawpoll](https://github.com/strawpoll/strawpoll/wiki/API), [rrrather](http://www.rrrather.com/botapi), [SoundCloud](https://developers.soundcloud.com/), [random.cat](http://random.cat/), [random.dog](https://random.dog/)');
|
oneLine`
|
||||||
|
[Wattpad](https://developer.wattpad.com/docs/api),
|
||||||
|
[Wordnik](http://developer.wordnik.com/docs.html),
|
||||||
|
[osu!](https://osu.ppy.sh/p/api),
|
||||||
|
[memegen.link](https://memegen.link/),
|
||||||
|
[Yugioh Prices](http://docs.yugiohprices.apiary.io/#),
|
||||||
|
[YouTube Data](https://developers.google.com/youtube/v3/),
|
||||||
|
[Discord Bots](https://bots.discord.pw/api),
|
||||||
|
[Today in History](http://history.muffinlabs.com/#api),
|
||||||
|
[jService](http://jservice.io/),
|
||||||
|
[Urban Dictionary](https://github.com/zdict/zdict/wiki/Urban-dictionary-API-documentation),
|
||||||
|
[OMDB](http://www.omdbapi.com/),
|
||||||
|
[Yahoo Weather](https://developer.yahoo.com/weather/),
|
||||||
|
[Wikipedia](https://en.wikipedia.org/w/api.php),
|
||||||
|
[Google Static Maps](https://developers.google.com/maps/documentation/static-maps/),
|
||||||
|
[Strawpoll](https://github.com/strawpoll/strawpoll/wiki/API),
|
||||||
|
[rrrather](http://www.rrrather.com/botapi),
|
||||||
|
[SoundCloud](https://developers.soundcloud.com/),
|
||||||
|
[random.cat](http://random.cat/),
|
||||||
|
[random.dog](https://random.dog/)
|
||||||
|
`
|
||||||
|
);
|
||||||
return msg.embed(embed);
|
return msg.embed(embed);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -24,11 +24,11 @@ module.exports = class ShardInfoCommand extends Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run(msg, args) {
|
async run(msg, args) {
|
||||||
if (msg.channel.type !== 'dm')
|
if(msg.channel.type !== 'dm')
|
||||||
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.');
|
return msg.say('This Command requires the `Embed Links` Permission.');
|
||||||
const { shard } = args;
|
const { shard } = args;
|
||||||
if (shard > this.client.options.shardCount - 1 || shard < 0)
|
if(shard > this.client.options.shardCount - 1 || shard < 0)
|
||||||
return msg.say('The Shard ID is not valid.');
|
return msg.say('The Shard ID is not valid.');
|
||||||
const memory = await this.client.shard.broadcastEval('Math.round(process.memoryUsage().heapUsed / 1024 / 1024)');
|
const memory = await this.client.shard.broadcastEval('Math.round(process.memoryUsage().heapUsed / 1024 / 1024)');
|
||||||
const uptime = await this.client.shard.fetchClientValues('uptime');
|
const uptime = await this.client.shard.fetchClientValues('uptime');
|
||||||
|
|||||||
@@ -32,22 +32,20 @@ client.registry
|
|||||||
['roleplay', 'Roleplay']
|
['roleplay', 'Roleplay']
|
||||||
])
|
])
|
||||||
.registerDefaultGroups()
|
.registerDefaultGroups()
|
||||||
.registerDefaultCommands({
|
.registerDefaultCommands({ help: false })
|
||||||
help: false
|
|
||||||
})
|
|
||||||
.registerCommandsIn(path.join(__dirname, 'commands'));
|
.registerCommandsIn(path.join(__dirname, 'commands'));
|
||||||
|
|
||||||
client.on('guildMemberAdd', (member) => {
|
client.on('guildMemberAdd', (member) => {
|
||||||
const channel = member.guild.channels.get(member.guild.settings.get('memberLog'));
|
const channel = member.guild.channels.get(member.guild.settings.get('memberLog'));
|
||||||
if (!channel) return;
|
if(!channel) return;
|
||||||
if (!channel.permissionsFor(client.user).has('SEND_MESSAGES')) return;
|
if(!channel.permissionsFor(client.user).has('SEND_MESSAGES')) return;
|
||||||
channel.send(`Welcome ${member.user.username}!`);
|
channel.send(`Welcome ${member.user.username}!`);
|
||||||
});
|
});
|
||||||
|
|
||||||
client.on('guildMemberRemove', (member) => {
|
client.on('guildMemberRemove', (member) => {
|
||||||
const channel = member.guild.channels.get(member.guild.settings.get('memberLog'));
|
const channel = member.guild.channels.get(member.guild.settings.get('memberLog'));
|
||||||
if (!channel) return;
|
if(!channel) return;
|
||||||
if (!channel.permissionsFor(client.user).has('SEND_MESSAGES')) return;
|
if(!channel.permissionsFor(client.user).has('SEND_MESSAGES')) return;
|
||||||
channel.send(`Bye ${member.user.username}...`);
|
channel.send(`Bye ${member.user.username}...`);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -59,13 +57,13 @@ client.on('guildCreate', async(guild) => {
|
|||||||
try {
|
try {
|
||||||
await carbon(count);
|
await carbon(count);
|
||||||
console.log(`[Carbon] Successfully posted to Carbon.`);
|
console.log(`[Carbon] Successfully posted to Carbon.`);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
console.log(`[Carbon] Failed to post to Carbon. ${err}`);
|
console.log(`[Carbon] Failed to post to Carbon. ${err}`);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await discordBots(count, client.user.id);
|
await discordBots(count, client.user.id);
|
||||||
console.log(`[Discord Bots] Successfully posted to Discord Bots.`);
|
console.log(`[Discord Bots] Successfully posted to Discord Bots.`);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
console.log(`[Discord Bots] Failed to post to Discord Bots. ${err}`);
|
console.log(`[Discord Bots] Failed to post to Discord Bots. ${err}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -78,13 +76,13 @@ client.on('guildDelete', async(guild) => {
|
|||||||
try {
|
try {
|
||||||
await carbon(count);
|
await carbon(count);
|
||||||
console.log(`[Carbon] Successfully posted to Carbon.`);
|
console.log(`[Carbon] Successfully posted to Carbon.`);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
console.log(`[Carbon] Failed to post to Carbon. ${err}`);
|
console.log(`[Carbon] Failed to post to Carbon. ${err}`);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await discordBots(count, client.user.id);
|
await discordBots(count, client.user.id);
|
||||||
console.log(`[Discord Bots] Successfully posted to Discord Bots.`);
|
console.log(`[Discord Bots] Successfully posted to Discord Bots.`);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
console.log(`[Discord Bots] Failed to post to Discord Bots. ${err}`);
|
console.log(`[Discord Bots] Failed to post to Discord Bots. ${err}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiaobot",
|
"name": "xiaobot",
|
||||||
"version": "18.0.0",
|
"version": "18.0.1",
|
||||||
"description": "A Discord Bot",
|
"description": "A Discord Bot",
|
||||||
"main": "shardingmanager.js",
|
"main": "shardingmanager.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
"cheerio": "^0.22.0",
|
"cheerio": "^0.22.0",
|
||||||
"custom-translate": "dragonfire535/custom-translate",
|
"custom-translate": "dragonfire535/custom-translate",
|
||||||
"discord.js": "hydrabolt/discord.js",
|
"discord.js": "hydrabolt/discord.js",
|
||||||
"discord.js-commando": "dragonfire535/discord.js-commando",
|
"discord.js-commando": "gawdl3y/discord.js-commando",
|
||||||
"jimp": "^0.2.27",
|
"jimp": "^0.2.27",
|
||||||
"mathjs": "^3.12.2",
|
"mathjs": "^3.12.2",
|
||||||
"moment": "^2.18.1",
|
"moment": "^2.18.1",
|
||||||
|
|||||||
+20
-20
@@ -76,7 +76,7 @@ class SequelizeProvider extends SettingProvider {
|
|||||||
let settings;
|
let settings;
|
||||||
try {
|
try {
|
||||||
settings = JSON.parse(row.dataValues.settings);
|
settings = JSON.parse(row.dataValues.settings);
|
||||||
} catch (err) {
|
} catch(err) {
|
||||||
client.emit('warn', `PostgreSQLProvider couldn't parse the settings stored for guild ${row.dataValues.guild}.`);
|
client.emit('warn', `PostgreSQLProvider couldn't parse the settings stored for guild ${row.dataValues.guild}.`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ class SequelizeProvider extends SettingProvider {
|
|||||||
const guild = row.dataValues.guild !== '0' ? row.dataValues.guild : 'global';
|
const guild = row.dataValues.guild !== '0' ? row.dataValues.guild : 'global';
|
||||||
|
|
||||||
this.settings.set(guild, settings);
|
this.settings.set(guild, settings);
|
||||||
if (guild !== 'global' && !client.guilds.has(row.dataValues.guild)) continue;
|
if(guild !== 'global' && !client.guilds.has(row.dataValues.guild)) continue;
|
||||||
this.setupGuild(guild, settings);
|
this.setupGuild(guild, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,18 +95,18 @@ class SequelizeProvider extends SettingProvider {
|
|||||||
.set('groupStatusChange', (guild, group, enabled) => this.set(guild, `grp-${group.id}`, enabled))
|
.set('groupStatusChange', (guild, group, enabled) => this.set(guild, `grp-${group.id}`, enabled))
|
||||||
.set('guildCreate', guild => {
|
.set('guildCreate', guild => {
|
||||||
const settings = this.settings.get(guild.id);
|
const settings = this.settings.get(guild.id);
|
||||||
if (!settings) return;
|
if(!settings) return;
|
||||||
this.setupGuild(guild.id, settings);
|
this.setupGuild(guild.id, settings);
|
||||||
})
|
})
|
||||||
.set('commandRegister', command => {
|
.set('commandRegister', command => {
|
||||||
for (const [guild, settings] of this.settings) {
|
for (const [guild, settings] of this.settings) {
|
||||||
if (guild !== 'global' && !client.guilds.has(guild)) continue;
|
if(guild !== 'global' && !client.guilds.has(guild)) continue;
|
||||||
this.setupGuildCommand(client.guilds.get(guild), command, settings);
|
this.setupGuildCommand(client.guilds.get(guild), command, settings);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.set('groupRegister', group => {
|
.set('groupRegister', group => {
|
||||||
for (const [guild, settings] of this.settings) {
|
for (const [guild, settings] of this.settings) {
|
||||||
if (guild !== 'global' && !client.guilds.has(guild)) continue;
|
if(guild !== 'global' && !client.guilds.has(guild)) continue;
|
||||||
this.setupGuildGroup(client.guilds.get(guild), group, settings);
|
this.setupGuildGroup(client.guilds.get(guild), group, settings);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -127,32 +127,32 @@ class SequelizeProvider extends SettingProvider {
|
|||||||
async set(guild, key, val) {
|
async set(guild, key, val) {
|
||||||
guild = this.constructor.getGuildID(guild);
|
guild = this.constructor.getGuildID(guild);
|
||||||
let settings = this.settings.get(guild);
|
let settings = this.settings.get(guild);
|
||||||
if (!settings) {
|
if(!settings) {
|
||||||
settings = {};
|
settings = {};
|
||||||
this.settings.set(guild, settings);
|
this.settings.set(guild, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
settings[key] = val;
|
settings[key] = val;
|
||||||
await this.model.upsert({ guild: guild !== 'global' ? guild : '0', settings: JSON.stringify(settings) }, { where: { guild: guild !== 'global' ? guild : '0' } }); // eslint-disable-line max-len
|
await this.model.upsert({ guild: guild !== 'global' ? guild : '0', settings: JSON.stringify(settings) }, { where: { guild: guild !== 'global' ? guild : '0' } }); // eslint-disable-line max-len
|
||||||
if (guild === 'global') this.updateOtherShards(key, val);
|
if(guild === 'global') this.updateOtherShards(key, val);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
async remove(guild, key) {
|
async remove(guild, key) {
|
||||||
guild = this.constructor.getGuildID(guild);
|
guild = this.constructor.getGuildID(guild);
|
||||||
const settings = this.settings.get(guild);
|
const settings = this.settings.get(guild);
|
||||||
if (!settings || typeof settings[key] === 'undefined') return undefined;
|
if(!settings || typeof settings[key] === 'undefined') return undefined;
|
||||||
|
|
||||||
const val = settings[key];
|
const val = settings[key];
|
||||||
settings[key] = undefined;
|
settings[key] = undefined;
|
||||||
await this.model.upsert({ guild: guild !== 'global' ? guild : '0', settings: JSON.stringify(settings) }, { where: { guild: guild !== 'global' ? guild : '0' } }); // eslint-disable-line max-len
|
await this.model.upsert({ guild: guild !== 'global' ? guild : '0', settings: JSON.stringify(settings) }, { where: { guild: guild !== 'global' ? guild : '0' } }); // eslint-disable-line max-len
|
||||||
if (guild === 'global') this.updateOtherShards(key, undefined);
|
if(guild === 'global') this.updateOtherShards(key, undefined);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
async clear(guild) {
|
async clear(guild) {
|
||||||
guild = this.constructor.getGuildID(guild);
|
guild = this.constructor.getGuildID(guild);
|
||||||
if (!this.settings.has(guild)) return;
|
if(!this.settings.has(guild)) return;
|
||||||
this.settings.delete(guild);
|
this.settings.delete(guild);
|
||||||
await this.model.destroy({ where: { guild: guild !== 'global' ? guild : '0' } });
|
await this.model.destroy({ where: { guild: guild !== 'global' ? guild : '0' } });
|
||||||
}
|
}
|
||||||
@@ -164,12 +164,12 @@ class SequelizeProvider extends SettingProvider {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
setupGuild(guild, settings) {
|
setupGuild(guild, settings) {
|
||||||
if (typeof guild !== 'string') throw new TypeError('The guild must be a guild ID or "global".');
|
if(typeof guild !== 'string') throw new TypeError('The guild must be a guild ID or "global".');
|
||||||
guild = this.client.guilds.get(guild) || null;
|
guild = this.client.guilds.get(guild) || null;
|
||||||
|
|
||||||
// Load the command prefix
|
// Load the command prefix
|
||||||
if (typeof settings.prefix !== 'undefined') {
|
if(typeof settings.prefix !== 'undefined') {
|
||||||
if (guild) guild._commandPrefix = settings.prefix;
|
if(guild) guild._commandPrefix = settings.prefix;
|
||||||
else this.client._commandPrefix = settings.prefix;
|
else this.client._commandPrefix = settings.prefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,9 +186,9 @@ class SequelizeProvider extends SettingProvider {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
setupGuildCommand(guild, command, settings) {
|
setupGuildCommand(guild, command, settings) {
|
||||||
if (typeof settings[`cmd-${command.name}`] === 'undefined') return;
|
if(typeof settings[`cmd-${command.name}`] === 'undefined') return;
|
||||||
if (guild) {
|
if(guild) {
|
||||||
if (!guild._commandsEnabled) guild._commandsEnabled = {};
|
if(!guild._commandsEnabled) guild._commandsEnabled = {};
|
||||||
guild._commandsEnabled[command.name] = settings[`cmd-${command.name}`];
|
guild._commandsEnabled[command.name] = settings[`cmd-${command.name}`];
|
||||||
} else {
|
} else {
|
||||||
command._globalEnabled = settings[`cmd-${command.name}`];
|
command._globalEnabled = settings[`cmd-${command.name}`];
|
||||||
@@ -203,9 +203,9 @@ class SequelizeProvider extends SettingProvider {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
setupGuildGroup(guild, group, settings) {
|
setupGuildGroup(guild, group, settings) {
|
||||||
if (typeof settings[`grp-${group.id}`] === 'undefined') return;
|
if(typeof settings[`grp-${group.id}`] === 'undefined') return;
|
||||||
if (guild) {
|
if(guild) {
|
||||||
if (!guild._groupsEnabled) guild._groupsEnabled = {};
|
if(!guild._groupsEnabled) guild._groupsEnabled = {};
|
||||||
guild._groupsEnabled[group.id] = settings[`grp-${group.id}`];
|
guild._groupsEnabled[group.id] = settings[`grp-${group.id}`];
|
||||||
} else {
|
} else {
|
||||||
group._globalEnabled = settings[`grp-${group.id}`];
|
group._globalEnabled = settings[`grp-${group.id}`];
|
||||||
@@ -219,7 +219,7 @@ class SequelizeProvider extends SettingProvider {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
updateOtherShards(key, val) {
|
updateOtherShards(key, val) {
|
||||||
if (!this.client.shard) return;
|
if(!this.client.shard) return;
|
||||||
key = JSON.stringify(key);
|
key = JSON.stringify(key);
|
||||||
val = typeof val !== 'undefined' ? JSON.stringify(val) : 'undefined';
|
val = typeof val !== 'undefined' ? JSON.stringify(val) : 'undefined';
|
||||||
this.client.shard.broadcastEval(`
|
this.client.shard.broadcastEval(`
|
||||||
|
|||||||
+1
-3
@@ -1,7 +1,5 @@
|
|||||||
const { ShardingManager } = require('discord.js');
|
const { ShardingManager } = require('discord.js');
|
||||||
const Manager = new ShardingManager('./index.js', {
|
const Manager = new ShardingManager('./index.js', { token: process.env.TOKEN });
|
||||||
token: process.env.TOKEN
|
|
||||||
});
|
|
||||||
Manager.spawn();
|
Manager.spawn();
|
||||||
|
|
||||||
process.on('unhandledRejection', console.error);
|
process.on('unhandledRejection', console.error);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
const Sequelize = require('sequelize');
|
const Sequelize = require('sequelize');
|
||||||
const database = new Sequelize(process.env.DATABASE_URL, { logging: false });
|
const database = new Sequelize(process.env.DATABASE_URL, { logging: false });
|
||||||
|
|
||||||
module.exports = class Database {
|
class Database {
|
||||||
static get db() {
|
static get db() {
|
||||||
return database;
|
return database;
|
||||||
}
|
}
|
||||||
@@ -17,4 +17,6 @@ module.exports = class Database {
|
|||||||
.then(() => console.log('[Database] Ready!'))
|
.then(() => console.log('[Database] Ready!'))
|
||||||
.catch(err => console.error(`[Database] Unable to connect: ${err}`));
|
.catch(err => console.error(`[Database] Unable to connect: ${err}`));
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
module.exports = Database;
|
||||||
|
|||||||
+9
-14
@@ -1,27 +1,22 @@
|
|||||||
const request = require('superagent');
|
const request = require('superagent');
|
||||||
|
|
||||||
module.exports = class Stats {
|
class Stats {
|
||||||
constructor() {
|
constructor() {
|
||||||
throw new Error(`The ${this.constructor.name} class may not be instantiated.`);
|
throw new Error(`The ${this.constructor.name} class may not be instantiated.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
static discordBots(count, userID) {
|
static discordBots(server_count, userID) {
|
||||||
return request
|
return request
|
||||||
.post(`https://bots.discord.pw/api/bots/${userID}/stats`)
|
.post(`https://bots.discord.pw/api/bots/${userID}/stats`)
|
||||||
.set({
|
.set({ 'Authorization': process.env.DISCORD_BOTS_KEY })
|
||||||
'Authorization': process.env.DISCORD_BOTS_KEY
|
.send({ server_count });
|
||||||
})
|
|
||||||
.send({
|
|
||||||
server_count: count
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static carbon(count) {
|
static carbon(servercount) {
|
||||||
return request
|
return request
|
||||||
.post('https://www.carbonitex.net/discord/data/botdata.php')
|
.post('https://www.carbonitex.net/discord/data/botdata.php')
|
||||||
.send({
|
.send({ key: process.env.CARBON_KEY, servercount });
|
||||||
key: process.env.CARBON_KEY,
|
|
||||||
servercount: count
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
|
module.exports = Stats;
|
||||||
|
|||||||
Reference in New Issue
Block a user