From 72f9a220e1b9c7e79feb7908dc6eb5a278b183f1 Mon Sep 17 00:00:00 2001 From: Tobiah Date: Tue, 20 Oct 2020 15:01:23 +0000 Subject: [PATCH] fix: flex frame embed fields for abilities, passive, and profile --- src/CommonFunctions.js | 2 +- src/embeds/FrameEmbed.js | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/CommonFunctions.js b/src/CommonFunctions.js index 3c63383d4..7c2dc2374 100644 --- a/src/CommonFunctions.js +++ b/src/CommonFunctions.js @@ -442,7 +442,7 @@ const checkAndMergeEmbeds = (original, value) => { * @param {Discord.User} author Calling author */ const createPageCollector = async (msg, pages, author) => { - if (pages.length <= 1) return; + if (pages.length <= 1 || !msg) return; let page = 1; // await msg.react('⏮'); diff --git a/src/embeds/FrameEmbed.js b/src/embeds/FrameEmbed.js index f387bd41a..97744f48d 100644 --- a/src/embeds/FrameEmbed.js +++ b/src/embeds/FrameEmbed.js @@ -28,11 +28,15 @@ class FrameEmbed extends BaseEmbed { } this.color = frame.color; this.fields = [ - { + (frame.url || frame.prime_url) ? { name: 'Profile', value: `[Frame Profile](${frame.url})${frame.prime_url ? `\n[Prime Intro](${frame.prime_url})` : ''}`, inline: false, - }, + } : false, + frame.passiveDescription ? { + name: 'Passive', + value: `_${frame.passiveDescription}_`, + } : false, { name: 'Minimum Mastery', value: frame.masteryReq || 'N/A', @@ -60,7 +64,7 @@ class FrameEmbed extends BaseEmbed { }, { name: 'Conclave', - value: frame.conclave || 'N/A', + value: emojify((frame.conclave ? 'green_tick' : 'red_tick') || 'N/A'), inline: true, }, { @@ -73,11 +77,14 @@ class FrameEmbed extends BaseEmbed { value: emojify(frame.polarities && frame.polarities.length > 0 ? frame.polarities.join(' ') : 'No polarities'), inline: true, }, - { + { // this is coming out too long, needs to be chunked name: 'Abilities', - value: frame.abilities.map(ability => `\u200B\t**${ability.name}:**\n\t_${ability.description}_`).join('\n\u200B\n'), + value: '**=============**', }, ]; + + this.fields.push(...frame.abilities.map(ability => ({ name: ability.name, value: `_${ability.description}_` }))); + this.fields = this.fields.filter(field => field); } else { this.title = 'Available Warframes'; this.fields = [{ name: '\u200B', value: frames.map(stat => stat.name).join('\n') }];