diff --git a/commands/stupid/howiskzn.js b/commands/stupid/howiskzn.js index f6c1743..a27c15f 100644 --- a/commands/stupid/howiskzn.js +++ b/commands/stupid/howiskzn.js @@ -14,21 +14,48 @@ module.exports = { (KZNKing.job.position === "Director") ? message += `He is director of ${KZNKing.job.company_name}. ` : message += `He is not director of a company. `; (KZNKing.faction.position === "Leader") ? message += `He is leader of ${KZNKing.faction.faction_name}. ` : message += `He is not leader of his faction. `; - const company = (await torn.api(`https://api.torn.com/v2/user/${kznID}/job?`)).job; + const company = (await torn.company(KZNKing.job.company_id)); + console.log(company); const jobEmbed = new EmbedBuilder() .setTitle(company.name) - .setURL(`https://www.torn.com/joblist.php#/p=corpinfo&ID=${company.id}`) + .setURL(`https://www.torn.com/joblist.php#/p=corpinfo&ID=${company.ID}`) .addFields( { - name: "Stars", - value: String(company.rating), + name: "Daily Income", + value: `$${company.daily_income.toLocaleString()}`, + inline: true + }, + { + name: "Weekly Income", + value: `$${company.weekly_income.toLocaleString()}`, inline: true }, { name: "Days", - value: String(company.days_in_company), + value: String(company.days_old), inline: true }, + { + name: "Daily Customers", + value: `${company.daily_customers}`, + inline: true + }, + { + name: "Weekly Customers", + value: `${company.weekly_customers}`, + inline: true + }, + { + name: "Employees", + value: `${company.employees_hired}/${company.employees_capacity}`, + inline: true + }, + { + name: "Stars", + value: String(company.rating), + inline: true + } + ) const faction = await torn.faction.basic(KZNKing.faction.faction_id) @@ -48,14 +75,20 @@ module.exports = { }, { name: "Respect", - value: `${faction.respect}`, + value: `${faction.respect.toLocaleString()}`, inline: true }, { name: "Age", value: `${faction.days_old}`, inline: true - } + }, + { + name: "Wars Won", + value: `${faction.rank.wins}`, + inline: true + }, + ) diff --git a/torn.js b/torn.js index 7144a89..3078e56 100644 --- a/torn.js +++ b/torn.js @@ -85,6 +85,17 @@ module.exports.faction = { } } +module.exports.company = async (company) => { + let response + if (company) { + response = await fetch(`https://api.torn.com/company/${company}?selections=profile&key=${config.torn}`); + } else { + response = await fetch(`https://api.torn.com/company/?selections=profile&key=${config.torn}`); + } + const data = await response.json(); + return(data.company); +} + module.exports.item = async (item) => { const response = await fetch(`https://api.torn.com/v2/torn/${item}/items?sort=ASC&key=${config.torn}`); const data = await response.json();