This commit is contained in:
Daniel Odendahl Jr
2017-05-08 21:41:54 +00:00
parent 3d91d5c8ab
commit b054a58bca
42 changed files with 79 additions and 83 deletions
+3 -3
View File
@@ -26,16 +26,16 @@ module.exports = class YearsCommand extends Command {
const { user } = args;
const avatarURL = user.avatarURL('png', 2048);
if (!avatarURL) return msg.say('This user has no avatar.');
let images = [];
const images = [];
images.push(Jimp.read(avatarURL));
images.push(Jimp.read('https://i.imgur.com/eScwGFS.png'));
const [avatar, az] = await Promise.all(images);
avatar.resize(200, 200);
az.composite(avatar, 461, 127);
az.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return msg.say(`An Error Occurred: ${err}`);
if (err) return msg.say(err);
return msg.channel.send({ files: [{ attachment: buff, name: 'az.png' }] })
.catch(err => msg.say(`An Error Occurred: ${err}`));
.catch(err => msg.say(err));
});
}
};
+3 -3
View File
@@ -26,7 +26,7 @@ module.exports = class BeautifulCommand extends Command {
const { user } = args;
const avatarURL = user.avatarURL('png', 2048);
if (!avatarURL) return msg.say('This user has no avatar.');
let images = [];
const images = [];
images.push(Jimp.read(avatarURL));
images.push(Jimp.read('https://i.imgur.com/71qLwPf.png'));
const [avatar, grunkle] = await Promise.all(images);
@@ -34,9 +34,9 @@ module.exports = class BeautifulCommand extends Command {
grunkle.composite(avatar, 341, 35);
grunkle.composite(avatar, 342, 301);
grunkle.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return msg.say(`An Error Occurred: ${err}`);
if (err) return msg.say(err);
return msg.channel.send({ files: [{ attachment: buff, name: 'beautiful.png' }] })
.catch(err => msg.say(`An Error Occurred: ${err}`));
.catch(err => msg.say(err));
});
}
};
+3 -3
View File
@@ -27,7 +27,7 @@ module.exports = class BobRossCommand extends Command {
const avatarURL = user.avatarURL('png', 2048);
if (!avatarURL) return msg.say('This user has no avatar.');
const blank = new Jimp(600, 775, 0xFFFFFFFF);
let images = [];
const images = [];
images.push(Jimp.read(avatarURL));
images.push(Jimp.read('https://i.imgur.com/7NSiFLd.png'));
const [avatar, bob] = await Promise.all(images);
@@ -36,9 +36,9 @@ module.exports = class BobRossCommand extends Command {
blank.composite(avatar, 44, 85);
blank.composite(bob, 0, 0);
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return msg.say(`An Error Occurred: ${err}`);
if (err) return msg.say(err);
return msg.channel.send({ files: [{ attachment: buff, name: 'bobross.png' }] })
.catch(err => msg.say(`An Error Occurred: ${err}`));
.catch(err => msg.say(err));
});
}
};
+2 -2
View File
@@ -29,9 +29,9 @@ module.exports = class GreyscaleCommand extends Command {
const avatar = await Jimp.read(avatarURL);
avatar.greyscale();
avatar.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return msg.say(`An Error Occurred: ${err}`);
if (err) return msg.say(err);
return msg.channel.send({ files: [{ attachment: buff, name: 'greyscale.png' }] })
.catch(err => msg.say(`An Error Occurred: ${err}`));
.catch(err => msg.say(err));
});
}
};
+2 -2
View File
@@ -28,9 +28,9 @@ module.exports = class InvertCommand extends Command {
const avatar = await Jimp.read(avatarURL);
avatar.invert();
avatar.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return msg.say(`An Error Occurred: ${err}`);
if (err) return msg.say(err);
return msg.channel.send({ files: [{ attachment: buff, name: 'invert.png' }] })
.catch(err => msg.say(`An Error Occurred: ${err}`));
.catch(err => msg.say(err));
});
}
};
+3 -3
View File
@@ -26,7 +26,7 @@ module.exports = class RIPCommand extends Command {
const { user } = args;
const avatarURL = user.avatarURL('png', 2048);
if (!avatarURL) return msg.say('This user has no avatar.');
let images = [];
const images = [];
images.push(Jimp.read(avatarURL));
images.push(Jimp.read('https://i.imgur.com/KriteWm.jpg'));
const [avatar, grave] = await Promise.all(images);
@@ -34,9 +34,9 @@ module.exports = class RIPCommand extends Command {
avatar.resize(200, 200);
grave.composite(avatar, 158, 51);
grave.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return msg.say(`An Error Occurred: ${err}`);
if (err) return msg.say(err);
return msg.channel.send({ files: [{ attachment: buff, name: 'rip.png' }] })
.catch(err => msg.say(`An Error Occurred: ${err}`));
.catch(err => msg.say(err));
});
}
};
+3 -3
View File
@@ -28,7 +28,7 @@ module.exports = class SteamCardCommand extends Command {
const avatarURL = user.avatarURL('png', 2048);
if (!avatarURL) return msg.say('This user has no avatar.');
const blank = new Jimp(494, 568, 0xFFFFFFFF);
let images = [];
const images = [];
images.push(Jimp.read(avatarURL));
images.push(Jimp.read('https://i.imgur.com/JF0WwQX.png'));
const [avatar, card] = await Promise.all(images);
@@ -38,9 +38,9 @@ module.exports = class SteamCardCommand extends Command {
blank.composite(card, 0, 0);
blank.print(font, 38, 20, username);
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return msg.say(`An Error Occurred: ${err}`);
if (err) return msg.say(err);
return msg.channel.send({ files: [{ attachment: buff, name: 'steamcard.png' }] })
.catch(err => msg.say(`An Error Occurred: ${err}`));
.catch(err => msg.say(err));
});
}
};
+3 -3
View File
@@ -26,7 +26,7 @@ module.exports = class TriggeredCommand extends Command {
const avatarURL = user.avatarURL('png', 2048);
if (!avatarURL) return msg.say('This user has no avatar.');
const blank = new Jimp(320, 371, 0xFFFFFFFF);
let images = [];
const images = [];
images.push(Jimp.read(avatarURL));
images.push(Jimp.read('https://i.imgur.com/tF9yF62.png'));
const [avatar, triggered] = await Promise.all(images);
@@ -34,9 +34,9 @@ module.exports = class TriggeredCommand extends Command {
blank.composite(avatar, 0, 0);
blank.composite(triggered, 0, 0);
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return msg.say(`An Error Occurred: ${err}`);
if (err) return msg.say(err);
return msg.channel.send({ files: [{ attachment: buff, name: 'triggered.png' }] })
.catch(err => msg.say(`An Error Occurred: ${err}`));
.catch(err => msg.say(err));
});
}
};
+3 -3
View File
@@ -25,16 +25,16 @@ module.exports = class WantedCommand extends Command {
const { user } = args;
const avatarURL = user.avatarURL('png', 2048);
if (!avatarURL) return msg.say('This user has no avatar.');
let images = [];
const images = [];
images.push(Jimp.read(avatarURL));
images.push(Jimp.read('https://i.imgur.com/ca09TG5.jpg'));
const [avatar, wanted] = await Promise.all(images);
avatar.resize(500, 500);
wanted.composite(avatar, 189, 438);
wanted.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return msg.say(`An Error Occurred: ${err}`);
if (err) return msg.say(err);
return msg.channel.send({ files: [{ attachment: buff, name: 'wanted.png' }] })
.catch(err => msg.say(`An Error Occurred: ${err}`));
.catch(err => msg.say(err));
});
}
};
+1 -1
View File
@@ -54,7 +54,7 @@ module.exports = class MathGameCommand extends Command {
const embed = new RichEmbed()
.setTitle('You have **10** seconds to answer:')
.setDescription(expression);
await msg.embed(embed);
msg.embed(embed);
try {
const collected = await msg.channel.awaitMessages(res => res.author.id === msg.author.id, {
max: 1,
+1 -1
View File
@@ -28,7 +28,7 @@ module.exports = class QuizCommand extends Command {
**Category: ${body[0].category.title}**
${body[0].question}
`);
await msg.embed(embed);
msg.embed(embed);
try {
const collected = await msg.channel.awaitMessages(res => res.author.id === msg.author.id, {
max: 1,
+1 -1
View File
@@ -51,7 +51,7 @@ module.exports = class TypingGameCommand extends Command {
const embed = new RichEmbed()
.setTitle(`You have **${time / 1000}** seconds to type:`)
.setDescription(sentence);
await msg.embed(embed);
msg.embed(embed);
try {
const collected = await msg.channel.awaitMessages(res => res.author.id === msg.author.id, {
max: 1,
+2 -2
View File
@@ -55,7 +55,7 @@ module.exports = class BanCommand extends Command {
await msg.say('Failed to send DM to the user.');
}
await member.ban({ days: 7, reason });
await msg.say(':ok_hand:');
msg.say(':ok_hand:');
const embed = new RichEmbed()
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
.setColor(0xFF0000)
@@ -67,7 +67,7 @@ module.exports = class BanCommand extends Command {
`);
return modlogs.send({ embed });
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+2 -2
View File
@@ -54,7 +54,7 @@ module.exports = class KickCommand extends Command {
await msg.say('Failed to send DM.');
}
await member.kick({ reason });
await msg.say(':ok_hand:');
msg.say(':ok_hand:');
const embed = new RichEmbed()
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
.setColor(0xFFA500)
@@ -66,7 +66,7 @@ module.exports = class KickCommand extends Command {
`);
return modlogs.send({ embed });
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+2 -2
View File
@@ -40,14 +40,14 @@ module.exports = class LockdownCommand extends Command {
Please use \`lockdown stop\` to end the lockdown.
`);
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
} else if (type === 'stop') {
try {
await msg.channel.overwritePermissions(msg.guild.defaultRole, { SEND_MESSAGES: true });
return msg.say('Lockdown Ended, users without Administrator can now post messages.');
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
}
+2 -2
View File
@@ -58,7 +58,7 @@ module.exports = class SoftbanCommand extends Command {
}
await member.ban({ days: 7, reason });
await msg.guild.unban(member.user);
await msg.say(':ok_hand:');
msg.say(':ok_hand:');
const embed = new RichEmbed()
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
.setColor(0xFF4500)
@@ -70,7 +70,7 @@ module.exports = class SoftbanCommand extends Command {
`);
return modlogs.send({ embed });
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+2 -2
View File
@@ -53,7 +53,7 @@ module.exports = class UnbanCommand extends Command {
const member = bans.get(id);
try {
await msg.guild.unban(member);
await msg.say(':ok_hand:');
msg.say(':ok_hand:');
const embed = new RichEmbed()
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
.setColor(0x00AE86)
@@ -65,7 +65,7 @@ module.exports = class UnbanCommand extends Command {
`);
return modlogs.send({ embed });
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+12 -16
View File
@@ -33,7 +33,7 @@ module.exports = class WarnCommand extends Command {
return msg.member.hasPermission('KICK_MEMBERS') || msg.member.roles.has(msg.guild.settings.get('staffRole'));
}
async run(msg, args) {
run(msg, args) {
const modlogs = msg.guild.channels.get(msg.guild.settings.get('modLog'));
if (!modlogs) return msg.say('This Command requires a channel set with the `modchannel` command.');
if (!modlogs.permissionsFor(this.client.user).has('SEND_MESSAGES'))
@@ -41,20 +41,16 @@ module.exports = class WarnCommand extends Command {
if (!modlogs.permissionsFor(this.client.user).has('EMBED_LINKS'))
return msg.say('This Command requires the `Embed Links` Permission.');
const { member, reason } = args;
try {
await msg.say(':ok_hand:');
const embed = new RichEmbed()
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
.setColor(0xFFFF00)
.setTimestamp()
.setDescription(stripIndents`
**Member:** ${member.user.tag} (${member.id})
**Action:** Warn
**Reason:** ${reason}
`);
return modlogs.send({ embed });
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
}
msg.say(':ok_hand:');
const embed = new RichEmbed()
.setAuthor(msg.author.tag, msg.author.displayAvatarURL)
.setColor(0xFFFF00)
.setTimestamp()
.setDescription(stripIndents`
**Member:** ${member.user.tag} (${member.id})
**Action:** Warn
**Reason:** ${reason}
`);
return modlogs.send({ embed });
}
};
+1 -1
View File
@@ -49,7 +49,7 @@ module.exports = class CurrencyCommand extends Command {
const rate = body.rates[to];
return msg.say(`${amount} ${base} is ${amount * rate} ${to}.`);
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+1 -1
View File
@@ -42,6 +42,6 @@ module.exports = class MemeCommand extends Command {
return msg.say('This Command requires the `Attach Files` Permission.');
const { type, top, bottom } = args;
return msg.channel.send({ files: [`https://memegen.link/${type}/${top}/${bottom}.jpg`] })
.catch(err => msg.say(`An Error Occurred: ${err}`));
.catch(err => msg.say(err));
}
};
+1 -1
View File
@@ -15,6 +15,6 @@ module.exports = class SpamCommand extends Command {
if (!msg.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
return msg.say('This Command requires the `Attach Files` Permission.');
return msg.channel.send({ files: ['https://i.imgur.com/2JFu5xE.jpg'] })
.catch(err => msg.say(`An Error Occurred: ${err}`));
.catch(err => msg.say(err));
}
};
+1 -1
View File
@@ -46,7 +46,7 @@ module.exports = class StrawpollCommand extends Command {
http://strawpoll.me/${body.id}
`);
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+3 -3
View File
@@ -22,16 +22,16 @@ module.exports = class TodayCommand extends Command {
.buffer(true);
const parsed = JSON.parse(text);
const events = parsed.data.Events;
const random = Math.floor(Math.random() * events.length);
const event = events[Math.floor(Math.random() * events.length)];
const embed = new RichEmbed()
.setColor(0x9797FF)
.setURL(parsed.url)
.setTitle(`On this day (${parsed.date})...`)
.setTimestamp()
.setDescription(`${events[random].year}: ${events[random].text}`);
.setDescription(`${event.year}: ${event.text}`);
return msg.embed(embed);
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+1 -1
View File
@@ -27,7 +27,7 @@ module.exports = class WouldYouRatherCommand extends Command {
.setDescription(`${body.choicea} OR ${body.choiceb}?`);
return msg.embed(embed);
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+2 -2
View File
@@ -20,9 +20,9 @@ module.exports = class CatCommand extends Command {
const { body } = await request
.get('http://random.cat/meow');
return msg.channel.send({ files: [body.file] })
.catch(err => msg.say(`An Error Occurred: ${err}`));
.catch(err => msg.say(err));
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+2 -2
View File
@@ -19,9 +19,9 @@ module.exports = class DogCommand extends Command {
const { body } = await request
.get('https://random.dog/woof.json');
return msg.channel.send({ files: [body.url] })
.catch(err => msg.say(`An Error Occurred: ${err}`));
.catch(err => msg.say(err));
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+1 -1
View File
@@ -18,6 +18,6 @@ module.exports = class XiaoCommand extends Command {
return msg.say('This Command requires the `Attach Files` Permission.');
const xiao = xiaos[Math.floor(Math.random() * xiaos.length)];
return msg.channel.send({ files: [xiao] })
.catch(err => msg.say(`An Error Occurred: ${err}`));
.catch(err => msg.say(err));
}
};
+1 -1
View File
@@ -42,7 +42,7 @@ module.exports = class BotSearchCommand extends Command {
body.prefix, true);
return msg.embed(embed);
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+1 -1
View File
@@ -35,7 +35,7 @@ module.exports = class DefineCommand extends Command {
.setDescription(body[0].text);
return msg.embed(embed);
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+1 -1
View File
@@ -50,7 +50,7 @@ module.exports = class ForecastCommand extends Command {
`**High:** ${forecasts[6].high}°F, **Low:** ${forecasts[6].low}°F, **Condition:** ${forecasts[6].text}`);
return msg.embed(embed);
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+1 -1
View File
@@ -51,7 +51,7 @@ module.exports = class IMDBCommand extends Command {
body.Actors);
return msg.embed(embed);
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+2 -2
View File
@@ -39,9 +39,9 @@ module.exports = class MapCommand extends Command {
const { body } = await request
.get(`https://maps.googleapis.com/maps/api/staticmap?center=${query}&zoom=${zoom}&size=500x500&key=${process.env.GOOGLE_KEY}`);
return msg.channel.send({ files: [{ attachment: body, name: 'map.png' }] })
.catch(err => msg.say(`An Error Occurred: ${err}`));
.catch(err => msg.say(err));
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+1 -1
View File
@@ -30,7 +30,7 @@ module.exports = class NeopetCommand extends Command {
if (!link.includes('cp')) throw new Error('Invalid Pet Name.');
return msg.say(link);
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+1 -1
View File
@@ -59,7 +59,7 @@ module.exports = class OsuCommand extends Command {
body[0].count_rank_a, true);
return msg.embed(embed);
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+1 -1
View File
@@ -46,7 +46,7 @@ module.exports = class SoundCloudCommand extends Command {
body[0].favoritings_count, true);
return msg.embed(embed);
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+1 -1
View File
@@ -39,7 +39,7 @@ module.exports = class UrbanCommand extends Command {
body.list[0].example.substr(0, 2000) || 'None');
return msg.embed(embed);
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+1 -1
View File
@@ -50,7 +50,7 @@ module.exports = class WattpadCommand extends Command {
body.stories[0].commentCount, true);
return msg.embed(embed);
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+1 -1
View File
@@ -59,7 +59,7 @@ module.exports = class WeatherCommand extends Command {
body.query.results.channel.wind.speed, true);
return msg.embed(embed);
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+1 -1
View File
@@ -37,7 +37,7 @@ module.exports = class WikipediaCommand extends Command {
.setDescription(body.query.pages[0].extract.substr(0, 2000).replace(/[\n]/g, '\n\n'));
return msg.embed(embed);
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+1 -1
View File
@@ -38,7 +38,7 @@ module.exports = class YouTubeCommand extends Command {
.setThumbnail(body.items[0].snippet.thumbnails.default.url);
return msg.embed(embed);
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+1 -1
View File
@@ -58,7 +58,7 @@ module.exports = class YuGiOhCommand extends Command {
body.data.card_type, true);
return msg.embed(embed);
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};
+1 -1
View File
@@ -35,7 +35,7 @@ module.exports = class WebhookCommand extends Command {
.send({ content });
return null;
} catch (err) {
return msg.say(`An Error Occurred: ${err}`);
return msg.say(err);
}
}
};