Skip to content

Commit

Permalink
fix: flex frame embed fields for abilities, passive, and profile
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiTenno committed Oct 20, 2020
1 parent 3a0c873 commit 72f9a22
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/CommonFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('⏮');
Expand Down
17 changes: 12 additions & 5 deletions src/embeds/FrameEmbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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,
},
{
Expand All @@ -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') }];
Expand Down

0 comments on commit 72f9a22

Please sign in to comment.