No Need for Blank Images with this

This commit is contained in:
Daniel Odendahl Jr
2017-04-22 14:40:49 +00:00
parent 4dbd633cf2
commit 2d108cc78a
5 changed files with 12 additions and 12 deletions
+5 -5
View File
@@ -28,16 +28,16 @@ module.exports = class BobRossCommand extends Command {
}
const { user } = args;
const userAvatar = user.displayAvatarURL.replace('.jpg', '.png').replace('.gif', '.png');
const blank = new Jimp(600, 775, 0xFFFFFF);
let images = [];
images.push(Jimp.read(userAvatar));
images.push(Jimp.read('./images/BobRoss.png'));
images.push(Jimp.read('./images/BlankWhite.png'));
const [avatar, bob, nothing] = await Promise.all(images);
const [avatar, bob] = 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) => {
blank.composite(avatar, 44, 85);
blank.composite(bob, 0, 0);
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return message.say(':x: Error! Something went wrong!');
return message.channel.send({files: [{attachment: buff}]});
});
+6 -6
View File
@@ -27,17 +27,17 @@ module.exports = class SteamCardCommand extends Command {
}
const { user } = args;
const userAvatar = user.displayAvatarURL.replace('.jpg', '.png').replace('.gif', '.png');
const blank = new Jimp(494, 568, 0xFFFFFF);
let images = [];
images.push(Jimp.read(userAvatar));
images.push(Jimp.read('./images/SteamCard.png'));
images.push(Jimp.read('./images/SteamCardBlank.png'));
const [avatar, steamcard, nothing] = await Promise.all(images);
const [avatar, steamcard] = await Promise.all(images);
const 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, user.username);
nothing.getBuffer(Jimp.MIME_PNG, (err, buff) => {
blank.composite(avatar, 25, 25);
blank.composite(steamcard, 0, 0);
blank.print(font, 38, 20, user.username);
blank.getBuffer(Jimp.MIME_PNG, (err, buff) => {
if (err) return message.say(':x: Error! Something went wrong!');
return message.channel.send({files: [{attachment: buff}]});
});
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "31.3.1",
"version": "31.4.0",
"description": "A Discord Bot",
"main": "shardingmanager.js",
"scripts": {