Add extra checks to embed builder

This commit is contained in:
baz 2023-12-06 23:45:23 +00:00
parent ec25605a8a
commit 710f84b165
1 changed files with 17 additions and 13 deletions

View File

@ -50,19 +50,23 @@ module.exports = {
genres.push(genre); genres.push(genre);
} }
const embed = new EmbedBuilder() const embed = new EmbedBuilder();
.setColor(0x6441a5) embed.setColor(0x6441a5);
.setTitle(`${game.name}`) embed.setTitle(`${game.name}`);
.setURL(`${game.url}`) embed.setURL(`${game.url}`);
.setThumbnail(`${coverUrl}`) embed.setThumbnail(`${coverUrl}`);
.addFields({ name: 'Description', value: `${game.summary}` }) embed.addFields({ name: 'Description', value: `${game.summary}` });
.addFields({ name: 'Developers', value: `${companies.join(', ')}`, inline: true }) embed.addFields({ name: 'Developers', value: `${companies.join(', ')}`, inline: true });
.addFields({ name: 'Release Date', value: `${release_date}`, inline: true }) embed.addFields({ name: 'Release Date', value: `${release_date}`, inline: true });
.addFields({ name: 'Genres', value: `${genres.join(', ')}`, inline: true }) embed.addFields({ name: 'Genres', value: `${genres.join(', ')}`, inline: true });
.addFields({ name: 'Rating', value: `${game.total_rating.toFixed(0)} / 100, ${game.total_rating_count } ratings`, inline: true })
.addFields({ name: 'ID', value: `${game.id}`, inline: true }) if (game.total_rating) {
.setFooter({ text: 'The Ochulus • 100 Games Challenge', iconURL: interaction.client.user.avatarURL() }) embed.addFields({ name: 'Rating', value: `${game.total_rating.toFixed(0)} / 100, ${game.total_rating_count } ratings`, inline: true });
.setTimestamp(); }
embed.addFields({ name: 'ID', value: `${game.id}`, inline: true });
embed.setFooter({ text: 'The Ochulus • 100 Games Challenge', iconURL: interaction.client.user.avatarURL() });
embed.setTimestamp();
if (game.franchises) { if (game.franchises) {
const franchise = await getFranchise(game.franchises); const franchise = await getFranchise(game.franchises);