mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
All Avatar Edit Commands have been async-ified
This commit is contained in:
@@ -21,11 +21,11 @@ module.exports = class BeautifulCommand extends commando.Command {
|
||||
}
|
||||
console.log(`[Command] ${message.content}`);
|
||||
if (message.mentions.users.size !== 1) {
|
||||
return message.channel.send(':x: Error! Please mention one user!');
|
||||
let errorMes1 = await message.channel.send(':x: Error! Please mention one user!');
|
||||
}
|
||||
else {
|
||||
if (!message.mentions.users.first().avatarURL) {
|
||||
return message.channel.send(":x: Error! This user has no avatar!");
|
||||
let errorMes2 = await message.channel.send(":x: Error! This user has no avatar!");
|
||||
}
|
||||
else {
|
||||
let userAvatar = message.mentions.users.first().avatarURL;
|
||||
@@ -34,15 +34,14 @@ module.exports = class BeautifulCommand extends commando.Command {
|
||||
let images = [];
|
||||
images.push(Jimp.read(userAvatar));
|
||||
images.push(Jimp.read("./images/beautiful.jpg"));
|
||||
await Promise.all(images).then(([avatar, beautiful]) => {
|
||||
avatar.resize(200, 200);
|
||||
beautiful.blit(avatar, 432, 42);
|
||||
avatar.resize(190, 190);
|
||||
beautiful.blit(avatar, 451, 434);
|
||||
beautiful.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if (err) throw err;
|
||||
return message.channel.sendFile(buff);
|
||||
});
|
||||
let [avatar, beautiful] = await Promise.all(images);
|
||||
avatar.resize(200, 200);
|
||||
beautiful.blit(avatar, 432, 42);
|
||||
avatar.resize(190, 190);
|
||||
beautiful.blit(avatar, 451, 434);
|
||||
beautiful.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if (err) throw err;
|
||||
message.channel.sendFile(buff);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,15 +36,14 @@ module.exports = class BobRossCommand extends commando.Command {
|
||||
images.push(Jimp.read(userAvatar));
|
||||
images.push(Jimp.read("./images/BobRoss.png"));
|
||||
images.push(Jimp.read("./images/BlankWhite.png"));
|
||||
await Promise.all(images).then(([avatar, bob, nothing]) => {
|
||||
avatar.rotate(2);
|
||||
avatar.resize(300, 300);
|
||||
nothing.composite(avatar, 44, 85);
|
||||
nothing.composite(bob, 0, 0);
|
||||
nothing.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if (err) throw err;
|
||||
return message.channel.sendFile(buff);
|
||||
});
|
||||
let [avatar, bob, nothing] = await Promise.all(images);
|
||||
avatar.rotate(2);
|
||||
avatar.resize(300, 300);
|
||||
nothing.composite(avatar, 44, 85);
|
||||
nothing.composite(bob, 0, 0);
|
||||
nothing.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if (err) throw err;
|
||||
message.channel.sendFile(buff);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,11 +22,11 @@ module.exports = class RIPCommand extends commando.Command {
|
||||
}
|
||||
console.log(`[Command] ${message.content}`);
|
||||
if (message.mentions.users.size !== 1) {
|
||||
return message.channel.send(':x: Error! Please mention one user!');
|
||||
let errorMes1 = await message.channel.send(':x: Error! Please mention one user!');
|
||||
}
|
||||
else {
|
||||
if (!message.mentions.users.first().avatarURL) {
|
||||
return message.channel.send(":x: Error! This user has no avatar!");
|
||||
let errorMes2 = await message.channel.send(":x: Error! This user has no avatar!");
|
||||
}
|
||||
else {
|
||||
let userAvatar = message.mentions.users.first().avatarURL;
|
||||
@@ -35,13 +35,12 @@ module.exports = class RIPCommand extends commando.Command {
|
||||
let images = [];
|
||||
images.push(Jimp.read(userAvatar));
|
||||
images.push(Jimp.read("./images/gravestone.jpg"));
|
||||
await Promise.all(images).then(([avatar, gravestone]) => {
|
||||
avatar.resize(200, 200);
|
||||
gravestone.blit(avatar, 60, 65);
|
||||
gravestone.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if (err) throw err;
|
||||
return message.channel.sendFile(buff);
|
||||
});
|
||||
let [avatar, gravestone] = await Promise.all(images);
|
||||
avatar.resize(200, 200);
|
||||
gravestone.blit(avatar, 60, 65);
|
||||
gravestone.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if (err) throw err;
|
||||
message.channel.sendFile(buff);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,11 +22,11 @@ module.exports = class SteamCardCommand extends commando.Command {
|
||||
console.log(`[Command] ${message.content}`);
|
||||
if (message.channel.type !== 'dm') {
|
||||
if (message.mentions.users.size !== 1) {
|
||||
return message.channel.send(':x: Error! Please mention one user!');
|
||||
let errorMes1 = await message.channel.send(':x: Error! Please mention one user!');
|
||||
}
|
||||
else {
|
||||
if (!message.mentions.users.first().avatarURL) {
|
||||
return message.channel.send(":x: Error! This user has no avatar!");
|
||||
let errorMes2 = await message.channel.send(":x: Error! This user has no avatar!");
|
||||
}
|
||||
else {
|
||||
let userDisplayName = message.guild.member(message.mentions.users.first()).displayName;
|
||||
@@ -37,17 +37,15 @@ module.exports = class SteamCardCommand extends commando.Command {
|
||||
images.push(Jimp.read(userAvatar));
|
||||
images.push(Jimp.read("./images/SteamCard.png"));
|
||||
images.push(Jimp.read("./images/SteamCardBlank.png"));
|
||||
await Promise.all(images).then(([avatar, steamcard, nothing]) => {
|
||||
Jimp.loadFont(Jimp.FONT_SANS_32_WHITE).then(function(font) {
|
||||
avatar.resize(450, 450);
|
||||
nothing.composite(avatar, 25, 25);
|
||||
nothing.composite(steamcard, 0, 0);
|
||||
nothing.print(font, 38, 20, userDisplayName);
|
||||
nothing.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if (err) throw err;
|
||||
return message.channel.sendFile(buff);
|
||||
});
|
||||
});
|
||||
let [avatar, steamcard, nothing] = await Promise.all(images);
|
||||
let font = await Jimp.loadFont(Jimp.FONT_SANS_32_WHITE);
|
||||
avatar.resize(450, 450);
|
||||
nothing.composite(avatar, 25, 25);
|
||||
nothing.composite(steamcard, 0, 0);
|
||||
nothing.print(font, 38, 20, userDisplayName);
|
||||
nothing.getBuffer(Jimp.MIME_PNG, (err, buff) => {
|
||||
if (err) throw err;
|
||||
message.channel.sendFile(buff);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ module.exports = class QuizCommand extends commando.Command {
|
||||
});
|
||||
const embed = new Discord.RichEmbed()
|
||||
.setTitle('You have **fifteen** seconds to answer this question:')
|
||||
.setDescription(`**Category: ${response.body[0].category}**\n${response.body[0].question}`);
|
||||
.setDescription(`**Category: ${response.body[0].category.title}**\n${response.body[0].question}`);
|
||||
let embededMessage = await message.channel.sendEmbed(embed);
|
||||
try {
|
||||
let collected = await message.channel.awaitMessages(res => res.content.toLowerCase() === response.body[0].answer.toLowerCase() && res.author.id === message.author.id, {
|
||||
|
||||
Reference in New Issue
Block a user