This commit is contained in:
Daniel Odendahl Jr
2017-10-15 15:37:24 +00:00
parent 0b2664c1f8
commit cdd45693c5
+4 -2
View File
@@ -32,11 +32,13 @@ module.exports = class AchievementCommand extends Command {
const ctx = canvas.getContext('2d');
ctx.drawImage(base, 0, 0);
ctx.font = '17px Minecraftia';
ctx.fillText('Achievement Get!', 60, 14);
ctx.fillStyle = '#ffff00';
ctx.fillText('Achievement Get!', 60, 27);
let shorten;
if (ctx.measureText(text).width > 230) shorten = true;
while (ctx.measureText(text).width > 230) text = text.substr(0, text.length - 1);
ctx.fillText(shorten ? `${text}...` : text, 60, 36);
ctx.fillStyle = '#ffffff';
ctx.fillText(shorten ? `${text}...` : text, 60, 49);
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'achievement.png' }] });
}
};