From 4c76916156251eee6fff676a1bf947f04751260e Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Fri, 29 Mar 2024 16:53:15 -0400 Subject: [PATCH] Easier error location --- commands/pokedex/pokedex-box-sprite.js | 32 +++++++++++--------------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/commands/pokedex/pokedex-box-sprite.js b/commands/pokedex/pokedex-box-sprite.js index 7f323342..7c0368f5 100644 --- a/commands/pokedex/pokedex-box-sprite.js +++ b/commands/pokedex/pokedex-box-sprite.js @@ -66,23 +66,19 @@ module.exports = class PokedexBoxSpriteCommand extends Command { } async run(msg, { pokemon }) { - try { - if (!this.client.pokemon.sprites) await this.client.pokemon.loadSprites(); - const canvas = createCanvas(250, 250); - const ctx = canvas.getContext('2d'); - const x = 40 * (this.id % 12); - const y = Math.floor(this.id / 12) * 30; - ctx.imageSmoothingEnabled = false; - ctx.drawImage(this.client.pokemon.sprites, x, y, 40, 30, 0, 0, 250, 250); - cropToContent(ctx, canvas, canvas.width, canvas.height); - return msg.say(`#${pokemon.displayID} - ${pokemon.name}`, { - files: [{ - attachment: canvas.toBuffer(), - name: 'box.png' - }] - }); - } catch (err) { - return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); - } + if (!this.client.pokemon.sprites) await this.client.pokemon.loadSprites(); + const canvas = createCanvas(250, 250); + const ctx = canvas.getContext('2d'); + const x = 40 * (this.id % 12); + const y = Math.floor(this.id / 12) * 30; + ctx.imageSmoothingEnabled = false; + ctx.drawImage(this.client.pokemon.sprites, x, y, 40, 30, 0, 0, 250, 250); + cropToContent(ctx, canvas, canvas.width, canvas.height); + return msg.say(`#${pokemon.displayID} - ${pokemon.name}`, { + files: [{ + attachment: canvas.toBuffer(), + name: 'box.png' + }] + }); } };