Make PNGs Again

This commit is contained in:
Daniel Odendahl Jr
2017-09-21 11:00:45 +00:00
parent a2af62660c
commit 072bbd3cd8
25 changed files with 25 additions and 25 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ module.exports = class YearsCommand extends Command {
const avatar = await loadImage(body);
ctx.drawImage(base, 0, 0);
ctx.drawImage(avatar, 461, 127, 200, 200);
return msg.say({ files: [canvas.toBuffer()] });
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: '3000-years.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -41,7 +41,7 @@ module.exports = class ApprovedCommand extends Command {
const avatar = await loadImage(body);
ctx.drawImage(avatar, 0, 0, 256, 256);
ctx.drawImage(base, 0, 0, 256, 256);
return msg.say({ files: [canvas.toBuffer()] });
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'approved.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -51,7 +51,7 @@ module.exports = class AvatarFusionCommand extends Command {
ctx.globalAlpha = 0.5;
ctx.drawImage(baseAvatar, 0, 0, 256, 256);
ctx.drawImage(overlayAvatar, 0, 0, 256, 256);
return msg.say({ files: [canvas.toBuffer()] });
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'avatar-fusion.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -42,7 +42,7 @@ module.exports = class BeautifulCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.drawImage(avatar, 341, 35, 117, 135);
ctx.drawImage(avatar, 343, 301, 117, 135);
return msg.say({ files: [canvas.toBuffer()] });
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'beautiful.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -45,7 +45,7 @@ module.exports = class BobRossCommand extends Command {
ctx.drawImage(avatar, 69, 102, 256, 256);
ctx.rotate(-3 * (Math.PI / 180));
ctx.drawImage(base, 0, 0);
return msg.say({ files: [canvas.toBuffer()] });
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'bob-ross.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -63,7 +63,7 @@ module.exports = class CardCommand extends Command {
ctx.font = '14px Noto';
ctx.fillText(user.id, 30, 355);
ctx.fillText(`#${user.discriminator}`, 313, 355);
return msg.say({ files: [canvas.toBuffer()] });
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'card.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -40,7 +40,7 @@ module.exports = class ChallengerCommand extends Command {
const avatar = await loadImage(body);
ctx.drawImage(base, 0, 0);
ctx.drawImage(avatar, 484, 98, 256, 256);
return msg.say({ files: [canvas.toBuffer()] });
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'challenger.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -40,7 +40,7 @@ module.exports = class ChristmasHatCommand extends Command {
const avatar = await loadImage(body);
ctx.drawImage(avatar, 0, 0, 256, 256);
ctx.drawImage(base, 65, -26, 200, 235);
return msg.say({ files: [canvas.toBuffer()] });
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'christmas-hat.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -42,7 +42,7 @@ module.exports = class DexterCommand extends Command {
ctx.rotate(-11 * (Math.PI / 180));
ctx.drawImage(avatar, 234, 274, 225, 225);
ctx.rotate(11 * (Math.PI / 180));
return msg.say({ files: [canvas.toBuffer()] });
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'dexter.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -47,7 +47,7 @@ module.exports = class GreyscaleCommand extends Command {
data[i + 2] = brightness;
}
ctx.putImageData(imgData, 0, 0);
return msg.say({ files: [canvas.toBuffer()] });
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'greyscale.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -45,7 +45,7 @@ module.exports = class InvertCommand extends Command {
data[i + 2] = 255 - data[i + 2];
}
ctx.putImageData(imgData, 0, 0);
return msg.say({ files: [canvas.toBuffer()] });
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'invert.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -41,7 +41,7 @@ module.exports = class RainbowCommand extends Command {
const avatar = await loadImage(body);
ctx.drawImage(avatar, 0, 0, 256, 256);
ctx.drawImage(base, 0, 0, 256, 256);
return msg.say({ files: [canvas.toBuffer()] });
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'rainbow.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -41,7 +41,7 @@ module.exports = class RejctedCommand extends Command {
const avatar = await loadImage(body);
ctx.drawImage(avatar, 0, 0, 256, 256);
ctx.drawImage(base, 0, 0, 256, 256);
return msg.say({ files: [canvas.toBuffer()] });
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'rejected.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -50,7 +50,7 @@ module.exports = class RIPCommand extends Command {
data[i + 2] = brightness;
}
ctx.putImageData(imgData, 158, 51);
return msg.say({ files: [canvas.toBuffer()] });
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'rip.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -42,7 +42,7 @@ module.exports = class SimbaCommand extends Command {
ctx.rotate(-24 * (Math.PI / 180));
ctx.drawImage(avatar, 75, 160, 130, 150);
ctx.rotate(24 * (Math.PI / 180));
return msg.say({ files: [canvas.toBuffer()] });
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'simba.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -48,7 +48,7 @@ module.exports = class SteamCardCommand extends Command {
ctx.drawImage(base, 0, 0);
ctx.font = '30px Noto';
ctx.fillText(member.displayName, 35, 48);
return msg.say({ files: [canvas.toBuffer()] });
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'steam-card.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -57,7 +57,7 @@ module.exports = class SteamNowPlayingCommand extends Command {
if (ctx.measureText(game).width > 160) shorten = true;
while (ctx.measureText(game).width > 160) game = game.substr(0, game.length - 1);
ctx.fillText(shorten ? `${game}...` : game, 63, 54);
return msg.say({ files: [canvas.toBuffer()] });
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'steam-now-playing.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -49,7 +49,7 @@ module.exports = class ThugLifeCommand extends Command {
data[i + 2] = brightness;
}
ctx.putImageData(imgData, 0, 0);
return msg.say({ files: [canvas.toBuffer()] });
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'thug-life.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -46,7 +46,7 @@ module.exports = class TriggeredCommand extends Command {
for (let i = 0; i < data.length; i += 4) data[i] = Math.max(255, data[i]);
ctx.putImageData(imgData, 0, 0);
ctx.drawImage(base, 0, 0);
return msg.say({ files: [canvas.toBuffer()] });
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'triggered.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -40,7 +40,7 @@ module.exports = class WantedCommand extends Command {
const avatar = await loadImage(body);
ctx.drawImage(base, 0, 0);
ctx.drawImage(avatar, 150, 360, 430, 430);
return msg.say({ files: [canvas.toBuffer()] });
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'wanted.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -40,7 +40,7 @@ module.exports = class YuGiOhTokenCommand extends Command {
const avatar = await loadImage(body);
ctx.drawImage(base, 0, 0);
ctx.drawImage(avatar, 45, 102, 293, 294);
return msg.say({ files: [canvas.toBuffer()] });
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'yu-gi-oh-token.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -32,7 +32,7 @@ module.exports = class AchievementCommand extends Command {
h: 'Achievement Get!',
t: text
});
return msg.say({ files: [body] });
return msg.say({ files: [{ attachment: body, name: 'achievement.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -26,6 +26,6 @@ module.exports = class ColorCommand extends Command {
const ctx = canvas.getContext('2d');
ctx.fillStyle = color;
ctx.fillRect(0, 0, 250, 250);
return msg.say({ files: [canvas.toBuffer()] });
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'color.png' }] });
}
};
+1 -1
View File
@@ -40,7 +40,7 @@ module.exports = class MapCommand extends Command {
size: '500x500',
key: GOOGLE_KEY
});
return msg.say({ files: [body] });
return msg.say({ files: [{ attachment: body, name: 'map.png' }] });
} catch (err) {
return msg.say(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiaobot",
"version": "41.2.1",
"version": "41.2.2",
"description": "Your personal server companion.",
"main": "Shard.js",
"scripts": {