This commit is contained in:
Dragon Fire
2020-07-04 23:13:48 -04:00
parent 10e81af394
commit 986e503b1a
+2 -2
View File
@@ -44,7 +44,7 @@ module.exports = class GandhiQuoteCommand extends Command {
}); });
} }
async run(msg, { text }) { async run(msg, { quote }) {
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'gandhi-quote.png')); const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'gandhi-quote.png'));
const canvas = createCanvas(base.width, base.height); const canvas = createCanvas(base.width, base.height);
const ctx = canvas.getContext('2d'); const ctx = canvas.getContext('2d');
@@ -58,7 +58,7 @@ module.exports = class GandhiQuoteCommand extends Command {
fontSize--; fontSize--;
ctx.font = `${fontSize}px Noto`; ctx.font = `${fontSize}px Noto`;
} }
const lines = await wrapText(ctx, text, 270); const lines = await wrapText(ctx, quote, 270);
const topMost = 180 - (((fontSize * lines.length) / 2) + ((20 * (lines.length - 1)) / 2)); const topMost = 180 - (((fontSize * lines.length) / 2) + ((20 * (lines.length - 1)) / 2));
for (let i = 0; i < lines.length; i++) { for (let i = 0; i < lines.length; i++) {
const height = topMost + ((fontSize + 20) * i); const height = topMost + ((fontSize + 20) * i);