Skip to content

Commit

Permalink
feat: update news embed to use better fields
Browse files Browse the repository at this point in the history
Title from the message if it's the only one, news date in 'Published', clickable title with platform and link instead of markdown for masking the link
  • Loading branch information
TobiTenno committed Jul 2, 2018
1 parent 4ab5f34 commit 3f0947e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/embeds/NewsEmbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,17 @@ class NewsEmbed extends BaseEmbed {
} else {
value = value.length > 0 ? value : ['No News Currently'];
}
this.fields = value.map(val => ({ name: '_ _', value: val.join('\n') }));
if (news.length === 1) {
this.title = `[${platform.toUpperCase()}] ${news.message}`;
this.fields = undefined;
this.footer.text = 'Published ';
this.timestamp = new Date(news.date);
this.url = news.link;
} else {
this.fields = value.map(val => ({ name: '_ _', value: val.join('\n') }));
this.footer.text = platform.toUpperCase();
}
this.image = { url: news[0] ? news[0].imageLink : '' };
this.footer.text = platform.toUpperCase();
}
}

Expand Down

0 comments on commit 3f0947e

Please sign in to comment.