From aa78cd91c22f2c9650ae5c443598b1a58720391e Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Fri, 26 Apr 2024 00:27:42 -0400 Subject: [PATCH] wrapText is no longer async --- commands/edit-image-text/ace-attorney.js | 2 +- commands/edit-image-text/caution.js | 2 +- commands/edit-image-text/chinese-restaurant.js | 2 +- commands/edit-image-text/danger.js | 2 +- commands/edit-image-text/font.js | 2 +- commands/edit-image-text/gandhi-quote.js | 2 +- commands/edit-image-text/highway-sign.js | 2 +- commands/edit-image-text/jeopardy-question.js | 2 +- commands/edit-image-text/spongebob-time-card.js | 2 +- commands/edit-image-text/tweet.js | 4 ++-- commands/edit-image-text/undertale.js | 2 +- commands/edit-image-text/zero-dialogue.js | 2 +- commands/edit-image/subtitle.js | 2 +- commands/edit-image/yu-gi-oh-gen.js | 2 +- commands/edit-meme/alert.js | 2 +- commands/edit-meme/be-like-bill.js | 2 +- commands/edit-meme/change-my-mind.js | 2 +- commands/edit-meme/chi-idea.js | 2 +- commands/edit-meme/dear-liberals.js | 4 ++-- commands/edit-meme/drakeposting.js | 4 ++-- commands/edit-meme/edd-facts-book.js | 2 +- commands/edit-meme/genie-rules.js | 2 +- commands/edit-meme/gru-plan.js | 2 +- commands/edit-meme/if-those-kids-could-read.js | 2 +- commands/edit-meme/lisa-presentation.js | 2 +- commands/edit-meme/mario-bros-views.js | 4 ++-- commands/edit-meme/meme-gen.js | 4 ++-- commands/edit-meme/nike-ad.js | 2 +- commands/edit-meme/panik-kalm-panik.js | 6 +++--- commands/edit-meme/pills.js | 2 +- commands/edit-meme/plankton-plan.js | 2 +- commands/edit-meme/reaction-meme.js | 2 +- commands/edit-meme/scroll-of-truth.js | 2 +- commands/edit-meme/sonic-says.js | 2 +- commands/edit-meme/spiderman-pointing.js | 4 ++-- commands/edit-meme/spongebob-burn.js | 2 +- commands/edit-meme/that-sign-wont-stop-me.js | 4 ++-- commands/edit-meme/tuxedo-pooh.js | 4 ++-- commands/edit-meme/two-buttons.js | 4 ++-- commands/edit-meme/whiteboard.js | 4 ++-- commands/games-sp/jeopardy.js | 2 +- 41 files changed, 53 insertions(+), 53 deletions(-) diff --git a/commands/edit-image-text/ace-attorney.js b/commands/edit-image-text/ace-attorney.js index a815d8e8..f7be33a9 100644 --- a/commands/edit-image-text/ace-attorney.js +++ b/commands/edit-image-text/ace-attorney.js @@ -80,7 +80,7 @@ module.exports = class AceAttorneyCommand extends Command { ctx.fillStyle = 'white'; ctx.textBaseline = 'top'; ctx.fillText(firstUpperCase(character), 6, 176); - let text = await wrapText(ctx, quote, 242); + let text = wrapText(ctx, quote, 242); text = text.length > 5 ? `${text.slice(0, 5).join('\n')}...` : text.join('\n'); ctx.fillText(text, 7, 199); return msg.say({ files: [{ attachment: canvas.toBuffer(), name: `ace-attorney-${character}.png` }] }); diff --git a/commands/edit-image-text/caution.js b/commands/edit-image-text/caution.js index 1661b127..b442c806 100644 --- a/commands/edit-image-text/caution.js +++ b/commands/edit-image-text/caution.js @@ -54,7 +54,7 @@ module.exports = class CautionCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Bold.ttf').toCanvasString(fontSize); } - const lines = await wrapText(ctx, text.toUpperCase(), 895); + const lines = wrapText(ctx, text.toUpperCase(), 895); const topMost = 470 - (((fontSize * lines.length) / 2) + ((20 * (lines.length - 1)) / 2)); for (let i = 0; i < lines.length; i++) { const height = topMost + ((fontSize + 20) * i); diff --git a/commands/edit-image-text/chinese-restaurant.js b/commands/edit-image-text/chinese-restaurant.js index 6cc749a0..d57407f2 100644 --- a/commands/edit-image-text/chinese-restaurant.js +++ b/commands/edit-image-text/chinese-restaurant.js @@ -49,7 +49,7 @@ module.exports = class ChineseRestaurantCommand extends Command { ctx.textAlign = 'center'; ctx.textBaseline = 'top'; ctx.font = this.client.fonts.get('Futura Condensed Bold.otf').toCanvasString(28); - const lines = await wrapText(ctx, text.toUpperCase(), 340); + const lines = wrapText(ctx, text.toUpperCase(), 340); if (lines.length === 1) { ctx.fillText(lines[0], base.width / 2, 288); } else if (lines.length === 2) { diff --git a/commands/edit-image-text/danger.js b/commands/edit-image-text/danger.js index 98768a0c..c6ae5d3a 100644 --- a/commands/edit-image-text/danger.js +++ b/commands/edit-image-text/danger.js @@ -54,7 +54,7 @@ module.exports = class DangerCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Bold.ttf').toCanvasString(fontSize); } - const lines = await wrapText(ctx, text.toUpperCase(), 840); + const lines = wrapText(ctx, text.toUpperCase(), 840); const topMost = 510 - (((fontSize * lines.length) / 2) + ((20 * (lines.length - 1)) / 2)); for (let i = 0; i < lines.length; i++) { const height = topMost + ((fontSize + 20) * i); diff --git a/commands/edit-image-text/font.js b/commands/edit-image-text/font.js index 283e3882..6834f702 100644 --- a/commands/edit-image-text/font.js +++ b/commands/edit-image-text/font.js @@ -37,7 +37,7 @@ module.exports = class FontCommand extends Command { const ctxPre = canvasPre.getContext('2d'); ctxPre.font = this.client.fonts.get(font.filename).toCanvasString(50); const len = ctxPre.measureText(text); - const lines = await wrapText(ctxPre, text, 950); + const lines = wrapText(ctxPre, text, 950); const canvas = createCanvas(Math.min(len.width + 50, 1000), 50 + (50 * lines.length) + (20 * lines.length)); const ctx = canvas.getContext('2d'); ctx.font = this.client.fonts.get(font.filename).toCanvasString(50); diff --git a/commands/edit-image-text/gandhi-quote.js b/commands/edit-image-text/gandhi-quote.js index 07d7aaa2..88be99b2 100644 --- a/commands/edit-image-text/gandhi-quote.js +++ b/commands/edit-image-text/gandhi-quote.js @@ -49,7 +49,7 @@ module.exports = class GandhiQuoteCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('lmroman10-italic.otf').toCanvasString(fontSize); } - const lines = await wrapText(ctx, quote, 270); + const lines = wrapText(ctx, quote, 270); const topMost = 180 - (((fontSize * lines.length) / 2) + ((20 * (lines.length - 1)) / 2)); for (let i = 0; i < lines.length; i++) { const height = topMost + ((fontSize + 20) * i); diff --git a/commands/edit-image-text/highway-sign.js b/commands/edit-image-text/highway-sign.js index a1c80ab6..85213e3b 100644 --- a/commands/edit-image-text/highway-sign.js +++ b/commands/edit-image-text/highway-sign.js @@ -49,7 +49,7 @@ module.exports = class HighwaySignCommand extends Command { ctx.textAlign = 'center'; ctx.textBaseline = 'top'; ctx.font = this.client.fonts.get('EHSMB.ttf').toCanvasString(18); - const lines = await wrapText(ctx, text.toUpperCase(), 178); + const lines = wrapText(ctx, text.toUpperCase(), 178); if (lines.length === 1) { ctx.fillText(lines[0], 318, 109); } else if (lines.length === 2) { diff --git a/commands/edit-image-text/jeopardy-question.js b/commands/edit-image-text/jeopardy-question.js index f6ebecf1..e355e1f7 100644 --- a/commands/edit-image-text/jeopardy-question.js +++ b/commands/edit-image-text/jeopardy-question.js @@ -48,7 +48,7 @@ module.exports = class JeopardyQuestionCommand extends Command { ctx.textBaseline = 'top'; ctx.fillStyle = 'white'; ctx.font = this.client.fonts.get('OPTIKorinna-Agency.otf').toCanvasString(62); - const lines = await wrapText(ctx, text.toUpperCase(), 813); + const lines = wrapText(ctx, text.toUpperCase(), 813); const topMost = (canvas.height / 2) - (((52 * lines.length) / 2) + ((20 * (lines.length - 1)) / 2)); for (let i = 0; i < lines.length; i++) { const height = topMost + ((52 + 20) * i); diff --git a/commands/edit-image-text/spongebob-time-card.js b/commands/edit-image-text/spongebob-time-card.js index a55c52a6..a1343398 100644 --- a/commands/edit-image-text/spongebob-time-card.js +++ b/commands/edit-image-text/spongebob-time-card.js @@ -58,7 +58,7 @@ module.exports = class SpongebobTimeCardCommand extends Command { ctx.textAlign = 'center'; ctx.textBaseline = 'top'; ctx.font = this.client.fonts.get('Spongeboytt1.ttf').toCanvasString(115); - const lines = await wrapText(ctx, text.toUpperCase(), 1800); + const lines = wrapText(ctx, text.toUpperCase(), 1800); const topMost = (canvas.height / 2) - (((115 * lines.length) / 2) + ((60 * (lines.length - 1)) / 2)); for (let i = 0; i < lines.length; i++) { const height = topMost + ((115 + 60) * i); diff --git a/commands/edit-image-text/tweet.js b/commands/edit-image-text/tweet.js index c748d20d..5604dc37 100644 --- a/commands/edit-image-text/tweet.js +++ b/commands/edit-image-text/tweet.js @@ -69,7 +69,7 @@ module.exports = class TweetCommand extends Command { const canvas = createCanvas(base1.width, base1.height + base2.height); const ctx = canvas.getContext('2d'); ctx.font = this.client.fonts.get('ChirpRegular.ttf').toCanvasString(23); - const lines = await wrapText(ctx, text, 710); + const lines = wrapText(ctx, text, 710); const linesLen = (23 * lines.length) + (7 * (lines.length - 1)) + 15; canvas.height += linesLen; let imageHeight = 0; @@ -194,7 +194,7 @@ module.exports = class TweetCommand extends Command { } async fillTextWithEmoji(ctx, text, x, y, maxLineLen, emojiSize) { - const wrapped = await wrapText(ctx, text, maxLineLen); + const wrapped = wrapText(ctx, text, maxLineLen); const emoji = text.match(emojiRegex()); if (!emoji) { ctx.fillText(wrapped.join('\n'), x, y); diff --git a/commands/edit-image-text/undertale.js b/commands/edit-image-text/undertale.js index f1c54623..fb492a3c 100644 --- a/commands/edit-image-text/undertale.js +++ b/commands/edit-image-text/undertale.js @@ -112,7 +112,7 @@ module.exports = class UndertaleCommand extends Command { ctx.font = this.client.fonts.get(font).toCanvasString(32); ctx.fillStyle = 'white'; ctx.textBaseline = 'top'; - const text = await wrapText(ctx, quote, 385); + const text = wrapText(ctx, quote, 385); const lines = text.length > 3 ? 3 : text.length; for (let i = 0; i < lines; i++) { ctx.fillText(text[i], 174, 22 + (22 * i) + (22 * i) + (space * i)); diff --git a/commands/edit-image-text/zero-dialogue.js b/commands/edit-image-text/zero-dialogue.js index 80d404b9..5ec36ea5 100644 --- a/commands/edit-image-text/zero-dialogue.js +++ b/commands/edit-image-text/zero-dialogue.js @@ -61,7 +61,7 @@ module.exports = class ZeroDialogueCommand extends Command { ctx.font = this.client.fonts.get('megaman_zero_dialog.ttf').toCanvasString(42); ctx.fillStyle = 'white'; ctx.textBaseline = 'top'; - let text = await wrapText(ctx, quote, 425); + let text = wrapText(ctx, quote, 425); text = text.length > 2 ? `${text.slice(0, 2).join('\n')}...` : text.join('\n'); ctx.fillText(text, 8, 8); return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'zero-dialogue.png' }] }); diff --git a/commands/edit-image/subtitle.js b/commands/edit-image/subtitle.js index f3d6f4bb..b9f49baa 100644 --- a/commands/edit-image/subtitle.js +++ b/commands/edit-image/subtitle.js @@ -50,7 +50,7 @@ module.exports = class SubtitleCommand extends Command { ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); ctx.fillStyle = 'yellow'; ctx.textAlign = 'center'; - const lines = await wrapText(ctx, text, base.width - 10); + const lines = wrapText(ctx, text, base.width - 10); if (!lines) return msg.reply('There\'s not enough width to subtitle this image.'); ctx.textBaseline = 'bottom'; const initial = base.height - ((lines.length - 1) * fontSize) - (fontSize / 2) - ((lines.length - 1) * 10); diff --git a/commands/edit-image/yu-gi-oh-gen.js b/commands/edit-image/yu-gi-oh-gen.js index ccaca2b8..26b4b187 100644 --- a/commands/edit-image/yu-gi-oh-gen.js +++ b/commands/edit-image/yu-gi-oh-gen.js @@ -138,7 +138,7 @@ module.exports = class YuGiOhGenCommand extends Command { } const font = monsterType === 'normal' ? 'Stone Serif LT Italic.ttf' : 'Matrix Book.ttf'; ctx.font = this.client.fonts.get(font).toCanvasString(27); - const wrappedEffect = await wrapText(ctx, effect, 690); + const wrappedEffect = wrapText(ctx, effect, 690); const trimmed = wrappedEffect.slice(0, type === 'monster' ? 4 : 6); ctx.fillText(trimmed.join('\n'), 63, 933 - (type === 'monster' ? 0 : 34)); ctx.font = this.client.fonts.get('Stone Serif.ttf').toCanvasString(22); diff --git a/commands/edit-meme/alert.js b/commands/edit-meme/alert.js index e004f705..f142580f 100644 --- a/commands/edit-meme/alert.js +++ b/commands/edit-meme/alert.js @@ -49,7 +49,7 @@ module.exports = class AlertCommand extends Command { ctx.font = this.client.fonts.get('SF-Pro-Display-Medium.otf').toCanvasString(30); ctx.fillStyle = '#1f1f1f'; ctx.textBaseline = 'top'; - let text = await wrapText(ctx, message, 540); + let text = wrapText(ctx, message, 540); text = text.length > 3 ? `${text.slice(0, 3).join('\n')}...` : text.join('\n'); ctx.fillText(text, 48, 178); return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'alert.png' }] }); diff --git a/commands/edit-meme/be-like-bill.js b/commands/edit-meme/be-like-bill.js index 4528ff35..61e5cd40 100644 --- a/commands/edit-meme/be-like-bill.js +++ b/commands/edit-meme/be-like-bill.js @@ -50,7 +50,7 @@ module.exports = class BeLikeBillCommand extends Command { const ctx = canvas.getContext('2d'); ctx.drawImage(base, 0, 0); ctx.font = this.client.fonts.get('arialbd.ttf').toCanvasString(23); - const text = await wrapText(ctx, texts[Math.floor(Math.random() * texts.length)].replaceAll('{{name}}', name), 569); + const text = wrapText(ctx, texts[Math.floor(Math.random() * texts.length)].replaceAll('{{name}}', name), 569); ctx.fillText(stripIndents` This is ${name}. diff --git a/commands/edit-meme/change-my-mind.js b/commands/edit-meme/change-my-mind.js index 2c4f5610..062172f3 100644 --- a/commands/edit-meme/change-my-mind.js +++ b/commands/edit-meme/change-my-mind.js @@ -54,7 +54,7 @@ module.exports = class ChangeMyMindCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const lines = await wrapText(ctx, text, 337); + const lines = wrapText(ctx, text, 337); ctx.fillText(lines.join('\n'), 142, 430, 337); ctx.rotate(24 * (Math.PI / 180)); return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'change-my-mind.png' }] }); diff --git a/commands/edit-meme/chi-idea.js b/commands/edit-meme/chi-idea.js index 33bad121..344b23c3 100644 --- a/commands/edit-meme/chi-idea.js +++ b/commands/edit-meme/chi-idea.js @@ -59,7 +59,7 @@ module.exports = class ChiIdeaCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('wildwordsroman.ttf').toCanvasString(fontSize); } - const lines = await wrapText(ctx, text, 83); + const lines = wrapText(ctx, text, 83); const topMost = 137 - (((fontSize * lines.length) / 2) + ((5 * (lines.length - 1)) / 2)); for (let i = 0; i < lines.length; i++) { const height = topMost + ((fontSize + 5) * i); diff --git a/commands/edit-meme/dear-liberals.js b/commands/edit-meme/dear-liberals.js index 5afea88d..6cd27b62 100644 --- a/commands/edit-meme/dear-liberals.js +++ b/commands/edit-meme/dear-liberals.js @@ -68,10 +68,10 @@ module.exports = class DearLiberalsCommand extends Command { ctx.rotate(-12.30 * (Math.PI / 180)); ctx.fillStyle = '#002046'; ctx.font = this.client.fonts.get('Oswald-SemiBold.ttf').toCanvasString(27); - const blueLines = await wrapText(ctx, blueText, 270); + const blueLines = wrapText(ctx, blueText, 270); ctx.fillText(blueLines.join('\n'), 207, 90); ctx.fillStyle = '#c31a41'; - const redLines = await wrapText(ctx, redText, 165); + const redLines = wrapText(ctx, redText, 165); ctx.fillText(redLines.join('\n'), 326, 236); return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'dear-liberals.png' }] }); } diff --git a/commands/edit-meme/drakeposting.js b/commands/edit-meme/drakeposting.js index 547093f6..699f556f 100644 --- a/commands/edit-meme/drakeposting.js +++ b/commands/edit-meme/drakeposting.js @@ -59,7 +59,7 @@ module.exports = class DrakepostingCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const nahLines = await wrapText(ctx, nah, 462); + const nahLines = wrapText(ctx, nah, 462); const nahTopMost = 256 - (((fontSize * nahLines.length) / 2) + ((10 * (nahLines.length - 1)) / 2)); for (let i = 0; i < nahLines.length; i++) { const height = nahTopMost + ((fontSize + 10) * i); @@ -71,7 +71,7 @@ module.exports = class DrakepostingCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const yeahLines = await wrapText(ctx, yeah, 462); + const yeahLines = wrapText(ctx, yeah, 462); const yeahTopMost = 768 - (((fontSize * yeahLines.length) / 2) + ((10 * (yeahLines.length - 1)) / 2)); for (let i = 0; i < yeahLines.length; i++) { const height = yeahTopMost + ((fontSize + 10) * i); diff --git a/commands/edit-meme/edd-facts-book.js b/commands/edit-meme/edd-facts-book.js index 486d4bf4..d172acb8 100644 --- a/commands/edit-meme/edd-facts-book.js +++ b/commands/edit-meme/edd-facts-book.js @@ -54,7 +54,7 @@ module.exports = class EddFactsBookCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const lines = await wrapText(ctx, fact, 183); + const lines = wrapText(ctx, fact, 183); ctx.fillText(lines.join('\n'), 119, 306, 183); ctx.rotate(-15 * (Math.PI / 180)); return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'edd-facts-book.png' }] }); diff --git a/commands/edit-meme/genie-rules.js b/commands/edit-meme/genie-rules.js index 3e06673e..e8f2d369 100644 --- a/commands/edit-meme/genie-rules.js +++ b/commands/edit-meme/genie-rules.js @@ -55,7 +55,7 @@ module.exports = class GenieRulesCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const lines = await wrapText(ctx, text, 381); + const lines = wrapText(ctx, text, 381); const topMost = 580 - (((fontSize * lines.length) / 2) + ((20 * (lines.length - 1)) / 2)); for (let i = 0; i < lines.length; i++) { const height = topMost + ((fontSize + 20) * i); diff --git a/commands/edit-meme/gru-plan.js b/commands/edit-meme/gru-plan.js index 39224791..6a981f76 100644 --- a/commands/edit-meme/gru-plan.js +++ b/commands/edit-meme/gru-plan.js @@ -72,7 +72,7 @@ module.exports = class GruPlanCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const lines = await wrapText(ctx, step, 252); + const lines = wrapText(ctx, step, 252); ctx.fillText(lines.join('\n'), x, y); i++; } diff --git a/commands/edit-meme/if-those-kids-could-read.js b/commands/edit-meme/if-those-kids-could-read.js index c1dd8976..b3f88fc9 100644 --- a/commands/edit-meme/if-those-kids-could-read.js +++ b/commands/edit-meme/if-those-kids-could-read.js @@ -53,7 +53,7 @@ module.exports = class IfThoseKidsCouldReadCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const lines = await wrapText(ctx, text, 160); + const lines = wrapText(ctx, text, 160); const topMost = 140 - (((fontSize * lines.length) / 2) + ((20 * (lines.length - 1)) / 2)); for (let i = 0; i < lines.length; i++) { const height = topMost + ((fontSize + 20) * i); diff --git a/commands/edit-meme/lisa-presentation.js b/commands/edit-meme/lisa-presentation.js index 41ed8c37..738efd16 100644 --- a/commands/edit-meme/lisa-presentation.js +++ b/commands/edit-meme/lisa-presentation.js @@ -54,7 +54,7 @@ module.exports = class LisaPresentationCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const lines = await wrapText(ctx, text, 330); + const lines = wrapText(ctx, text, 330); const topMost = 185 - (((fontSize * lines.length) / 2) + ((20 * (lines.length - 1)) / 2)); for (let i = 0; i < lines.length; i++) { const height = topMost + ((fontSize + 20) * i); diff --git a/commands/edit-meme/mario-bros-views.js b/commands/edit-meme/mario-bros-views.js index 8cafb977..7f55fd95 100644 --- a/commands/edit-meme/mario-bros-views.js +++ b/commands/edit-meme/mario-bros-views.js @@ -67,7 +67,7 @@ module.exports = class MarioBrosViewsCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const marioLines = await wrapText(ctx, mario, 200); + const marioLines = wrapText(ctx, mario, 200); const marioTopMost = 450 - (((fontSize * marioLines.length) / 2) + ((20 * (marioLines.length - 1)) / 2)); for (let i = 0; i < marioLines.length; i++) { ctx.strokeStyle = 'black'; @@ -82,7 +82,7 @@ module.exports = class MarioBrosViewsCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const luigiLines = await wrapText(ctx, luigi, 200); + const luigiLines = wrapText(ctx, luigi, 200); const luigiTopMost = 450 - (((fontSize * luigiLines.length) / 2) + ((20 * (luigiLines.length - 1)) / 2)); for (let i = 0; i < luigiLines.length; i++) { ctx.strokeStyle = 'black'; diff --git a/commands/edit-meme/meme-gen.js b/commands/edit-meme/meme-gen.js index 7f0b5009..5949456d 100644 --- a/commands/edit-meme/meme-gen.js +++ b/commands/edit-meme/meme-gen.js @@ -58,7 +58,7 @@ module.exports = class MemeGenCommand extends Command { ctx.fillStyle = 'white'; ctx.textAlign = 'center'; ctx.textBaseline = 'top'; - const topLines = await wrapText(ctx, top, base.width - 10); + const topLines = wrapText(ctx, top, base.width - 10); if (!topLines) return msg.reply('There\'s not enough width to make a meme with this image.'); for (let i = 0; i < topLines.length; i++) { const textHeight = (i * fontSize) + (i * 10); @@ -68,7 +68,7 @@ module.exports = class MemeGenCommand extends Command { ctx.fillStyle = 'white'; ctx.fillText(topLines[i], base.width / 2, textHeight); } - const bottomLines = await wrapText(ctx, bottom, base.width - 10); + const bottomLines = wrapText(ctx, bottom, base.width - 10); if (!bottomLines) return msg.reply('There\'s not enough width to make a meme with this image.'); ctx.textBaseline = 'bottom'; const initial = base.height - ((bottomLines.length - 1) * fontSize) - ((bottomLines.length - 1) * 10); diff --git a/commands/edit-meme/nike-ad.js b/commands/edit-meme/nike-ad.js index 7e30e3e5..e5bc20a8 100644 --- a/commands/edit-meme/nike-ad.js +++ b/commands/edit-meme/nike-ad.js @@ -67,7 +67,7 @@ module.exports = class NikeAdCommand extends Command { ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); ctx.fillStyle = 'white'; ctx.textAlign = 'center'; - const lines = await wrapText(ctx, `Believe in ${something}. Even if it means ${sacrifice}.`, data.width - 20); + const lines = wrapText(ctx, `Believe in ${something}. Even if it means ${sacrifice}.`, data.width - 20); if (!lines) return msg.reply('There\'s not enough width to make a Nike ad with this image.'); const initial = data.height / 2; for (let i = 0; i < lines.length; i++) { diff --git a/commands/edit-meme/panik-kalm-panik.js b/commands/edit-meme/panik-kalm-panik.js index b44ebfdb..be958287 100644 --- a/commands/edit-meme/panik-kalm-panik.js +++ b/commands/edit-meme/panik-kalm-panik.js @@ -59,7 +59,7 @@ module.exports = class PanikKalmPanikCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const panikLines = await wrapText(ctx, panik, 284); + const panikLines = wrapText(ctx, panik, 284); const panikTopMost = 130 - (((fontSize * panikLines.length) / 2) + ((10 * (panikLines.length - 1)) / 2)); for (let i = 0; i < panikLines.length; i++) { const height = panikTopMost + ((fontSize + 10) * i); @@ -71,7 +71,7 @@ module.exports = class PanikKalmPanikCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const kalmLines = await wrapText(ctx, kalm, 284); + const kalmLines = wrapText(ctx, kalm, 284); const kalmTopMost = 430 - (((fontSize * kalmLines.length) / 2) + ((10 * (kalmLines.length - 1)) / 2)); for (let i = 0; i < kalmLines.length; i++) { const height = kalmTopMost + ((fontSize + 10) * i); @@ -83,7 +83,7 @@ module.exports = class PanikKalmPanikCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const panik2Lines = await wrapText(ctx, panik2, 284); + const panik2Lines = wrapText(ctx, panik2, 284); const panik2TopMost = 730 - (((fontSize * panik2Lines.length) / 2) + ((10 * (panik2Lines.length - 1)) / 2)); for (let i = 0; i < panik2Lines.length; i++) { const height = panik2TopMost + ((fontSize + 10) * i); diff --git a/commands/edit-meme/pills.js b/commands/edit-meme/pills.js index 595af217..e58492cc 100644 --- a/commands/edit-meme/pills.js +++ b/commands/edit-meme/pills.js @@ -48,7 +48,7 @@ module.exports = class PillsCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const lines = await wrapText(ctx, text, 280); + const lines = wrapText(ctx, text, 280); const topMost = 455 - (((fontSize * lines.length) / 2) + ((10 * (lines.length - 1)) / 2)); for (let i = 0; i < lines.length; i++) { ctx.strokeStyle = 'white'; diff --git a/commands/edit-meme/plankton-plan.js b/commands/edit-meme/plankton-plan.js index 0805f756..6cdb0b1e 100644 --- a/commands/edit-meme/plankton-plan.js +++ b/commands/edit-meme/plankton-plan.js @@ -72,7 +72,7 @@ module.exports = class PlanktonPlanCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const lines = await wrapText(ctx, step, 155); + const lines = wrapText(ctx, step, 155); ctx.fillText(lines.join('\n'), x, y); i++; } diff --git a/commands/edit-meme/reaction-meme.js b/commands/edit-meme/reaction-meme.js index 18b83d36..3403532a 100644 --- a/commands/edit-meme/reaction-meme.js +++ b/commands/edit-meme/reaction-meme.js @@ -45,7 +45,7 @@ module.exports = class ReactionMemeCommand extends Command { const canvas = createCanvas(base.width, base.height); const ctx = canvas.getContext('2d'); ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(40); - const lines = await wrapText(ctx, text, base.width - 10); + const lines = wrapText(ctx, text, base.width - 10); const lineBreakLen = text.split('\n').length; const linesLen = (40 * lines.length) + (40 * (lineBreakLen - 1)) diff --git a/commands/edit-meme/scroll-of-truth.js b/commands/edit-meme/scroll-of-truth.js index 4b8fc4de..01e217be 100644 --- a/commands/edit-meme/scroll-of-truth.js +++ b/commands/edit-meme/scroll-of-truth.js @@ -54,7 +54,7 @@ module.exports = class ScrollOfTruthCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const lines = await wrapText(ctx, text, 217); + const lines = wrapText(ctx, text, 217); const topMost = 850 - (((fontSize * lines.length) / 2) + ((20 * (lines.length - 1)) / 2)); for (let i = 0; i < lines.length; i++) { const height = topMost + ((fontSize + 20) * i); diff --git a/commands/edit-meme/sonic-says.js b/commands/edit-meme/sonic-says.js index ddfe03f9..a4dae94d 100644 --- a/commands/edit-meme/sonic-says.js +++ b/commands/edit-meme/sonic-says.js @@ -53,7 +53,7 @@ module.exports = class SonicSaysCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const lines = await wrapText(ctx, text, 185); + const lines = wrapText(ctx, text, 185); ctx.fillStyle = 'white'; ctx.fillText(lines.join('\n'), 92, 67, 185); return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'sonic-says.png' }] }); diff --git a/commands/edit-meme/spiderman-pointing.js b/commands/edit-meme/spiderman-pointing.js index 014697f3..ca440b3b 100644 --- a/commands/edit-meme/spiderman-pointing.js +++ b/commands/edit-meme/spiderman-pointing.js @@ -60,7 +60,7 @@ module.exports = class SpidermanPointingCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const lines = await wrapText(ctx, first, 290); + const lines = wrapText(ctx, first, 290); const topMost = 189 - (((fontSize * lines.length) / 2) + ((10 * (lines.length - 1)) / 2)); for (let i = 0; i < lines.length; i++) { ctx.strokeStyle = 'black'; @@ -75,7 +75,7 @@ module.exports = class SpidermanPointingCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const lines2 = await wrapText(ctx, second, 290); + const lines2 = wrapText(ctx, second, 290); const topMost2 = 190 - (((fontSize * lines2.length) / 2) + ((10 * (lines2.length - 1)) / 2)); for (let i = 0; i < lines2.length; i++) { ctx.strokeStyle = 'black'; diff --git a/commands/edit-meme/spongebob-burn.js b/commands/edit-meme/spongebob-burn.js index 9799cd8a..c487d243 100644 --- a/commands/edit-meme/spongebob-burn.js +++ b/commands/edit-meme/spongebob-burn.js @@ -60,7 +60,7 @@ module.exports = class SpongebobBurnCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const lines = await wrapText(ctx, burn, 180); + const lines = wrapText(ctx, burn, 180); ctx.fillText(lines.join('\n'), 55, 103); ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(25); ctx.fillText(person, 382, 26); diff --git a/commands/edit-meme/that-sign-wont-stop-me.js b/commands/edit-meme/that-sign-wont-stop-me.js index cc5f25ff..669173d6 100644 --- a/commands/edit-meme/that-sign-wont-stop-me.js +++ b/commands/edit-meme/that-sign-wont-stop-me.js @@ -54,7 +54,7 @@ module.exports = class ThatSignWontStopMeCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('TragicMarker.otf').toCanvasString(fontSize); } - const lines = await wrapText(ctx, text, 334); + const lines = wrapText(ctx, text, 334); const topMost = 240 - (((fontSize * lines.length) / 2) + ((10 * (lines.length - 1)) / 2)); for (let i = 0; i < lines.length; i++) { const height = topMost + ((fontSize + 10) * i); @@ -66,7 +66,7 @@ module.exports = class ThatSignWontStopMeCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('TragicMarker.otf').toCanvasString(fontSize); } - const bLines = await wrapText(ctx, text, 88); + const bLines = wrapText(ctx, text, 88); const bTopMost = 645 - (((fontSize * bLines.length) / 2) + ((2 * (bLines.length - 1)) / 2)); for (let i = 0; i < bLines.length; i++) { const height = bTopMost + ((fontSize + 2) * i); diff --git a/commands/edit-meme/tuxedo-pooh.js b/commands/edit-meme/tuxedo-pooh.js index 4ab41a8a..8f239b6c 100644 --- a/commands/edit-meme/tuxedo-pooh.js +++ b/commands/edit-meme/tuxedo-pooh.js @@ -59,7 +59,7 @@ module.exports = class TuxedoPoohCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const normalLines = await wrapText(ctx, normal, 440); + const normalLines = wrapText(ctx, normal, 440); const normalTopMost = 145 - (((fontSize * normalLines.length) / 2) + ((10 * (normalLines.length - 1)) / 2)); for (let i = 0; i < normalLines.length; i++) { const height = normalTopMost + ((fontSize + 10) * i); @@ -71,7 +71,7 @@ module.exports = class TuxedoPoohCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const tuxedoLines = await wrapText(ctx, tuxedo, 440); + const tuxedoLines = wrapText(ctx, tuxedo, 440); const tuxedoTopMost = 436 - (((fontSize * tuxedoLines.length) / 2) + ((10 * (tuxedoLines.length - 1)) / 2)); for (let i = 0; i < tuxedoLines.length; i++) { const height = tuxedoTopMost + ((fontSize + 10) * i); diff --git a/commands/edit-meme/two-buttons.js b/commands/edit-meme/two-buttons.js index e2866efd..a0ba77e3 100644 --- a/commands/edit-meme/two-buttons.js +++ b/commands/edit-meme/two-buttons.js @@ -59,7 +59,7 @@ module.exports = class TwoButtonsCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const firstLines = await wrapText(ctx, first, 183); + const firstLines = wrapText(ctx, first, 183); let lineOffset = 0; for (let i = 0; i < firstLines.length; i++) { ctx.fillText(firstLines[i], 25 + lineOffset, 116 + (fontSize * i) + (10 * i), 183); @@ -71,7 +71,7 @@ module.exports = class TwoButtonsCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const secondLines = await wrapText(ctx, second, 118); + const secondLines = wrapText(ctx, second, 118); lineOffset = 0; for (let i = 0; i < secondLines.length; i++) { ctx.fillText(secondLines[i], 254 + lineOffset, 130 + (fontSize * i) + (10 * i), 118); diff --git a/commands/edit-meme/whiteboard.js b/commands/edit-meme/whiteboard.js index c07d724f..d4315367 100644 --- a/commands/edit-meme/whiteboard.js +++ b/commands/edit-meme/whiteboard.js @@ -58,7 +58,7 @@ module.exports = class WhiteboardCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const initialLines = await wrapText(ctx, initial, 405); + const initialLines = wrapText(ctx, initial, 405); const initialTopMost = 111 - (((fontSize * initialLines.length) / 2) + ((10 * (initialLines.length - 1)) / 2)); for (let i = 0; i < initialLines.length; i++) { const height = initialTopMost + ((fontSize + 10) * i); @@ -70,7 +70,7 @@ module.exports = class WhiteboardCommand extends Command { fontSize--; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(fontSize); } - const resolveLines = await wrapText(ctx, resolved, 367); + const resolveLines = wrapText(ctx, resolved, 367); const resolveTopMost = 500 - (((fontSize * resolveLines.length) / 2) + ((10 * (resolveLines.length - 1)) / 2)); for (let i = 0; i < resolveLines.length; i++) { const height = resolveTopMost + ((fontSize + 10) * i); diff --git a/commands/games-sp/jeopardy.js b/commands/games-sp/jeopardy.js index 94ac900c..135e1005 100644 --- a/commands/games-sp/jeopardy.js +++ b/commands/games-sp/jeopardy.js @@ -79,7 +79,7 @@ module.exports = class JeopardyCommand extends Command { ctx.textBaseline = 'top'; ctx.fillStyle = 'white'; ctx.font = this.client.fonts.get('OPTIKorinna-Agency.otf').toCanvasString(62); - const lines = await wrapText(ctx, question.toUpperCase(), 813); + const lines = wrapText(ctx, question.toUpperCase(), 813); const topMost = (canvas.height / 2) - (((52 * lines.length) / 2) + ((20 * (lines.length - 1)) / 2)); for (let i = 0; i < lines.length; i++) { const height = topMost + ((52 + 20) * i);