Skip to content

Commit

Permalink
fix: news object fields
Browse files Browse the repository at this point in the history
  • Loading branch information
TobiTenno committed Jul 2, 2018
1 parent 3f0947e commit ce63d63
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/embeds/NewsEmbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,18 @@ class NewsEmbed extends BaseEmbed {
} else {
value = value.length > 0 ? value : ['No News Currently'];
}
const first = news[0];
if (news.length === 1) {
this.title = `[${platform.toUpperCase()}] ${news.message}`;
this.title = `[${platform.toUpperCase()}] ${first.message}`;
this.fields = undefined;
this.footer.text = 'Published ';
this.timestamp = new Date(news.date);
this.url = news.link;
this.timestamp = new Date(first.date);
this.url = first.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.image = { url: first ? first.imageLink : '' };
}
}

Expand Down

0 comments on commit ce63d63

Please sign in to comment.