From 30c4676b12db78c928f05304da800c6dcf2640b8 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Sun, 16 Apr 2017 16:55:24 +0000 Subject: [PATCH] Try This --- commands/search/pokedex.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/commands/search/pokedex.js b/commands/search/pokedex.js index e199b270..ec9fec72 100644 --- a/commands/search/pokedex.js +++ b/commands/search/pokedex.js @@ -34,8 +34,8 @@ module.exports = class PokedexCommand extends Command { const data = response.body; const entry = pokedex.entry[pokemon] || 'Not Yet Implemented'; const indexZero = '000'.slice(data.id.length); - const type1 = data.types[1].type.name || '-'; - const type2 = data.types[0].type.name || '-'; + const type1 = data.types[1] ? data.types[1].type.name : '-'; + const type2 = data.types[0] ? data.types[0].type.name : '-'; const embed = new RichEmbed() .setAuthor(`#${indexZero}${data.id} ${data.name}`, `http://www.serebii.net/pokedex-sm/icon/${indexZero}${data.id}.png`) .setColor(0xFF0000) @@ -63,6 +63,7 @@ module.exports = class PokedexCommand extends Command { return message.embed(embed); } catch (err) { + console.error(err); return message.say(':x: Error! Something went wrong!'); } }