Add checking to involved_companies

This commit is contained in:
baz 2023-12-06 23:48:50 +00:00
parent 710f84b165
commit ec8f707414
1 changed files with 12 additions and 7 deletions

View File

@ -38,12 +38,6 @@ module.exports = {
const release_date = new Intl.DateTimeFormat('en-GB', { dateStyle: 'full' }).format(game.first_release_date * 1000); const release_date = new Intl.DateTimeFormat('en-GB', { dateStyle: 'full' }).format(game.first_release_date * 1000);
const companies = [];
for (const company of game.involved_companies) {
const info = await getCompanyInfo(company);
companies.push(info.name);
}
const genres = []; const genres = [];
for (const genreId of game.genres) { for (const genreId of game.genres) {
const genre = await getGenres(genreId); const genre = await getGenres(genreId);
@ -56,7 +50,18 @@ module.exports = {
embed.setURL(`${game.url}`); embed.setURL(`${game.url}`);
embed.setThumbnail(`${coverUrl}`); embed.setThumbnail(`${coverUrl}`);
embed.addFields({ name: 'Description', value: `${game.summary}` }); embed.addFields({ name: 'Description', value: `${game.summary}` });
if (game.involved_companies) {
const companies = [];
for (const company of game.involved_companies) {
const info = await getCompanyInfo(company);
companies.push(info.name);
}
embed.addFields({ name: 'Developers', value: `${companies.join(', ')}`, inline: true }); embed.addFields({ name: 'Developers', value: `${companies.join(', ')}`, inline: true });
}
embed.addFields({ name: 'Release Date', value: `${release_date}`, inline: true }); embed.addFields({ name: 'Release Date', value: `${release_date}`, inline: true });
embed.addFields({ name: 'Genres', value: `${genres.join(', ')}`, inline: true }); embed.addFields({ name: 'Genres', value: `${genres.join(', ')}`, inline: true });