From 6dbd29cb03e2bbd530ece7fafe2f722eaf404a28 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Fri, 3 May 2024 10:28:55 -0400 Subject: [PATCH] Fix --- commands/analyze/dominant-color.js | 2 +- commands/analyze/faces.js | 2 +- commands/edit-avatar/avatar-fusion.js | 2 +- commands/edit-avatar/hat.js | 2 +- commands/edit-avatar/he-lives-in-you.js | 2 +- commands/edit-avatar/hearts.js | 2 +- commands/edit-avatar/i-have-the-power.js | 2 +- commands/edit-avatar/rip.js | 2 +- commands/edit-avatar/steam-now-playing.js | 2 +- commands/edit-face/anime-eyes.js | 2 +- commands/edit-face/danny-devito.js | 2 +- commands/edit-face/emoji-face.js | 2 +- commands/edit-face/eyes.js | 2 +- commands/edit-face/shrek.js | 2 +- commands/edit-image-text/ace-attorney.js | 2 +- commands/edit-image-text/achievement.js | 2 +- commands/edit-image-text/caution.js | 2 +- commands/edit-image-text/certificate.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/hollywood-star.js | 2 +- commands/edit-image-text/jeopardy-question.js | 2 +- commands/edit-image-text/license-plate.js | 2 +- commands/edit-image-text/speed-limit.js | 2 +- commands/edit-image-text/spongebob-time-card.js | 2 +- commands/edit-image-text/tweet.js | 2 +- commands/edit-image-text/undertale.js | 2 +- commands/edit-image-text/zero-dialogue.js | 2 +- commands/edit-image/analog-clock.js | 2 +- commands/edit-image/approved.js | 2 +- commands/edit-image/blur.js | 2 +- commands/edit-image/bob-ross.js | 2 +- commands/edit-image/brazzers.js | 2 +- commands/edit-image/chocolate-milk.js | 2 +- commands/edit-image/circle.js | 2 +- commands/edit-image/color.js | 2 +- commands/edit-image/communist.js | 2 +- commands/edit-image/contrast.js | 2 +- commands/edit-image/crop-to-content.js | 2 +- commands/edit-image/desaturate.js | 2 +- commands/edit-image/dexter.js | 2 +- commands/edit-image/distort.js | 2 +- commands/edit-image/fire-frame.js | 2 +- commands/edit-image/fish-eye.js | 2 +- commands/edit-image/frame.js | 2 +- commands/edit-image/ghost.js | 2 +- commands/edit-image/glass-shatter.js | 2 +- commands/edit-image/glitch.js | 2 +- commands/edit-image/greyscale.js | 2 +- commands/edit-image/gun.js | 2 +- commands/edit-image/hands.js | 2 +- commands/edit-image/ifunny.js | 2 +- commands/edit-image/invert.js | 2 +- commands/edit-image/lego-icon.js | 2 +- commands/edit-image/mirror.js | 2 +- commands/edit-image/motion-blur.js | 2 +- commands/edit-image/pixelize.js | 2 +- commands/edit-image/police-tape.js | 2 +- commands/edit-image/rainbow.js | 2 +- commands/edit-image/rejected.js | 2 +- commands/edit-image/resize.js | 2 +- commands/edit-image/rotate.js | 2 +- commands/edit-image/sepia.js | 2 +- commands/edit-image/silhouette.js | 2 +- commands/edit-image/sip.js | 2 +- commands/edit-image/snapchat.js | 2 +- commands/edit-image/spotify-now-playing.js | 2 +- commands/edit-image/square.js | 2 +- commands/edit-image/steam-card.js | 2 +- commands/edit-image/subtitle.js | 2 +- commands/edit-image/tint.js | 2 +- commands/edit-image/vignette.js | 2 +- commands/edit-image/wanted.js | 2 +- commands/edit-image/wild-pokemon.js | 2 +- commands/edit-image/you-died.js | 2 +- commands/edit-meme/3000-years.js | 2 +- commands/edit-meme/alert.js | 2 +- commands/edit-meme/bart-chalkboard.js | 2 +- commands/edit-meme/be-like-bill.js | 2 +- commands/edit-meme/beautiful.js | 2 +- commands/edit-meme/boardroom-meeting.js | 2 +- commands/edit-meme/catch.js | 2 +- commands/edit-meme/challenger.js | 2 +- commands/edit-meme/change-my-mind.js | 2 +- commands/edit-meme/chi-idea.js | 2 +- commands/edit-meme/crush.js | 2 +- commands/edit-meme/cursed-sponge.js | 2 +- commands/edit-meme/dear-liberals.js | 2 +- commands/edit-meme/demotivational.js | 2 +- commands/edit-meme/dislike.js | 2 +- commands/edit-meme/distracted-boyfriend.js | 2 +- commands/edit-meme/drakeposting.js | 2 +- commands/edit-meme/edd-facts-book.js | 2 +- commands/edit-meme/enslaved.js | 2 +- commands/edit-meme/food-broke.js | 2 +- commands/edit-meme/for-five-hours.js | 2 +- commands/edit-meme/genie-rules.js | 2 +- commands/edit-meme/girl-worth-fighting-for.js | 2 +- commands/edit-meme/gru-plan.js | 2 +- commands/edit-meme/i-cant-believe.js | 2 +- commands/edit-meme/i-fear-no-man.js | 2 +- commands/edit-meme/if-those-kids-could-read.js | 2 +- commands/edit-meme/kyon-gun.js | 2 +- commands/edit-meme/like.js | 2 +- commands/edit-meme/lisa-presentation.js | 2 +- commands/edit-meme/look-at-this-photograph.js | 2 +- commands/edit-meme/look-what-karen-have.js | 2 +- commands/edit-meme/mario-bros-views.js | 2 +- commands/edit-meme/meme-gen.js | 2 +- commands/edit-meme/metamorphosis.js | 2 +- commands/edit-meme/my-collection-grows.js | 2 +- commands/edit-meme/new-password.js | 2 +- commands/edit-meme/nike-ad.js | 2 +- commands/edit-meme/panik-kalm-panik.js | 2 +- commands/edit-meme/phoebe-teaching-joey.js | 2 +- commands/edit-meme/pills.js | 2 +- commands/edit-meme/plankton-plan.js | 2 +- commands/edit-meme/raw.js | 2 +- commands/edit-meme/reaction-meme.js | 2 +- commands/edit-meme/scroll-of-truth.js | 2 +- commands/edit-meme/sexy-singles.js | 2 +- commands/edit-meme/skyrim-skill.js | 2 +- commands/edit-meme/sonic-says.js | 2 +- commands/edit-meme/sora-selfie.js | 2 +- commands/edit-meme/sos.js | 2 +- commands/edit-meme/spiderman-pointing.js | 2 +- commands/edit-meme/spongebob-burn.js | 2 +- commands/edit-meme/that-sign-wont-stop-me.js | 2 +- commands/edit-meme/this-guy.js | 2 +- commands/edit-meme/thug-life.js | 2 +- commands/edit-meme/to-be-continued.js | 2 +- commands/edit-meme/tuxedo-pooh.js | 2 +- commands/edit-meme/two-buttons.js | 2 +- commands/edit-meme/ugly.js | 2 +- commands/edit-meme/ultimate-tattoo.js | 2 +- commands/edit-meme/vietnam-flashbacks.js | 2 +- commands/edit-meme/whiteboard.js | 2 +- commands/edit-meme/worse-than-hitler.js | 2 +- commands/edit-meme/worthless.js | 2 +- commands/games-mp/car-race.js | 2 +- commands/games-mp/chess.js | 2 +- commands/games-sp/captcha.js | 2 +- commands/games-sp/horse-race.js | 2 +- commands/games-sp/jeopardy.js | 2 +- commands/games-sp/pokemon-advantage.js | 2 +- commands/games-sp/typing-test.js | 2 +- commands/games-sp/whos-that-pokemon.js | 2 +- commands/info/emoji-image.js | 2 +- commands/pokedex/pokedex-box-sprite.js | 2 +- commands/random-seed/friendship.js | 2 +- commands/random-seed/ship.js | 2 +- commands/random-seed/think-of.js | 2 +- commands/search/periodic-table.js | 2 +- structures/pokemon/Pokemon.js | 2 +- util/Canvas.js | 3 +-- 158 files changed, 158 insertions(+), 159 deletions(-) diff --git a/commands/analyze/dominant-color.js b/commands/analyze/dominant-color.js index c326b3de..32172679 100644 --- a/commands/analyze/dominant-color.js +++ b/commands/analyze/dominant-color.js @@ -37,7 +37,7 @@ module.exports = class DominantColorCommand extends Command { ctx.fillRect(0, 0, canvas.width, canvas.height); const name = ntc.name(hexColor); return msg.say(`${hexColor.toUpperCase()} - ${name[1]}`, { - files: [{ attachment: canvas.toBuffer(), name: 'dominant-color.png' }] + files: [{ attachment: canvas.toBuffer('image/png'), name: 'dominant-color.png' }] }); } }; diff --git a/commands/analyze/faces.js b/commands/analyze/faces.js index 98451087..feee488f 100644 --- a/commands/analyze/faces.js +++ b/commands/analyze/faces.js @@ -40,6 +40,6 @@ module.exports = class FacesCommand extends Command { ctx.fillRect(face.box.xMin, face.box.yMax, face.box.width + lineSize, lineSize); ctx.fillRect(face.box.xMax, face.box.yMin, lineSize, face.box.height); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'faces.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'faces.png' }] }); } }; diff --git a/commands/edit-avatar/avatar-fusion.js b/commands/edit-avatar/avatar-fusion.js index 2a492487..85ebc361 100644 --- a/commands/edit-avatar/avatar-fusion.js +++ b/commands/edit-avatar/avatar-fusion.js @@ -42,6 +42,6 @@ module.exports = class AvatarFusionCommand extends Command { ctx.globalAlpha = 0.5; ctx.drawImage(baseAvatar, 0, 0); ctx.drawImage(overlayAvatar, 0, 0, baseAvatar.width, baseAvatar.height); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'avatar-fusion.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'avatar-fusion.png' }] }); } }; diff --git a/commands/edit-avatar/hat.js b/commands/edit-avatar/hat.js index 1e77c682..7fc25901 100644 --- a/commands/edit-avatar/hat.js +++ b/commands/edit-avatar/hat.js @@ -154,6 +154,6 @@ module.exports = class HatCommand extends Command { ctx.drawImage(avatar, 0, 0); ctx.drawImage(base, 0, 0, avatar.width, avatar.height); const comment = user.id === this.client.user.id ? hat.commentMe : hat.comment.replace(/{{user}}/g, user.tag); - return msg.say(comment, { files: [{ attachment: canvas.toBuffer(), name: `${type}-hat.png` }] }); + return msg.say(comment, { files: [{ attachment: canvas.toBuffer('image/png'), name: `${type}-hat.png` }] }); } }; diff --git a/commands/edit-avatar/he-lives-in-you.js b/commands/edit-avatar/he-lives-in-you.js index 64f5d1dd..09b35a2e 100644 --- a/commands/edit-avatar/he-lives-in-you.js +++ b/commands/edit-avatar/he-lives-in-you.js @@ -47,6 +47,6 @@ module.exports = class HeLivesInYouCommand extends Command { ctx.rotate(-24 * (Math.PI / 180)); drawImageWithTint(ctx, avatar, '#00115d', 75, 160, 130, 150); ctx.rotate(24 * (Math.PI / 180)); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'he-lives-in-you.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'he-lives-in-you.png' }] }); } }; diff --git a/commands/edit-avatar/hearts.js b/commands/edit-avatar/hearts.js index 14d20a22..9c5577bb 100644 --- a/commands/edit-avatar/hearts.js +++ b/commands/edit-avatar/hearts.js @@ -45,6 +45,6 @@ module.exports = class HeartsCommand extends Command { const ctx = canvas.getContext('2d'); drawImageWithTint(ctx, avatar, 'deeppink', 0, 0, avatar.width, avatar.height); ctx.drawImage(base, 0, 0, avatar.width, avatar.height); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'hearts.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'hearts.png' }] }); } }; diff --git a/commands/edit-avatar/i-have-the-power.js b/commands/edit-avatar/i-have-the-power.js index 5dcd261b..c3a7d046 100644 --- a/commands/edit-avatar/i-have-the-power.js +++ b/commands/edit-avatar/i-have-the-power.js @@ -45,6 +45,6 @@ module.exports = class IHaveThePowerCommand extends Command { ctx.rotate(18.3 * (Math.PI / 180)); ctx.drawImage(avatar, 332, -125, 175, 175); ctx.rotate(-18.3 * (Math.PI / 180)); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'i-have-the-power.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'i-have-the-power.png' }] }); } }; diff --git a/commands/edit-avatar/rip.js b/commands/edit-avatar/rip.js index 9ecdd074..2d32aa00 100644 --- a/commands/edit-avatar/rip.js +++ b/commands/edit-avatar/rip.js @@ -67,6 +67,6 @@ module.exports = class RipCommand extends Command { if (cause) ctx.fillText(cause, 438, 910, 500); ctx.font = this.client.fonts.get('CoffinStone.otf').toCanvasString(37); ctx.fillText('In Loving Memory of', 438, 292); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'rip.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'rip.png' }] }); } }; diff --git a/commands/edit-avatar/steam-now-playing.js b/commands/edit-avatar/steam-now-playing.js index 38bfd390..2607ef81 100644 --- a/commands/edit-avatar/steam-now-playing.js +++ b/commands/edit-avatar/steam-now-playing.js @@ -58,6 +58,6 @@ module.exports = class SteamNowPlayingCommand extends Command { ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(14); ctx.fillText(user.username, 80, 34); ctx.fillText(shortenText(ctx, game, 200), 80, 70); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'steam-now-playing.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'steam-now-playing.png' }] }); } }; diff --git a/commands/edit-face/anime-eyes.js b/commands/edit-face/anime-eyes.js index 418ff1df..beda7d8c 100644 --- a/commands/edit-face/anime-eyes.js +++ b/commands/edit-face/anime-eyes.js @@ -47,6 +47,6 @@ module.exports = class AnimeEyesCommand extends Command { ctx.drawImage(rightEye, leftEyeX, leftEyeY, eyeWidth, eyeHeight); ctx.drawImage(leftEye, rightEyeX, rightEyeY, eyeWidth, eyeHeight); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'anime-eyes.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'anime-eyes.png' }] }); } }; diff --git a/commands/edit-face/danny-devito.js b/commands/edit-face/danny-devito.js index ed2c5d99..a77a4173 100644 --- a/commands/edit-face/danny-devito.js +++ b/commands/edit-face/danny-devito.js @@ -52,6 +52,6 @@ module.exports = class DannyDevitoCommand extends Command { height * 1.4 ); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'danny-devito.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'danny-devito.png' }] }); } }; diff --git a/commands/edit-face/emoji-face.js b/commands/edit-face/emoji-face.js index 292df994..62ea5a9d 100644 --- a/commands/edit-face/emoji-face.js +++ b/commands/edit-face/emoji-face.js @@ -63,6 +63,6 @@ module.exports = class EmojiFaceCommand extends Command { height * 1.4 ); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'emoji-face.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'emoji-face.png' }] }); } }; diff --git a/commands/edit-face/eyes.js b/commands/edit-face/eyes.js index e6e45fa5..ed3d653b 100644 --- a/commands/edit-face/eyes.js +++ b/commands/edit-face/eyes.js @@ -45,6 +45,6 @@ module.exports = class EyesCommand extends Command { ctx.drawImage(eyes, leftEyeX, leftEyeY, eyeWidth, eyeHeight); ctx.drawImage(eyes, rightEyeX, rightEyeY, eyeWidth, eyeHeight); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'eyes.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'eyes.png' }] }); } }; diff --git a/commands/edit-face/shrek.js b/commands/edit-face/shrek.js index 3146bf56..839d8c17 100644 --- a/commands/edit-face/shrek.js +++ b/commands/edit-face/shrek.js @@ -52,6 +52,6 @@ module.exports = class ShrekCommand extends Command { height * 1.5 ); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'shrek.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'shrek.png' }] }); } }; diff --git a/commands/edit-image-text/ace-attorney.js b/commands/edit-image-text/ace-attorney.js index 5a2f2e5c..57ee7f8e 100644 --- a/commands/edit-image-text/ace-attorney.js +++ b/commands/edit-image-text/ace-attorney.js @@ -83,6 +83,6 @@ module.exports = class AceAttorneyCommand extends Command { let text = wrapText(ctx, quote, 242); text = text.length > 5 ? `${text.slice(0, 5).join('\n')}...` : text.join('\n'); fillTextWithBreaks(ctx, text, 7, 199); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: `ace-attorney-${character}.png` }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: `ace-attorney-${character}.png` }] }); } }; diff --git a/commands/edit-image-text/achievement.js b/commands/edit-image-text/achievement.js index 8348d447..25bff751 100644 --- a/commands/edit-image-text/achievement.js +++ b/commands/edit-image-text/achievement.js @@ -56,6 +56,6 @@ module.exports = class AchievementCommand extends Command { ctx.fillText('Achievement Get!', 60, 40); ctx.fillStyle = '#ffffff'; ctx.fillText(shortenText(ctx, text, 230), 60, 60); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'achievement.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'achievement.png' }] }); } }; diff --git a/commands/edit-image-text/caution.js b/commands/edit-image-text/caution.js index 569ed5a7..31f78afc 100644 --- a/commands/edit-image-text/caution.js +++ b/commands/edit-image-text/caution.js @@ -60,6 +60,6 @@ module.exports = class CautionCommand extends Command { const height = topMost + ((fontSize + 20) * i); ctx.fillText(lines[i], base.width / 2, height); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'caution.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'caution.png' }] }); } }; diff --git a/commands/edit-image-text/certificate.js b/commands/edit-image-text/certificate.js index 2365ea1a..228d11d3 100644 --- a/commands/edit-image-text/certificate.js +++ b/commands/edit-image-text/certificate.js @@ -63,6 +63,6 @@ module.exports = class CertificateCommand extends Command { ctx.fillText(reason, 518, 273); ctx.fillText(name, 518, 419); ctx.fillText(moment().format('MM/DD/YYYY'), 309, 503); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'certificate.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'certificate.png' }] }); } }; diff --git a/commands/edit-image-text/chinese-restaurant.js b/commands/edit-image-text/chinese-restaurant.js index 73b62f52..6458ef27 100644 --- a/commands/edit-image-text/chinese-restaurant.js +++ b/commands/edit-image-text/chinese-restaurant.js @@ -65,6 +65,6 @@ module.exports = class ChineseRestaurantCommand extends Command { ctx.fillText(lines[2], base.width / 2, 315); ctx.fillText(lines[3], base.width / 2, 342); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'chinese-restaurant.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'chinese-restaurant.png' }] }); } }; diff --git a/commands/edit-image-text/danger.js b/commands/edit-image-text/danger.js index aa937aa2..4c184723 100644 --- a/commands/edit-image-text/danger.js +++ b/commands/edit-image-text/danger.js @@ -60,6 +60,6 @@ module.exports = class DangerCommand extends Command { const height = topMost + ((fontSize + 20) * i); ctx.fillText(lines[i], base.width / 2, height); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'danger.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'danger.png' }] }); } }; diff --git a/commands/edit-image-text/font.js b/commands/edit-image-text/font.js index 4af2ea9f..9589f63a 100644 --- a/commands/edit-image-text/font.js +++ b/commands/edit-image-text/font.js @@ -47,6 +47,6 @@ module.exports = class FontCommand extends Command { ctx.fillRect(0, 0, canvas.width, canvas.height); ctx.fillStyle = 'black'; fillTextWithBreaks(ctx, lines.join('\n'), 25, 25); - return canvas.toBuffer(); + return canvas.toBuffer('image/png'); } }; diff --git a/commands/edit-image-text/gandhi-quote.js b/commands/edit-image-text/gandhi-quote.js index 592435f2..d2f5a064 100644 --- a/commands/edit-image-text/gandhi-quote.js +++ b/commands/edit-image-text/gandhi-quote.js @@ -55,6 +55,6 @@ module.exports = class GandhiQuoteCommand extends Command { const height = topMost + ((fontSize + 20) * i); ctx.fillText(lines[i], 395, height); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'gandhi-quote.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'gandhi-quote.png' }] }); } }; diff --git a/commands/edit-image-text/highway-sign.js b/commands/edit-image-text/highway-sign.js index 17fe6963..bf798cb1 100644 --- a/commands/edit-image-text/highway-sign.js +++ b/commands/edit-image-text/highway-sign.js @@ -65,6 +65,6 @@ module.exports = class HighwaySignCommand extends Command { ctx.fillText(lines[2], 318, 128); ctx.fillText(lines[3], 318, 147); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'highway-sign.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'highway-sign.png' }] }); } }; diff --git a/commands/edit-image-text/hollywood-star.js b/commands/edit-image-text/hollywood-star.js index 5be49549..ce4ebb87 100644 --- a/commands/edit-image-text/hollywood-star.js +++ b/commands/edit-image-text/hollywood-star.js @@ -55,6 +55,6 @@ module.exports = class HollywoodStarCommand extends Command { ctx.textAlign = 'center'; ctx.textBaseline = 'top'; ctx.fillText(name.toLowerCase(), 288, 140); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'hollywood-star.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'hollywood-star.png' }] }); } }; diff --git a/commands/edit-image-text/jeopardy-question.js b/commands/edit-image-text/jeopardy-question.js index aaef65ee..917dee3e 100644 --- a/commands/edit-image-text/jeopardy-question.js +++ b/commands/edit-image-text/jeopardy-question.js @@ -57,6 +57,6 @@ module.exports = class JeopardyQuestionCommand extends Command { ctx.fillStyle = 'white'; ctx.fillText(lines[i], canvas.width / 2, height); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'jeopardy-question.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'jeopardy-question.png' }] }); } }; diff --git a/commands/edit-image-text/license-plate.js b/commands/edit-image-text/license-plate.js index 1d96848c..42d0b6e9 100644 --- a/commands/edit-image-text/license-plate.js +++ b/commands/edit-image-text/license-plate.js @@ -48,6 +48,6 @@ module.exports = class LicensePlateCommand extends Command { ctx.textBaseline = 'middle'; ctx.font = this.client.fonts.get('LicensePlate.ttf').toCanvasString(180); ctx.fillText(text.toUpperCase(), base.width / 2, base.height / 2, 700); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'license-plate.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'license-plate.png' }] }); } }; diff --git a/commands/edit-image-text/speed-limit.js b/commands/edit-image-text/speed-limit.js index 3c276e1a..9bdf413c 100644 --- a/commands/edit-image-text/speed-limit.js +++ b/commands/edit-image-text/speed-limit.js @@ -50,6 +50,6 @@ module.exports = class SpeedLimitCommand extends Command { ctx.font = this.client.fonts.get('HWYGWDE.ttf').toCanvasString(360); ctx.fillStyle = 'black'; ctx.fillText(limit.toUpperCase(), 313, 356, 475); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'speed-limit.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'speed-limit.png' }] }); } }; diff --git a/commands/edit-image-text/spongebob-time-card.js b/commands/edit-image-text/spongebob-time-card.js index 369f7db2..ef29f8b9 100644 --- a/commands/edit-image-text/spongebob-time-card.js +++ b/commands/edit-image-text/spongebob-time-card.js @@ -85,6 +85,6 @@ module.exports = class SpongebobTimeCardCommand extends Command { ctx.fillStyle = 'black'; ctx.fillText(lines[i], canvas.width / 2, height); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'spongebob-time-card.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'spongebob-time-card.png' }] }); } }; diff --git a/commands/edit-image-text/tweet.js b/commands/edit-image-text/tweet.js index c23fac20..330fdcb9 100644 --- a/commands/edit-image-text/tweet.js +++ b/commands/edit-image-text/tweet.js @@ -202,7 +202,7 @@ module.exports = class TweetCommand extends Command { ctx.clip(); } ctx.drawImage(avatar, 17, 84, 52, 52); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'tweet.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'tweet.png' }] }); } roundedPath(ctx, radius, x, y, imageWidth, imageHeight) { diff --git a/commands/edit-image-text/undertale.js b/commands/edit-image-text/undertale.js index 7f23cb21..cabfdc9d 100644 --- a/commands/edit-image-text/undertale.js +++ b/commands/edit-image-text/undertale.js @@ -117,6 +117,6 @@ module.exports = class UndertaleCommand extends Command { for (let i = 0; i < lines; i++) { ctx.fillText(text[i], 174, 22 + (22 * i) + (22 * i) + (space * i)); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: `undertale-${character}.png` }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: `undertale-${character}.png` }] }); } }; diff --git a/commands/edit-image-text/zero-dialogue.js b/commands/edit-image-text/zero-dialogue.js index c93b8808..c89b95ac 100644 --- a/commands/edit-image-text/zero-dialogue.js +++ b/commands/edit-image-text/zero-dialogue.js @@ -64,6 +64,6 @@ module.exports = class ZeroDialogueCommand extends Command { let text = wrapText(ctx, quote, 425); text = text.length > 2 ? `${text.slice(0, 2).join('\n')}...` : text.join('\n'); fillTextWithBreaks(ctx, text, 8, 8); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'zero-dialogue.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'zero-dialogue.png' }] }); } }; diff --git a/commands/edit-image/analog-clock.js b/commands/edit-image/analog-clock.js index 8f7d9814..fb42a28f 100644 --- a/commands/edit-image/analog-clock.js +++ b/commands/edit-image/analog-clock.js @@ -60,7 +60,7 @@ module.exports = class AnalogClockCommand extends Command { this.drawNumbers(ctx, radius); this.drawTime(ctx, radius, time); return msg.say(`${subMain || sub || main}${parens}`, { - files: [{ attachment: canvas.toBuffer(), name: 'analog-clock.png' }] + files: [{ attachment: canvas.toBuffer('image/png'), name: 'analog-clock.png' }] }); } diff --git a/commands/edit-image/approved.js b/commands/edit-image/approved.js index ee7a92f5..035e4eaf 100644 --- a/commands/edit-image/approved.js +++ b/commands/edit-image/approved.js @@ -45,7 +45,7 @@ module.exports = class ApprovedCommand extends Command { ctx.drawImage(data, 0, 0); const { x, y, width, height } = centerImage(base, data); ctx.drawImage(base, x, y, width, height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'approved.png' }] }); } diff --git a/commands/edit-image/blur.js b/commands/edit-image/blur.js index 8badc026..f6bbf095 100644 --- a/commands/edit-image/blur.js +++ b/commands/edit-image/blur.js @@ -40,7 +40,7 @@ module.exports = class BlurCommand extends Command { const ctx = canvas.getContext('2d'); ctx.drawImage(data, 0, 0); stackBlur.canvasRGBA(canvas, 0, 0, canvas.width, canvas.height, radius); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'blur.png' }] }); } diff --git a/commands/edit-image/bob-ross.js b/commands/edit-image/bob-ross.js index ca6f7579..487561df 100644 --- a/commands/edit-image/bob-ross.js +++ b/commands/edit-image/bob-ross.js @@ -52,6 +52,6 @@ module.exports = class BobRossCommand extends Command { const { x, y, width, height } = centerImagePart(data, 440, 440, 15, 20); ctx.drawImage(data, x, y, width, height); ctx.drawImage(base, 0, 0); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'bob-ross.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'bob-ross.png' }] }); } }; diff --git a/commands/edit-image/brazzers.js b/commands/edit-image/brazzers.js index ae9f0531..862ad909 100644 --- a/commands/edit-image/brazzers.js +++ b/commands/edit-image/brazzers.js @@ -45,7 +45,7 @@ module.exports = class BrazzersCommand extends Command { const width = data.width / 3; const height = Math.round(width / ratio); ctx.drawImage(base, 0, data.height - height, width, height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'brazzers.png' }] }); } diff --git a/commands/edit-image/chocolate-milk.js b/commands/edit-image/chocolate-milk.js index 9af2f1ef..f6881681 100644 --- a/commands/edit-image/chocolate-milk.js +++ b/commands/edit-image/chocolate-milk.js @@ -50,7 +50,7 @@ module.exports = class ChocolateMilkCommand extends Command { ctx.drawImage(base, 0, 0, overlay.width, height); if (direction === 'right') ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.drawImage(overlay, 0, 0); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'chocolate-milk.png' }] }); } diff --git a/commands/edit-image/circle.js b/commands/edit-image/circle.js index 483fd591..ccb8b006 100644 --- a/commands/edit-image/circle.js +++ b/commands/edit-image/circle.js @@ -37,6 +37,6 @@ module.exports = class CircleCommand extends Command { ctx.closePath(); ctx.clip(); ctx.drawImage(data, (canvas.width / 2) - (data.width / 2), (canvas.height / 2) - (data.height / 2)); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'circle.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'circle.png' }] }); } }; diff --git a/commands/edit-image/color.js b/commands/edit-image/color.js index e645db3e..044c850e 100644 --- a/commands/edit-image/color.js +++ b/commands/edit-image/color.js @@ -33,7 +33,7 @@ module.exports = class ColorCommand extends Command { ctx.fillStyle = color.toLowerCase(); ctx.fillRect(0, 0, 250, 250); return msg.say(`${color.toUpperCase()} - ${name[1]}`, { - files: [{ attachment: canvas.toBuffer(), name: 'color.png' }] + files: [{ attachment: canvas.toBuffer('image/png'), name: 'color.png' }] }); } }; diff --git a/commands/edit-image/communist.js b/commands/edit-image/communist.js index 8b7ffe46..a448de68 100644 --- a/commands/edit-image/communist.js +++ b/commands/edit-image/communist.js @@ -47,7 +47,7 @@ module.exports = class CommunistCommand extends Command { ctx.globalAlpha = 0.5; ctx.drawImage(base, x + (width / 20), y + (height / 20), width * 0.9, height * 0.9); ctx.globalAlpha = 1; - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'communist.png' }] }); } diff --git a/commands/edit-image/contrast.js b/commands/edit-image/contrast.js index 0bb4a712..a7550b01 100644 --- a/commands/edit-image/contrast.js +++ b/commands/edit-image/contrast.js @@ -33,7 +33,7 @@ module.exports = class ContrastCommand extends Command { const ctx = canvas.getContext('2d'); ctx.drawImage(data, 0, 0); contrast(ctx, 0, 0, data.width, data.height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'contrast.png' }] }); } diff --git a/commands/edit-image/crop-to-content.js b/commands/edit-image/crop-to-content.js index 7b5bb5f8..765ee93a 100644 --- a/commands/edit-image/crop-to-content.js +++ b/commands/edit-image/crop-to-content.js @@ -35,7 +35,7 @@ module.exports = class CropToContentCommand extends Command { if (canvas.width === data.width && canvas.height === data.height) { return msg.say('Looks like this image is already cropped to its content.'); } - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'crop-to-content.png' }] }); } diff --git a/commands/edit-image/desaturate.js b/commands/edit-image/desaturate.js index 31f6c84d..56f62fa9 100644 --- a/commands/edit-image/desaturate.js +++ b/commands/edit-image/desaturate.js @@ -38,7 +38,7 @@ module.exports = class DesaturateCommand extends Command { const ctx = canvas.getContext('2d'); ctx.drawImage(data, 0, 0); desaturate(ctx, level, 0, 0, data.width, data.height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'desaturate.png' }] }); } diff --git a/commands/edit-image/dexter.js b/commands/edit-image/dexter.js index 5a76030d..fbe10b1d 100644 --- a/commands/edit-image/dexter.js +++ b/commands/edit-image/dexter.js @@ -45,6 +45,6 @@ module.exports = class DexterCommand extends Command { const { x, y, width, height } = centerImagePart(data, 225, 225, 234, 274); ctx.drawImage(data, x, y, width, height); ctx.rotate(11 * (Math.PI / 180)); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'dexter.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'dexter.png' }] }); } }; diff --git a/commands/edit-image/distort.js b/commands/edit-image/distort.js index 0f6a8933..b4291132 100644 --- a/commands/edit-image/distort.js +++ b/commands/edit-image/distort.js @@ -37,7 +37,7 @@ module.exports = class DistortCommand extends Command { const ctx = canvas.getContext('2d'); ctx.drawImage(data, 0, 0); distort(ctx, level, 0, 0, data.width, data.height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'distort.png' }] }); } diff --git a/commands/edit-image/fire-frame.js b/commands/edit-image/fire-frame.js index c3f04e4b..9a8d21fa 100644 --- a/commands/edit-image/fire-frame.js +++ b/commands/edit-image/fire-frame.js @@ -44,7 +44,7 @@ module.exports = class FireFrameCommand extends Command { const ctx = canvas.getContext('2d'); drawImageWithTint(ctx, data, '#fc671e', 0, 0, data.width, data.height); ctx.drawImage(base, 0, 0, data.width, data.height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'fire-frame.png' }] }); } diff --git a/commands/edit-image/fish-eye.js b/commands/edit-image/fish-eye.js index 1baa1858..948c5574 100644 --- a/commands/edit-image/fish-eye.js +++ b/commands/edit-image/fish-eye.js @@ -47,7 +47,7 @@ module.exports = class FishEyeCommand extends Command { const ctx = canvas.getContext('2d'); ctx.drawImage(data, 0, 0); fishEye(ctx, level, 0, 0, data.width, data.height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'fish-eye.png' }] }); } diff --git a/commands/edit-image/frame.js b/commands/edit-image/frame.js index 208ca1dd..54361d87 100644 --- a/commands/edit-image/frame.js +++ b/commands/edit-image/frame.js @@ -62,7 +62,7 @@ module.exports = class FrameCommand extends Command { ctx.drawImage(data, x, y, width, height); ctx.drawImage(base, 0, 0); } - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: `frame-${frame.file}` }] }); } diff --git a/commands/edit-image/ghost.js b/commands/edit-image/ghost.js index 2a106e68..df196fb4 100644 --- a/commands/edit-image/ghost.js +++ b/commands/edit-image/ghost.js @@ -34,7 +34,7 @@ module.exports = class GhostCommand extends Command { ctx.fillRect(0, 0, data.width, data.height); ctx.globalAlpha = 0.25; ctx.drawImage(data, 0, 0); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'ghost.png' }] }); } diff --git a/commands/edit-image/glass-shatter.js b/commands/edit-image/glass-shatter.js index d1e9c549..5dac6a0a 100644 --- a/commands/edit-image/glass-shatter.js +++ b/commands/edit-image/glass-shatter.js @@ -43,7 +43,7 @@ module.exports = class GlassShatterCommand extends Command { const ctx = canvas.getContext('2d'); ctx.drawImage(data, 0, 0); ctx.drawImage(base, 0, 0, data.width, data.height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'glass-shatter.png' }] }); } diff --git a/commands/edit-image/glitch.js b/commands/edit-image/glitch.js index 3e69dca7..9a7c76af 100644 --- a/commands/edit-image/glitch.js +++ b/commands/edit-image/glitch.js @@ -33,7 +33,7 @@ module.exports = class GlitchCommand extends Command { const ctx = canvas.getContext('2d'); ctx.drawImage(data, 0, 0); distort(ctx, 20, 0, 0, data.width, data.height, 5); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'glitch.png' }] }); } diff --git a/commands/edit-image/greyscale.js b/commands/edit-image/greyscale.js index d6ba5d41..02cb0f3d 100644 --- a/commands/edit-image/greyscale.js +++ b/commands/edit-image/greyscale.js @@ -34,7 +34,7 @@ module.exports = class GreyscaleCommand extends Command { const ctx = canvas.getContext('2d'); ctx.drawImage(data, 0, 0); greyscale(ctx, 0, 0, data.width, data.height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'greyscale.png' }] }); } diff --git a/commands/edit-image/gun.js b/commands/edit-image/gun.js index 24dc267a..7969ece7 100644 --- a/commands/edit-image/gun.js +++ b/commands/edit-image/gun.js @@ -44,7 +44,7 @@ module.exports = class GunCommand extends Command { const ratio = (data.height / 2) / base.height; const width = base.width * ratio; ctx.drawImage(base, data.width - width, data.height - (data.height / 2), width, data.height / 2); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'gun.png' }] }); } diff --git a/commands/edit-image/hands.js b/commands/edit-image/hands.js index 5d823b58..7345bbd6 100644 --- a/commands/edit-image/hands.js +++ b/commands/edit-image/hands.js @@ -45,7 +45,7 @@ module.exports = class HandsCommand extends Command { const ratio = data.width / base.width; const height = base.height * ratio; ctx.drawImage(base, 0, data.height - height, data.width, height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'hands.png' }] }); } diff --git a/commands/edit-image/ifunny.js b/commands/edit-image/ifunny.js index 2b7fe9ab..ddaa83ca 100644 --- a/commands/edit-image/ifunny.js +++ b/commands/edit-image/ifunny.js @@ -43,7 +43,7 @@ module.exports = class IfunnyCommand extends Command { ctx.fillStyle = '#181619'; ctx.fillRect(0, canvas.height - base.height, canvas.width, base.height); ctx.drawImage(base, canvas.width - base.width, canvas.height - base.height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'ifunny.png' }] }); } diff --git a/commands/edit-image/invert.js b/commands/edit-image/invert.js index dfe0d4e2..5a1eac4c 100644 --- a/commands/edit-image/invert.js +++ b/commands/edit-image/invert.js @@ -33,7 +33,7 @@ module.exports = class InvertCommand extends Command { const ctx = canvas.getContext('2d'); ctx.drawImage(data, 0, 0); invert(ctx, 0, 0, data.width, data.height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'invert.png' }] }); } diff --git a/commands/edit-image/lego-icon.js b/commands/edit-image/lego-icon.js index 4bd30d0d..004cc06d 100644 --- a/commands/edit-image/lego-icon.js +++ b/commands/edit-image/lego-icon.js @@ -54,6 +54,6 @@ module.exports = class LegoIconCommand extends Command { ctx.clip(); const height = 764 / data.width; ctx.drawImage(data, (base.width / 2) - (764 / 2), (base.height / 2) - (764 / 2), 764, data.height * height); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'lego-icon.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'lego-icon.png' }] }); } }; diff --git a/commands/edit-image/mirror.js b/commands/edit-image/mirror.js index 6b705886..c36e38ee 100644 --- a/commands/edit-image/mirror.js +++ b/commands/edit-image/mirror.js @@ -48,7 +48,7 @@ module.exports = class MirrorCommand extends Command { ctx.scale(-1, -1); } ctx.drawImage(data, 0, 0); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'mirror.png' }] }); } diff --git a/commands/edit-image/motion-blur.js b/commands/edit-image/motion-blur.js index 45afe0ad..6060af6d 100644 --- a/commands/edit-image/motion-blur.js +++ b/commands/edit-image/motion-blur.js @@ -33,7 +33,7 @@ module.exports = class MotionBlurCommand extends Command { const canvas = createCanvas(data.width, data.height); const ctx = canvas.getContext('2d'); motionBlur(ctx, data, 0, 0, data.width, data.height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'motion-blur.png' }] }); } diff --git a/commands/edit-image/pixelize.js b/commands/edit-image/pixelize.js index a10fdd77..5c1ee8b2 100644 --- a/commands/edit-image/pixelize.js +++ b/commands/edit-image/pixelize.js @@ -33,7 +33,7 @@ module.exports = class PixelizeCommand extends Command { const canvas = createCanvas(data.width, data.height); const ctx = canvas.getContext('2d'); pixelize(ctx, canvas, data, 0.15, 0, 0, canvas.width, canvas.height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'pixelize.png' }] }); } diff --git a/commands/edit-image/police-tape.js b/commands/edit-image/police-tape.js index 71be512b..303c0058 100644 --- a/commands/edit-image/police-tape.js +++ b/commands/edit-image/police-tape.js @@ -45,7 +45,7 @@ module.exports = class PoliceTapeCommand extends Command { ctx.drawImage(data, 0, 0); const { x, y, width, height } = centerImage(base, data); ctx.drawImage(base, x, y, width, height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'police-tape.png' }] }); } diff --git a/commands/edit-image/rainbow.js b/commands/edit-image/rainbow.js index da8789e5..ba627eb7 100644 --- a/commands/edit-image/rainbow.js +++ b/commands/edit-image/rainbow.js @@ -35,7 +35,7 @@ module.exports = class RainbowCommand extends Command { const ctx = canvas.getContext('2d'); ctx.drawImage(data, 0, 0); ctx.drawImage(base, 0, 0, data.width, data.height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'rainbow.png' }] }); } diff --git a/commands/edit-image/rejected.js b/commands/edit-image/rejected.js index 0a6f27fe..6667be58 100644 --- a/commands/edit-image/rejected.js +++ b/commands/edit-image/rejected.js @@ -45,7 +45,7 @@ module.exports = class RejctedCommand extends Command { ctx.drawImage(data, 0, 0); const { x, y, width, height } = centerImage(base, data); ctx.drawImage(base, x, y, width, height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'rejected.png' }] }); } diff --git a/commands/edit-image/resize.js b/commands/edit-image/resize.js index 8f2d4a71..a566f2b1 100644 --- a/commands/edit-image/resize.js +++ b/commands/edit-image/resize.js @@ -43,6 +43,6 @@ module.exports = class ResizeCommand extends Command { const canvas = createCanvas(width, height); const ctx = canvas.getContext('2d'); ctx.drawImage(data, 0, 0, width, height); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'resize.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'resize.png' }] }); } }; diff --git a/commands/edit-image/rotate.js b/commands/edit-image/rotate.js index 877db3ef..bd09b735 100644 --- a/commands/edit-image/rotate.js +++ b/commands/edit-image/rotate.js @@ -43,7 +43,7 @@ module.exports = class RotateCommand extends Command { ctx.drawImage(data, (canvas.width / 2) - (data.width / 2), (canvas.height / 2) - (data.height / 2)); ctx.translate(canvas.width / 2, canvas.height / 2); ctx.rotate(-degrees * (Math.PI / 180)); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'rotate.png' }] }); } diff --git a/commands/edit-image/sepia.js b/commands/edit-image/sepia.js index 9843288a..81dc4de7 100644 --- a/commands/edit-image/sepia.js +++ b/commands/edit-image/sepia.js @@ -33,7 +33,7 @@ module.exports = class SepiaCommand extends Command { const ctx = canvas.getContext('2d'); ctx.drawImage(data, 0, 0); sepia(ctx, 0, 0, data.width, data.height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'sepia.png' }] }); } diff --git a/commands/edit-image/silhouette.js b/commands/edit-image/silhouette.js index b6c62c4c..5b4cb553 100644 --- a/commands/edit-image/silhouette.js +++ b/commands/edit-image/silhouette.js @@ -33,7 +33,7 @@ module.exports = class SilhouetteCommand extends Command { const ctx = canvas.getContext('2d'); ctx.drawImage(data, 0, 0); silhouette(ctx, 0, 0, data.width, data.height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'silhouette.png' }] }); } diff --git a/commands/edit-image/sip.js b/commands/edit-image/sip.js index 2fb022c1..75a1de67 100644 --- a/commands/edit-image/sip.js +++ b/commands/edit-image/sip.js @@ -58,7 +58,7 @@ module.exports = class SipCommand extends Command { ctx.drawImage(base, 0, 0, overlay.width, height); if (direction === 'right') ctx.setTransform(1, 0, 0, 1, 0, 0); ctx.drawImage(overlay, 0, 0); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'sip.png' }] }); } diff --git a/commands/edit-image/snapchat.js b/commands/edit-image/snapchat.js index 72245e02..57e6674a 100644 --- a/commands/edit-image/snapchat.js +++ b/commands/edit-image/snapchat.js @@ -60,6 +60,6 @@ module.exports = class SnapchatCommand extends Command { ctx.globalAlpha = 1; ctx.fillStyle = 'white'; ctx.fillText(text, base.width / 2, barPosition - (barHeight * 0.4)); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'snapchat.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'snapchat.png' }] }); } }; diff --git a/commands/edit-image/spotify-now-playing.js b/commands/edit-image/spotify-now-playing.js index 041e1cb3..f42acaab 100644 --- a/commands/edit-image/spotify-now-playing.js +++ b/commands/edit-image/spotify-now-playing.js @@ -76,6 +76,6 @@ module.exports = class SpotifyNowPlayingCommand extends Command { ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(20); ctx.fillText(artist, base.width / 2, 720); ctx.fillText('Xiao\'s Picks', base.width / 2, 65); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'spotify-now-playing.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'spotify-now-playing.png' }] }); } }; diff --git a/commands/edit-image/square.js b/commands/edit-image/square.js index 3dbd2408..8b57079e 100644 --- a/commands/edit-image/square.js +++ b/commands/edit-image/square.js @@ -32,6 +32,6 @@ module.exports = class SquareCommand extends Command { const canvas = createCanvas(dimensions, dimensions); const ctx = canvas.getContext('2d'); ctx.drawImage(data, (canvas.width / 2) - (data.width / 2), (canvas.height / 2) - (data.height / 2)); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'square.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'square.png' }] }); } }; diff --git a/commands/edit-image/steam-card.js b/commands/edit-image/steam-card.js index 9669f209..5ad75431 100644 --- a/commands/edit-image/steam-card.js +++ b/commands/edit-image/steam-card.js @@ -68,6 +68,6 @@ module.exports = class SteamCardCommand extends Command { ctx.fillText(name, 16, 25); ctx.fillStyle = 'white'; ctx.fillText(name, 15, 24); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'steam-card.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'steam-card.png' }] }); } }; diff --git a/commands/edit-image/subtitle.js b/commands/edit-image/subtitle.js index eceec375..cee4c847 100644 --- a/commands/edit-image/subtitle.js +++ b/commands/edit-image/subtitle.js @@ -63,7 +63,7 @@ module.exports = class SubtitleCommand extends Command { ctx.fillStyle = 'yellow'; ctx.fillText(lines[i], base.width / 2, textHeight); } - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'subtitle.png' }] }); } diff --git a/commands/edit-image/tint.js b/commands/edit-image/tint.js index 1293843b..56fc2481 100644 --- a/commands/edit-image/tint.js +++ b/commands/edit-image/tint.js @@ -37,7 +37,7 @@ module.exports = class TintCommand extends Command { const canvas = createCanvas(data.width, data.height); const ctx = canvas.getContext('2d'); drawImageWithTint(ctx, data, color, 0, 0, data.width, data.height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'tint.png' }] }); } diff --git a/commands/edit-image/vignette.js b/commands/edit-image/vignette.js index 95f00c61..52d50ec6 100644 --- a/commands/edit-image/vignette.js +++ b/commands/edit-image/vignette.js @@ -33,7 +33,7 @@ module.exports = class VignetteCommand extends Command { const ctx = canvas.getContext('2d'); ctx.drawImage(data, 0, 0); vignette(ctx, data.width, data.height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'vignette.png' }] }); } diff --git a/commands/edit-image/wanted.js b/commands/edit-image/wanted.js index 533f487a..5b484598 100644 --- a/commands/edit-image/wanted.js +++ b/commands/edit-image/wanted.js @@ -46,6 +46,6 @@ module.exports = class WantedCommand extends Command { const { x, y, width, height } = centerImagePart(data, 430, 430, 150, 360); ctx.drawImage(data, x, y, width, height); sepia(ctx, x, y, width, height); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'wanted.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'wanted.png' }] }); } }; diff --git a/commands/edit-image/wild-pokemon.js b/commands/edit-image/wild-pokemon.js index 0744cf7e..92db05a2 100644 --- a/commands/edit-image/wild-pokemon.js +++ b/commands/edit-image/wild-pokemon.js @@ -60,6 +60,6 @@ module.exports = class WildPokemonCommand extends Command { ctx.textBaseline = 'top'; ctx.font = this.client.fonts.get('PokemonGb.ttf').toCanvasString(16); ctx.fillText(name.toUpperCase(), 106, 205, 215); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'wild-pokemon.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'wild-pokemon.png' }] }); } }; diff --git a/commands/edit-image/you-died.js b/commands/edit-image/you-died.js index 83c9a5d4..a93a3c70 100644 --- a/commands/edit-image/you-died.js +++ b/commands/edit-image/you-died.js @@ -45,7 +45,7 @@ module.exports = class YouDiedCommand extends Command { greyscale(ctx, 0, 0, data.width, data.height); const { x, y, width, height } = centerImage(base, data); ctx.drawImage(base, x, y, width, height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'you-died.png' }] }); } diff --git a/commands/edit-meme/3000-years.js b/commands/edit-meme/3000-years.js index 0e0f04fe..e8745642 100644 --- a/commands/edit-meme/3000-years.js +++ b/commands/edit-meme/3000-years.js @@ -44,6 +44,6 @@ module.exports = class ThreeThousandYearsCommand extends Command { ctx.drawImage(base, 0, 0); const { x, y, width, height } = centerImagePart(data, 200, 200, 461, 127); ctx.drawImage(data, x, y, width, height); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: '3000-years.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: '3000-years.png' }] }); } }; diff --git a/commands/edit-meme/alert.js b/commands/edit-meme/alert.js index 5697d7b8..e0ff7e9b 100644 --- a/commands/edit-meme/alert.js +++ b/commands/edit-meme/alert.js @@ -52,6 +52,6 @@ module.exports = class AlertCommand extends Command { let text = wrapText(ctx, message, 540); text = text.length > 3 ? `${text.slice(0, 3).join('\n')}...` : text.join('\n'); fillTextWithBreaks(ctx, text, 48, 178); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'alert.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'alert.png' }] }); } }; diff --git a/commands/edit-meme/bart-chalkboard.js b/commands/edit-meme/bart-chalkboard.js index 4c5795e7..e65bced0 100644 --- a/commands/edit-meme/bart-chalkboard.js +++ b/commands/edit-meme/bart-chalkboard.js @@ -53,6 +53,6 @@ module.exports = class LisaPresentationCommand extends Command { const arr = []; for (let i = 0; i < 12; i++) arr.push(shortened); fillTextWithBreaks(ctx, arr.join('\n'), 30, 27); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'bart-chalkboard.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'bart-chalkboard.png' }] }); } }; diff --git a/commands/edit-meme/be-like-bill.js b/commands/edit-meme/be-like-bill.js index 24b45463..27d0f51e 100644 --- a/commands/edit-meme/be-like-bill.js +++ b/commands/edit-meme/be-like-bill.js @@ -51,6 +51,6 @@ module.exports = class BeLikeBillCommand extends Command { ctx.font = this.client.fonts.get('arialbd.ttf').toCanvasString(23); const text = wrapText(ctx, texts[Math.floor(Math.random() * texts.length)].replaceAll('{{name}}', name), 569); fillTextWithBreaks(ctx, `This is ${name}.\n\n${text.join('\n')}\n\n${name} is smart.\nBe like ${name}.`, 31, 80); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'be-like-bill.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'be-like-bill.png' }] }); } }; diff --git a/commands/edit-meme/beautiful.js b/commands/edit-meme/beautiful.js index 8e2b8401..7f3030b4 100644 --- a/commands/edit-meme/beautiful.js +++ b/commands/edit-meme/beautiful.js @@ -52,6 +52,6 @@ module.exports = class BeautifulCommand extends Command { ctx.drawImage(avatar, 249, 24, 105, 105); ctx.drawImage(avatar, 249, 223, 105, 105); ctx.drawImage(base, 0, 0); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'beautiful.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'beautiful.png' }] }); } }; diff --git a/commands/edit-meme/boardroom-meeting.js b/commands/edit-meme/boardroom-meeting.js index 3f1411d9..29e054b9 100644 --- a/commands/edit-meme/boardroom-meeting.js +++ b/commands/edit-meme/boardroom-meeting.js @@ -70,6 +70,6 @@ module.exports = class BoardroomMeetingCommand extends Command { ctx.fillText(suggestion1, 30, 251, 90); ctx.fillText(suggestion2, 167, 258, 75); ctx.fillText(final, 310, 269, 130); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'boardroom-meeting.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'boardroom-meeting.png' }] }); } }; diff --git a/commands/edit-meme/catch.js b/commands/edit-meme/catch.js index 672a7161..494ea175 100644 --- a/commands/edit-meme/catch.js +++ b/commands/edit-meme/catch.js @@ -55,6 +55,6 @@ module.exports = class CatchCommand extends Command { ctx.fillText(is.toUpperCase(), 163, 202); await msg.channel.send({ files: [path.join(__dirname, '..', '..', 'assets', 'images', 'catch', 'part-1.png')] }); await delay(time * 1000); - return msg.channel.send({ files: [{ attachment: canvas.toBuffer(), name: 'part-2.png' }] }); + return msg.channel.send({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'part-2.png' }] }); } }; diff --git a/commands/edit-meme/challenger.js b/commands/edit-meme/challenger.js index 43390c69..8cc48a0b 100644 --- a/commands/edit-meme/challenger.js +++ b/commands/edit-meme/challenger.js @@ -120,7 +120,7 @@ module.exports = class ChallengerCommand extends Command { const img = silhouetted ? this.silhouetteImage(data) : data; const { x, y, width, height } = centerImagePart(img, gameData.maxWidth, gameData.maxHeight, gameData.x, gameData.y); ctx.drawImage(img, x, y, width, height); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'challenger.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'challenger.png' }] }); } silhouetteImage(image) { diff --git a/commands/edit-meme/change-my-mind.js b/commands/edit-meme/change-my-mind.js index 236f40a2..280ef600 100644 --- a/commands/edit-meme/change-my-mind.js +++ b/commands/edit-meme/change-my-mind.js @@ -57,6 +57,6 @@ module.exports = class ChangeMyMindCommand extends Command { const lines = wrapText(ctx, text, 337); fillTextWithBreaks(ctx, lines.join('\n'), 142, 430, 337); ctx.rotate(24 * (Math.PI / 180)); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'change-my-mind.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'change-my-mind.png' }] }); } }; diff --git a/commands/edit-meme/chi-idea.js b/commands/edit-meme/chi-idea.js index c3d4858c..4f97f51d 100644 --- a/commands/edit-meme/chi-idea.js +++ b/commands/edit-meme/chi-idea.js @@ -65,6 +65,6 @@ module.exports = class ChiIdeaCommand extends Command { const height = topMost + ((fontSize + 5) * i); ctx.fillText(lines[i], 70, height); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'chi-idea.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'chi-idea.png' }] }); } }; diff --git a/commands/edit-meme/crush.js b/commands/edit-meme/crush.js index 096d37c4..76b88a45 100644 --- a/commands/edit-meme/crush.js +++ b/commands/edit-meme/crush.js @@ -49,6 +49,6 @@ module.exports = class CrushCommand extends Command { ctx.drawImage(data, x, y, width, height); ctx.rotate(3.79 * (Math.PI / 180)); ctx.drawImage(base, 0, 0); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'crush.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'crush.png' }] }); } }; diff --git a/commands/edit-meme/cursed-sponge.js b/commands/edit-meme/cursed-sponge.js index 553a03a7..04d3685b 100644 --- a/commands/edit-meme/cursed-sponge.js +++ b/commands/edit-meme/cursed-sponge.js @@ -47,6 +47,6 @@ module.exports = class CursedSpongeCommand extends Command { if ((width + sponge.width) === (sponge.width * (rows > 1 ? 10 : amount))) width = 0; else width += sponge.width; } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'cursed-sponge.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'cursed-sponge.png' }] }); } }; diff --git a/commands/edit-meme/dear-liberals.js b/commands/edit-meme/dear-liberals.js index d6f374f0..17be9f6f 100644 --- a/commands/edit-meme/dear-liberals.js +++ b/commands/edit-meme/dear-liberals.js @@ -73,6 +73,6 @@ module.exports = class DearLiberalsCommand extends Command { ctx.fillStyle = '#c31a41'; const redLines = wrapText(ctx, redText, 165); fillTextWithBreaks(ctx, redLines.join('\n'), 326, 236); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'dear-liberals.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'dear-liberals.png' }] }); } }; diff --git a/commands/edit-meme/demotivational.js b/commands/edit-meme/demotivational.js index ebabca47..a79045a2 100644 --- a/commands/edit-meme/demotivational.js +++ b/commands/edit-meme/demotivational.js @@ -69,6 +69,6 @@ module.exports = class DemotivationalCommand extends Command { ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(27); ctx.fillStyle = 'white'; ctx.fillText(shortenText(ctx, text, 610), 375, 565); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'demotivational-poster.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'demotivational-poster.png' }] }); } }; diff --git a/commands/edit-meme/dislike.js b/commands/edit-meme/dislike.js index 2a5b4fad..85a81bde 100644 --- a/commands/edit-meme/dislike.js +++ b/commands/edit-meme/dislike.js @@ -45,7 +45,7 @@ module.exports = class DislikeCommand extends Command { const ctx = canvas.getContext('2d'); ctx.drawImage(base, 0, 0, plate.width, height); ctx.drawImage(plate, 0, height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'dislike.png' }] }); } diff --git a/commands/edit-meme/distracted-boyfriend.js b/commands/edit-meme/distracted-boyfriend.js index 2e706628..0b62ed86 100644 --- a/commands/edit-meme/distracted-boyfriend.js +++ b/commands/edit-meme/distracted-boyfriend.js @@ -64,6 +64,6 @@ module.exports = class DistractedBoyfriendCommand extends Command { ctx.drawImage(girlfriendAvatar, 539, 67, 100, 125); ctx.rotate(-3.11 * (Math.PI / 180)); ctx.drawImage(otherGirlAvatar, 120, 96, 175, 175); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'distracted-boyfriend.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'distracted-boyfriend.png' }] }); } }; diff --git a/commands/edit-meme/drakeposting.js b/commands/edit-meme/drakeposting.js index 481d2250..2fe74410 100644 --- a/commands/edit-meme/drakeposting.js +++ b/commands/edit-meme/drakeposting.js @@ -77,6 +77,6 @@ module.exports = class DrakepostingCommand extends Command { const height = yeahTopMost + ((fontSize + 10) * i); ctx.fillText(yeahLines[i], 768, height); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'drakeposting.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'drakeposting.png' }] }); } }; diff --git a/commands/edit-meme/edd-facts-book.js b/commands/edit-meme/edd-facts-book.js index 6db76457..ae15d68c 100644 --- a/commands/edit-meme/edd-facts-book.js +++ b/commands/edit-meme/edd-facts-book.js @@ -57,6 +57,6 @@ module.exports = class EddFactsBookCommand extends Command { const lines = wrapText(ctx, fact, 183); fillTextWithBreaks(ctx, lines.join('\n'), 119, 306, 183); ctx.rotate(-15 * (Math.PI / 180)); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'edd-facts-book.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'edd-facts-book.png' }] }); } }; diff --git a/commands/edit-meme/enslaved.js b/commands/edit-meme/enslaved.js index 278525e4..a7166c02 100644 --- a/commands/edit-meme/enslaved.js +++ b/commands/edit-meme/enslaved.js @@ -55,6 +55,6 @@ module.exports = class EnslavedCommand extends Command { ctx.fillStyle = 'white'; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(50); ctx.fillText(name.toLowerCase(), 365, 400, 240); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'enslaved.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'enslaved.png' }] }); } }; diff --git a/commands/edit-meme/food-broke.js b/commands/edit-meme/food-broke.js index 27c20694..3a2c4675 100644 --- a/commands/edit-meme/food-broke.js +++ b/commands/edit-meme/food-broke.js @@ -48,6 +48,6 @@ module.exports = class FoodBrokeCommand extends Command { contrast(ctx, 23, 9, 125, 125); ctx.drawImage(avatar, 117, 382, 75, 75); contrast(ctx, 117, 382, 75, 75); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'food-broke.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'food-broke.png' }] }); } }; diff --git a/commands/edit-meme/for-five-hours.js b/commands/edit-meme/for-five-hours.js index 4ae7927f..5f0ac5f8 100644 --- a/commands/edit-meme/for-five-hours.js +++ b/commands/edit-meme/for-five-hours.js @@ -45,7 +45,7 @@ module.exports = class ForFiveHoursCommand extends Command { const ctx = canvas.getContext('2d'); ctx.drawImage(base, 0, 0, plate.width, height); ctx.drawImage(plate, 0, height + 1); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'for-five-hours.png' }] }); } diff --git a/commands/edit-meme/genie-rules.js b/commands/edit-meme/genie-rules.js index aa5571b2..22c26348 100644 --- a/commands/edit-meme/genie-rules.js +++ b/commands/edit-meme/genie-rules.js @@ -61,6 +61,6 @@ module.exports = class GenieRulesCommand extends Command { const height = topMost + ((fontSize + 20) * i); ctx.fillText(lines[i], 220, height); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'genie-rules.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'genie-rules.png' }] }); } }; diff --git a/commands/edit-meme/girl-worth-fighting-for.js b/commands/edit-meme/girl-worth-fighting-for.js index f8303085..e764c896 100644 --- a/commands/edit-meme/girl-worth-fighting-for.js +++ b/commands/edit-meme/girl-worth-fighting-for.js @@ -51,6 +51,6 @@ module.exports = class GirlWorthFightingForCommand extends Command { ctx.drawImage(base, 0, 0); const { x, y, width, height } = centerImagePart(data, 150, 150, 380, 511); ctx.drawImage(data, x, y, width, height); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'girl-worth-fighting-for.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'girl-worth-fighting-for.png' }] }); } }; diff --git a/commands/edit-meme/gru-plan.js b/commands/edit-meme/gru-plan.js index eee85e06..34bd4ec9 100644 --- a/commands/edit-meme/gru-plan.js +++ b/commands/edit-meme/gru-plan.js @@ -76,6 +76,6 @@ module.exports = class GruPlanCommand extends Command { fillTextWithBreaks(ctx, lines.join('\n'), x, y); i++; } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'gru-plan.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'gru-plan.png' }] }); } }; diff --git a/commands/edit-meme/i-cant-believe.js b/commands/edit-meme/i-cant-believe.js index 6b237a11..5e8266fd 100644 --- a/commands/edit-meme/i-cant-believe.js +++ b/commands/edit-meme/i-cant-believe.js @@ -54,6 +54,6 @@ module.exports = class ICantBelieveCommand extends Command { ctx.fillStyle = '#13487b'; ctx.fillText(firstUpperCase(text.toLowerCase(), null), 13, 54, 171); ctx.rotate(8 * (Math.PI / 180)); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'i-cant-believe.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'i-cant-believe.png' }] }); } }; diff --git a/commands/edit-meme/i-fear-no-man.js b/commands/edit-meme/i-fear-no-man.js index 96b61356..6abeb3df 100644 --- a/commands/edit-meme/i-fear-no-man.js +++ b/commands/edit-meme/i-fear-no-man.js @@ -45,6 +45,6 @@ module.exports = class IFearNoManCommand extends Command { ctx.drawImage(base, 0, 0); const { x, y, width, height } = centerImagePart(data, 169, 169, 167, 330); ctx.drawImage(data, x, y, width, height); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'i-fear-no-man.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'i-fear-no-man.png' }] }); } }; diff --git a/commands/edit-meme/if-those-kids-could-read.js b/commands/edit-meme/if-those-kids-could-read.js index 3a61baae..044ec5f0 100644 --- a/commands/edit-meme/if-those-kids-could-read.js +++ b/commands/edit-meme/if-those-kids-could-read.js @@ -59,6 +59,6 @@ module.exports = class IfThoseKidsCouldReadCommand extends Command { const height = topMost + ((fontSize + 20) * i); ctx.fillText(lines[i], 300, height); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'if-those-kids-could-read.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'if-those-kids-could-read.png' }] }); } }; diff --git a/commands/edit-meme/kyon-gun.js b/commands/edit-meme/kyon-gun.js index bd4ad009..45bc3d55 100644 --- a/commands/edit-meme/kyon-gun.js +++ b/commands/edit-meme/kyon-gun.js @@ -52,6 +52,6 @@ module.exports = class KyonGunCommand extends Command { const width = Math.round(base.height * ratio); ctx.drawImage(data, (base.width / 2) - (width / 2), 0, width, base.height); ctx.drawImage(base, 0, 0); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'kyon-gun.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'kyon-gun.png' }] }); } }; diff --git a/commands/edit-meme/like.js b/commands/edit-meme/like.js index 8a4a1e57..f51c7d1b 100644 --- a/commands/edit-meme/like.js +++ b/commands/edit-meme/like.js @@ -45,7 +45,7 @@ module.exports = class LikeCommand extends Command { const ctx = canvas.getContext('2d'); ctx.drawImage(base, 0, 0, plate.width, height); ctx.drawImage(plate, 0, height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'like.png' }] }); } diff --git a/commands/edit-meme/lisa-presentation.js b/commands/edit-meme/lisa-presentation.js index fdff54cb..3f775679 100644 --- a/commands/edit-meme/lisa-presentation.js +++ b/commands/edit-meme/lisa-presentation.js @@ -60,6 +60,6 @@ module.exports = class LisaPresentationCommand extends Command { const height = topMost + ((fontSize + 20) * i); ctx.fillText(lines[i], base.width / 2, height); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'lisa-presentation.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'lisa-presentation.png' }] }); } }; diff --git a/commands/edit-meme/look-at-this-photograph.js b/commands/edit-meme/look-at-this-photograph.js index d4530a32..513e7ace 100644 --- a/commands/edit-meme/look-at-this-photograph.js +++ b/commands/edit-meme/look-at-this-photograph.js @@ -45,6 +45,6 @@ module.exports = class LookAtThisPhotographCommand extends Command { ctx.rotate(-13.5 * (Math.PI / 180)); ctx.drawImage(data, 280, 218, 175, 125); ctx.rotate(13.5 * (Math.PI / 180)); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'look-at-this-photograph.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'look-at-this-photograph.png' }] }); } }; diff --git a/commands/edit-meme/look-what-karen-have.js b/commands/edit-meme/look-what-karen-have.js index f56975c9..6d6a4f8c 100644 --- a/commands/edit-meme/look-what-karen-have.js +++ b/commands/edit-meme/look-what-karen-have.js @@ -54,6 +54,6 @@ module.exports = class LookWhatKarenHaveCommand extends Command { ctx.drawImage(data, x, y, width, height); ctx.rotate(6.5 * (Math.PI / 180)); ctx.drawImage(base, 0, 0); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'look-what-karen-have.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'look-what-karen-have.png' }] }); } }; diff --git a/commands/edit-meme/mario-bros-views.js b/commands/edit-meme/mario-bros-views.js index 4c60b24c..949b2e22 100644 --- a/commands/edit-meme/mario-bros-views.js +++ b/commands/edit-meme/mario-bros-views.js @@ -91,6 +91,6 @@ module.exports = class MarioBrosViewsCommand extends Command { ctx.strokeText(luigiLines[i], 450, height); ctx.fillText(luigiLines[i], 450, height); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'mario-bros-views.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'mario-bros-views.png' }] }); } }; diff --git a/commands/edit-meme/meme-gen.js b/commands/edit-meme/meme-gen.js index b9f6cdc8..6c044556 100644 --- a/commands/edit-meme/meme-gen.js +++ b/commands/edit-meme/meme-gen.js @@ -80,7 +80,7 @@ module.exports = class MemeGenCommand extends Command { ctx.fillStyle = 'white'; ctx.fillText(bottomLines[i], base.width / 2, textHeight); } - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'meme-gen.png' }] }); } diff --git a/commands/edit-meme/metamorphosis.js b/commands/edit-meme/metamorphosis.js index e60308e5..17178347 100644 --- a/commands/edit-meme/metamorphosis.js +++ b/commands/edit-meme/metamorphosis.js @@ -59,6 +59,6 @@ module.exports = class MetamorphosisCommand extends Command { ctx.textBaseline = 'top'; ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(20); ctx.fillText(`le ${name.toLowerCase()}`, 345, 466, 330); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'metamorphosis.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'metamorphosis.png' }] }); } }; diff --git a/commands/edit-meme/my-collection-grows.js b/commands/edit-meme/my-collection-grows.js index a71b3273..92bdbae5 100644 --- a/commands/edit-meme/my-collection-grows.js +++ b/commands/edit-meme/my-collection-grows.js @@ -49,6 +49,6 @@ module.exports = class MyCollectionGrowsCommand extends Command { ctx.drawImage(data, x, y, width, height); ctx.rotate(14 * (Math.PI / 180)); ctx.drawImage(base, 0, 0); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'my-collection-grows.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'my-collection-grows.png' }] }); } }; diff --git a/commands/edit-meme/new-password.js b/commands/edit-meme/new-password.js index 8ce91419..eefb1720 100644 --- a/commands/edit-meme/new-password.js +++ b/commands/edit-meme/new-password.js @@ -48,6 +48,6 @@ module.exports = class NewPasswordCommand extends Command { ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(60); ctx.fillText(shortenText(ctx, weak, 780), 70, 191); ctx.fillText(shortenText(ctx, strong, 780), 70, 667); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'new-password.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'new-password.png' }] }); } }; diff --git a/commands/edit-meme/nike-ad.js b/commands/edit-meme/nike-ad.js index 680eb2f8..8f03fd03 100644 --- a/commands/edit-meme/nike-ad.js +++ b/commands/edit-meme/nike-ad.js @@ -74,7 +74,7 @@ module.exports = class NikeAdCommand extends Command { const textHeight = initial + (i * fontSize) + (i * 10); ctx.fillText(lines[i], data.width / 2, textHeight); } - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'nike-ad.png' }] }); } diff --git a/commands/edit-meme/panik-kalm-panik.js b/commands/edit-meme/panik-kalm-panik.js index b8875652..2b27c337 100644 --- a/commands/edit-meme/panik-kalm-panik.js +++ b/commands/edit-meme/panik-kalm-panik.js @@ -89,6 +89,6 @@ module.exports = class PanikKalmPanikCommand extends Command { const height = panik2TopMost + ((fontSize + 10) * i); ctx.fillText(panik2Lines[i], 150, height); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'panik-kalm-panik.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'panik-kalm-panik.png' }] }); } }; diff --git a/commands/edit-meme/phoebe-teaching-joey.js b/commands/edit-meme/phoebe-teaching-joey.js index 2f29774e..b086a2cc 100644 --- a/commands/edit-meme/phoebe-teaching-joey.js +++ b/commands/edit-meme/phoebe-teaching-joey.js @@ -92,6 +92,6 @@ module.exports = class PhoebeTeachingJoeyCommand extends Command { } i++; } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'phoebe-teaching-joey.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'phoebe-teaching-joey.png' }] }); } }; diff --git a/commands/edit-meme/pills.js b/commands/edit-meme/pills.js index d4e9b3bd..9d59716b 100644 --- a/commands/edit-meme/pills.js +++ b/commands/edit-meme/pills.js @@ -57,6 +57,6 @@ module.exports = class PillsCommand extends Command { ctx.strokeText(lines[i], 183, height); ctx.fillText(lines[i], 183, height); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'pills.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'pills.png' }] }); } }; diff --git a/commands/edit-meme/plankton-plan.js b/commands/edit-meme/plankton-plan.js index efc7497e..26643058 100644 --- a/commands/edit-meme/plankton-plan.js +++ b/commands/edit-meme/plankton-plan.js @@ -76,6 +76,6 @@ module.exports = class PlanktonPlanCommand extends Command { fillTextWithBreaks(ctx, lines.join('\n'), x, y); i++; } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'plankton-plan.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'plankton-plan.png' }] }); } }; diff --git a/commands/edit-meme/raw.js b/commands/edit-meme/raw.js index 50c46c71..bcfee97c 100644 --- a/commands/edit-meme/raw.js +++ b/commands/edit-meme/raw.js @@ -44,6 +44,6 @@ module.exports = class RawCommand extends Command { ctx.textBaseline = 'top'; ctx.font = this.client.fonts.get('wildwordsroman.ttf').toCanvasString(23); ctx.fillText(text, 520, 143, 165); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'raw.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'raw.png' }] }); } }; diff --git a/commands/edit-meme/reaction-meme.js b/commands/edit-meme/reaction-meme.js index 5a8626bf..3bec05fa 100644 --- a/commands/edit-meme/reaction-meme.js +++ b/commands/edit-meme/reaction-meme.js @@ -60,7 +60,7 @@ module.exports = class ReactionMemeCommand extends Command { ctx.fillStyle = 'black'; fillTextWithBreaks(ctx, lines.join('\n'), 5, 5); ctx.drawImage(base, 0, linesLen); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'meme-gen-modern.png' }] }); } diff --git a/commands/edit-meme/scroll-of-truth.js b/commands/edit-meme/scroll-of-truth.js index fd579422..bfbe73a0 100644 --- a/commands/edit-meme/scroll-of-truth.js +++ b/commands/edit-meme/scroll-of-truth.js @@ -60,6 +60,6 @@ module.exports = class ScrollOfTruthCommand extends Command { const height = topMost + ((fontSize + 20) * i); ctx.fillText(lines[i], 350, height); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'scroll-of-truth.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'scroll-of-truth.png' }] }); } }; diff --git a/commands/edit-meme/sexy-singles.js b/commands/edit-meme/sexy-singles.js index abc60cfa..76dcf555 100644 --- a/commands/edit-meme/sexy-singles.js +++ b/commands/edit-meme/sexy-singles.js @@ -42,7 +42,7 @@ module.exports = class SexySinglesCommand extends Command { const ctx = canvas.getContext('2d'); ctx.drawImage(base, plate.width, 0, width, plate.height); ctx.drawImage(plate, 0, 0); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'sexy-singles.png' }] }); } diff --git a/commands/edit-meme/skyrim-skill.js b/commands/edit-meme/skyrim-skill.js index 1424d807..c6a66134 100644 --- a/commands/edit-meme/skyrim-skill.js +++ b/commands/edit-meme/skyrim-skill.js @@ -64,7 +64,7 @@ module.exports = class SkyrimSkillCommand extends Command { ctx.fillText(skill, 189 + 5, height + 75 + 3, 300); ctx.fillStyle = 'white'; ctx.fillText(skill, 189, height + 75, 300); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'skyrim-skill.png' }] }); } diff --git a/commands/edit-meme/sonic-says.js b/commands/edit-meme/sonic-says.js index 6fa5376c..7c60618d 100644 --- a/commands/edit-meme/sonic-says.js +++ b/commands/edit-meme/sonic-says.js @@ -56,6 +56,6 @@ module.exports = class SonicSaysCommand extends Command { const lines = wrapText(ctx, text, 185); ctx.fillStyle = 'white'; fillTextWithBreaks(ctx, lines.join('\n'), 92, 67, 185); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'sonic-says.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'sonic-says.png' }] }); } }; diff --git a/commands/edit-meme/sora-selfie.js b/commands/edit-meme/sora-selfie.js index 5a4ff99e..d2a5e5ff 100644 --- a/commands/edit-meme/sora-selfie.js +++ b/commands/edit-meme/sora-selfie.js @@ -53,6 +53,6 @@ module.exports = class SoraSelfieCommand extends Command { const width = Math.round(base.height * ratio); ctx.drawImage(data, (base.width / 2) - (width / 2), 0, width, base.height); ctx.drawImage(base, 0, 0); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'sora-selfie.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'sora-selfie.png' }] }); } }; diff --git a/commands/edit-meme/sos.js b/commands/edit-meme/sos.js index af56040e..6494026d 100644 --- a/commands/edit-meme/sos.js +++ b/commands/edit-meme/sos.js @@ -56,6 +56,6 @@ module.exports = class SosCommand extends Command { } ctx.fillText(message.toUpperCase(), 362, 522); ctx.rotate(-15 * (Math.PI / 180)); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'sos.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'sos.png' }] }); } }; diff --git a/commands/edit-meme/spiderman-pointing.js b/commands/edit-meme/spiderman-pointing.js index dc2d24e3..4681f231 100644 --- a/commands/edit-meme/spiderman-pointing.js +++ b/commands/edit-meme/spiderman-pointing.js @@ -84,6 +84,6 @@ module.exports = class SpidermanPointingCommand extends Command { ctx.strokeText(lines2[i], 596, height); ctx.fillText(lines2[i], 596, height); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'spiderman-pointing.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'spiderman-pointing.png' }] }); } }; diff --git a/commands/edit-meme/spongebob-burn.js b/commands/edit-meme/spongebob-burn.js index 4da9eda3..11d4df30 100644 --- a/commands/edit-meme/spongebob-burn.js +++ b/commands/edit-meme/spongebob-burn.js @@ -67,6 +67,6 @@ module.exports = class SpongebobBurnCommand extends Command { ctx.font = this.client.fonts.get('Noto-Regular.ttf').toCanvasString(20); ctx.fillText(person, 119, 405); ctx.fillText(person, 439, 434); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'spongebob-burn.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'spongebob-burn.png' }] }); } }; diff --git a/commands/edit-meme/that-sign-wont-stop-me.js b/commands/edit-meme/that-sign-wont-stop-me.js index d8484a79..5b0639f6 100644 --- a/commands/edit-meme/that-sign-wont-stop-me.js +++ b/commands/edit-meme/that-sign-wont-stop-me.js @@ -72,6 +72,6 @@ module.exports = class ThatSignWontStopMeCommand extends Command { const height = bTopMost + ((fontSize + 2) * i); ctx.fillText(bLines[i], 280, height); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'that-sign-wont-stop-me.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'that-sign-wont-stop-me.png' }] }); } }; diff --git a/commands/edit-meme/this-guy.js b/commands/edit-meme/this-guy.js index 1737e835..8fa08fad 100644 --- a/commands/edit-meme/this-guy.js +++ b/commands/edit-meme/this-guy.js @@ -45,6 +45,6 @@ module.exports = class ThisGuyCommand extends Command { ctx.drawImage(base, 0, 0); const { x, y, width, height } = centerImagePart(data, 361, 361, 76, 62); ctx.drawImage(data, x, y, width, height); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'this-guy.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'this-guy.png' }] }); } }; diff --git a/commands/edit-meme/thug-life.js b/commands/edit-meme/thug-life.js index 1517c00f..afaf05f1 100644 --- a/commands/edit-meme/thug-life.js +++ b/commands/edit-meme/thug-life.js @@ -48,7 +48,7 @@ module.exports = class ThugLifeCommand extends Command { const width = data.width / 2; const height = Math.round(width / ratio); ctx.drawImage(base, (data.width / 2) - (width / 2), data.height - height, width, height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'thug-life.png' }] }); } diff --git a/commands/edit-meme/to-be-continued.js b/commands/edit-meme/to-be-continued.js index 34bfb832..802aa484 100644 --- a/commands/edit-meme/to-be-continued.js +++ b/commands/edit-meme/to-be-continued.js @@ -46,7 +46,7 @@ module.exports = class ToBeContinuedCommand extends Command { const width = canvas.width / 2; const height = Math.round(width / ratio); ctx.drawImage(base, 0, canvas.height - height, width, height); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'to-be-continued.png' }] }); } diff --git a/commands/edit-meme/tuxedo-pooh.js b/commands/edit-meme/tuxedo-pooh.js index 0d3e3f28..fd2140b2 100644 --- a/commands/edit-meme/tuxedo-pooh.js +++ b/commands/edit-meme/tuxedo-pooh.js @@ -77,6 +77,6 @@ module.exports = class TuxedoPoohCommand extends Command { const height = tuxedoTopMost + ((fontSize + 10) * i); ctx.fillText(tuxedoLines[i], 570, height); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'tuxedo-pooh.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'tuxedo-pooh.png' }] }); } }; diff --git a/commands/edit-meme/two-buttons.js b/commands/edit-meme/two-buttons.js index 2f8ccbd3..6110a2db 100644 --- a/commands/edit-meme/two-buttons.js +++ b/commands/edit-meme/two-buttons.js @@ -78,6 +78,6 @@ module.exports = class TwoButtonsCommand extends Command { lineOffset += 5; } ctx.rotate(12 * (Math.PI / 180)); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'two-buttons.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'two-buttons.png' }] }); } }; diff --git a/commands/edit-meme/ugly.js b/commands/edit-meme/ugly.js index a8fbdd9d..7045a8ec 100644 --- a/commands/edit-meme/ugly.js +++ b/commands/edit-meme/ugly.js @@ -45,6 +45,6 @@ module.exports = class UglyCommand extends Command { const { x, y, width, height } = centerImagePart(data, 170, 170, 120, 52); ctx.drawImage(data, x, y, width, height); ctx.drawImage(base, 0, 0); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'ugly.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'ugly.png' }] }); } }; diff --git a/commands/edit-meme/ultimate-tattoo.js b/commands/edit-meme/ultimate-tattoo.js index 27d168a9..65439a81 100644 --- a/commands/edit-meme/ultimate-tattoo.js +++ b/commands/edit-meme/ultimate-tattoo.js @@ -47,6 +47,6 @@ module.exports = class UltimateTattooCommand extends Command { const { x, y, width, height } = centerImagePart(data, 300, 300, 84, 690); ctx.drawImage(data, x, y, width, height); ctx.rotate(10 * (Math.PI / 180)); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'ultimate-tattoo.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'ultimate-tattoo.png' }] }); } }; diff --git a/commands/edit-meme/vietnam-flashbacks.js b/commands/edit-meme/vietnam-flashbacks.js index 5dfc99af..6ff4ac2f 100644 --- a/commands/edit-meme/vietnam-flashbacks.js +++ b/commands/edit-meme/vietnam-flashbacks.js @@ -45,7 +45,7 @@ module.exports = class VietnamFlashbacksCommand extends Command { ctx.drawImage(base, (data.width / 2) - (width / 2), 0, width, data.height); ctx.globalAlpha = 0.675; ctx.drawImage(data, 0, 0); - const attachment = canvas.toBuffer(); + const attachment = canvas.toBuffer('image/png'); if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.'); return msg.say({ files: [{ attachment, name: 'vietnam-flashbacks.png' }] }); } diff --git a/commands/edit-meme/whiteboard.js b/commands/edit-meme/whiteboard.js index f335fece..e2682705 100644 --- a/commands/edit-meme/whiteboard.js +++ b/commands/edit-meme/whiteboard.js @@ -76,6 +76,6 @@ module.exports = class WhiteboardCommand extends Command { const height = resolveTopMost + ((fontSize + 10) * i); ctx.fillText(resolveLines[i], 195, height); } - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'whiteboard.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'whiteboard.png' }] }); } }; diff --git a/commands/edit-meme/worse-than-hitler.js b/commands/edit-meme/worse-than-hitler.js index 8f2a375b..01698240 100644 --- a/commands/edit-meme/worse-than-hitler.js +++ b/commands/edit-meme/worse-than-hitler.js @@ -44,6 +44,6 @@ module.exports = class WorseThanHitlerCommand extends Command { const ctx = canvas.getContext('2d'); ctx.drawImage(base, 0, 0); ctx.drawImage(avatar, 47, 42, 140, 140); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'worse-than-hitler.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'worse-than-hitler.png' }] }); } }; diff --git a/commands/edit-meme/worthless.js b/commands/edit-meme/worthless.js index f1c62f5e..72c25514 100644 --- a/commands/edit-meme/worthless.js +++ b/commands/edit-meme/worthless.js @@ -53,6 +53,6 @@ module.exports = class WorthlessCommand extends Command { const center2 = centerImagePart(data, 75, 75, 625, 55); ctx.drawImage(data, center2.x, center2.y, center2.width, center2.height); ctx.rotate(-160 * (Math.PI / 180)); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'worthless.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'worthless.png' }] }); } }; diff --git a/commands/games-mp/car-race.js b/commands/games-mp/car-race.js index 05f8c6e7..a066c5b3 100644 --- a/commands/games-mp/car-race.js +++ b/commands/games-mp/car-race.js @@ -551,6 +551,6 @@ module.exports = class CarRaceCommand extends Command { greyscale(ctx, bg.width - 110 - 125, 50, 125, 125); } } - return canvas.toBuffer(); + return canvas.toBuffer('image/png'); } }; diff --git a/commands/games-mp/chess.js b/commands/games-mp/chess.js index ea9426c5..00555802 100644 --- a/commands/games-mp/chess.js +++ b/commands/games-mp/chess.js @@ -293,7 +293,7 @@ module.exports = class ChessCommand extends Command { row -= 1; } } - return canvas.toBuffer(); + return canvas.toBuffer('image/png'); } async loadImages() { diff --git a/commands/games-sp/captcha.js b/commands/games-sp/captcha.js index 9512aafd..f0a40d21 100644 --- a/commands/games-sp/captcha.js +++ b/commands/games-sp/captcha.js @@ -41,7 +41,7 @@ module.exports = class CaptchaCommand extends Command { ctx.strokeText(text, 15, 26); await msg.reply( '**You have 15 seconds, what does the captcha say?**', - { files: [{ attachment: canvas.toBuffer(), name: 'captcha-quiz.png' }] } + { files: [{ attachment: canvas.toBuffer('image/png'), name: 'captcha-quiz.png' }] } ); const msgs = await msg.channel.awaitMessages({ filter: res => res.author.id === msg.author.id, diff --git a/commands/games-sp/horse-race.js b/commands/games-sp/horse-race.js index 69ffbf8b..99c36a40 100644 --- a/commands/games-sp/horse-race.js +++ b/commands/games-sp/horse-race.js @@ -107,6 +107,6 @@ module.exports = class HorseRaceCommand extends Command { ctx.font = this.client.fonts.get('Paladins.otf').toCanvasString(15); ctx.fillText(horse.name, 251, 138 + (49 * i)); } - return { attachment: canvas.toBuffer(), name: 'leaderboard.png' }; + return { attachment: canvas.toBuffer('image/png'), name: 'leaderboard.png' }; } }; diff --git a/commands/games-sp/jeopardy.js b/commands/games-sp/jeopardy.js index 9ed593b1..65275fca 100644 --- a/commands/games-sp/jeopardy.js +++ b/commands/games-sp/jeopardy.js @@ -88,6 +88,6 @@ module.exports = class JeopardyCommand extends Command { ctx.fillStyle = 'white'; ctx.fillText(lines[i], canvas.width / 2, height); } - return canvas.toBuffer(); + return canvas.toBuffer('image/png'); } }; diff --git a/commands/games-sp/pokemon-advantage.js b/commands/games-sp/pokemon-advantage.js index ca9e3765..fb84a2c5 100644 --- a/commands/games-sp/pokemon-advantage.js +++ b/commands/games-sp/pokemon-advantage.js @@ -147,7 +147,7 @@ module.exports = class PokemonAdvantageCommand extends Command { ctx.fillText(pokemon1.name, 128, 250, 175); ctx.strokeText(pokemon2.name, 348, 250, 175); ctx.fillText(pokemon2.name, 348, 250, 175); - return { attachment: canvas.toBuffer(), name }; + return { attachment: canvas.toBuffer('image/png'), name }; } calculateAdvantage(pkmn1, pkmn2) { diff --git a/commands/games-sp/typing-test.js b/commands/games-sp/typing-test.js index 5252c403..a70d948e 100644 --- a/commands/games-sp/typing-test.js +++ b/commands/games-sp/typing-test.js @@ -80,6 +80,6 @@ module.exports = class TypingTestCommand extends Command { ctx.fillRect(0, 0, canvas.width, canvas.height); ctx.fillStyle = 'black'; ctx.fillText(sentence, canvas.width / 2, canvas.height / 2); - return canvas.toBuffer(); + return canvas.toBuffer('image/png'); } }; diff --git a/commands/games-sp/whos-that-pokemon.js b/commands/games-sp/whos-that-pokemon.js index 0b077869..fec349ca 100644 --- a/commands/games-sp/whos-that-pokemon.js +++ b/commands/games-sp/whos-that-pokemon.js @@ -149,6 +149,6 @@ module.exports = class WhosThatPokemonCommand extends Command { ctx.fillStyle = '#3c5aa6'; ctx.fillText(pokemon.name, 362, 158, 240); } - return { attachment: canvas.toBuffer(), name }; + return { attachment: canvas.toBuffer('image/png'), name }; } }; diff --git a/commands/info/emoji-image.js b/commands/info/emoji-image.js index 7cb688f0..2cdea069 100644 --- a/commands/info/emoji-image.js +++ b/commands/info/emoji-image.js @@ -39,6 +39,6 @@ module.exports = class EmojiImageCommand extends Command { const canvas = createCanvas(512, 512); const ctx = canvas.getContext('2d'); ctx.drawImage(emojiImage, 0, 0, 512, 512); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'emoji-image.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'emoji-image.png' }] }); } }; diff --git a/commands/pokedex/pokedex-box-sprite.js b/commands/pokedex/pokedex-box-sprite.js index 4833df0a..c3094e0f 100644 --- a/commands/pokedex/pokedex-box-sprite.js +++ b/commands/pokedex/pokedex-box-sprite.js @@ -90,7 +90,7 @@ module.exports = class PokedexBoxSpriteCommand extends Command { const height = 30 * ratio; ctx.drawImage(this.client.pokemon.sprites, x, y, 40, 30, 0, 0, 250, height); cropToContent(ctx, canvas, canvas.width, canvas.height); - attachment = canvas.toBuffer(); + attachment = canvas.toBuffer('image/png'); } return msg.say(`#${pokemon.displayID} - ${pokemon.name}`, { files: [{ attachment, name: 'box.png' }] }); } diff --git a/commands/random-seed/friendship.js b/commands/random-seed/friendship.js index c8107cf6..61f25c39 100644 --- a/commands/random-seed/friendship.js +++ b/commands/random-seed/friendship.js @@ -90,7 +90,7 @@ module.exports = class FriendshipCommand extends Command { ctx.fillText(this.calculateLevelText(level, self, owner, authorUser, botUser), 600, 296); ctx.font = this.client.fonts.get('Pinky Cupid.otf').toCanvasString(90); ctx.fillText(level > 49 ? '👍' : '👎', 600, 100); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'friendship.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'friendship.png' }] }); } calculateLevelText(level, self, owner, authorUser, botUser) { diff --git a/commands/random-seed/ship.js b/commands/random-seed/ship.js index 9904f97e..72744d43 100644 --- a/commands/random-seed/ship.js +++ b/commands/random-seed/ship.js @@ -93,7 +93,7 @@ module.exports = class ShipCommand extends Command { ctx.fillText(this.calculateLevelText(level, self, owner, authorUser, botUser), 600, 296); ctx.font = this.client.fonts.get('Pinky Cupid.otf').toCanvasString(90); ctx.fillText(level > 49 ? '❤️' : '💔', 600, 100); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'ship.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'ship.png' }] }); } calculateLevelText(level, self, owner, authorUser, botUser) { diff --git a/commands/random-seed/think-of.js b/commands/random-seed/think-of.js index f26298d8..1fe0be9c 100644 --- a/commands/random-seed/think-of.js +++ b/commands/random-seed/think-of.js @@ -88,6 +88,6 @@ module.exports = class ThinkOfCommand extends Command { ctx.fillText(thought.text, 600, 296); ctx.font = this.client.fonts.get('Pinky Cupid.otf').toCanvasString(90); ctx.fillText(thought.emoji, 600, 100); - return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'think-of.png' }] }); + return msg.say({ files: [{ attachment: canvas.toBuffer('image/png'), name: 'think-of.png' }] }); } }; diff --git a/commands/search/periodic-table.js b/commands/search/periodic-table.js index c313124b..fb434329 100644 --- a/commands/search/periodic-table.js +++ b/commands/search/periodic-table.js @@ -97,7 +97,7 @@ module.exports = class PeriodicTableCommand extends Command { const phase = element.undiscovered ? `hypothetical ${element.phase || 'element'}` : element.phase; return msg.say( `**${element.name} (${element.symbol})** is a ${phase} in ${period}.`, - { files: [{ attachment: canvas.toBuffer(), name: `${element.name}.png` }] } + { files: [{ attachment: canvas.toBuffer('image/png'), name: `${element.name}.png` }] } ); } diff --git a/structures/pokemon/Pokemon.js b/structures/pokemon/Pokemon.js index faa3cbd4..df85cd99 100644 --- a/structures/pokemon/Pokemon.js +++ b/structures/pokemon/Pokemon.js @@ -159,7 +159,7 @@ module.exports = class Pokemon { const y = Math.floor(this.id / 12) * 30; ctx.drawImage(this.store.sprites, x, y, 40, 30, 0, 0, 40, 30); cropToContent(ctx, canvas, canvas.width, canvas.height); - return canvas.toBuffer(); + return canvas.toBuffer('image/png'); } async fetchSmogonTiers(...gens) { diff --git a/util/Canvas.js b/util/Canvas.js index d43caefa..d5ab12ca 100644 --- a/util/Canvas.js +++ b/util/Canvas.js @@ -201,8 +201,7 @@ module.exports = class CanvasUtil { const lines = text.split('\n'); let currentY = y; for (const line of lines) { - if (maxLen) ctx.fillText(line, x, currentY, maxLen); - else ctx.fillText(line, x, currentY); + ctx.fillText(line, x, currentY, maxLen); const metrics = ctx.measureText(line); currentY += metrics.emHeightAscent + metrics.emHeightDescent; }