From 4ce09185d3ea294be9dffb78d8c4f4266521766f Mon Sep 17 00:00:00 2001 From: baz Date: Wed, 23 Apr 2025 22:47:00 +0100 Subject: [PATCH] Separate Developer and Publishers in gameDetails --- commands/100-games/gameDetails.js | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/commands/100-games/gameDetails.js b/commands/100-games/gameDetails.js index 0571276..a09b0fd 100644 --- a/commands/100-games/gameDetails.js +++ b/commands/100-games/gameDetails.js @@ -69,16 +69,37 @@ module.exports = { } if (game.involved_companies) { - const companies = []; + const developers = []; + const publishers = []; for (const company of game.involved_companies) { const info = await getCompanyInfo(company); - if (info.name) { - companies.push(info.name); + + if (info.developed) + { + if (info.developed.find(item => item === game.id)) { + developers.push(info.name); + } + } + + + if (info.published) + { + if (info.published.find(item => item === game.id)) { + publishers.push(info.name); + } } } - embed.addFields({ name: 'Developers', value: `${companies.join(', ')}`, inline: true }); + if (developers.length > 0) + { + embed.addFields({ name: 'Developers', value: `${developers.join(', ')}`, inline: true }); + } + + if (publishers.length > 0) + { + embed.addFields({ name: 'Publishers', value: `${publishers.join(', ')}`, inline: true }); + } } embed.addFields({ name: 'Release Date', value: `${release_date}`, inline: true });