updates to check because apparently v1 has a decent companies endpoint
This commit is contained in:
@@ -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.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. `;
|
(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()
|
const jobEmbed = new EmbedBuilder()
|
||||||
.setTitle(company.name)
|
.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(
|
.addFields(
|
||||||
{
|
{
|
||||||
name: "Stars",
|
name: "Daily Income",
|
||||||
value: String(company.rating),
|
value: `$${company.daily_income.toLocaleString()}`,
|
||||||
|
inline: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Weekly Income",
|
||||||
|
value: `$${company.weekly_income.toLocaleString()}`,
|
||||||
inline: true
|
inline: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Days",
|
name: "Days",
|
||||||
value: String(company.days_in_company),
|
value: String(company.days_old),
|
||||||
inline: true
|
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)
|
const faction = await torn.faction.basic(KZNKing.faction.faction_id)
|
||||||
@@ -48,14 +75,20 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Respect",
|
name: "Respect",
|
||||||
value: `${faction.respect}`,
|
value: `${faction.respect.toLocaleString()}`,
|
||||||
inline: true
|
inline: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Age",
|
name: "Age",
|
||||||
value: `${faction.days_old}`,
|
value: `${faction.days_old}`,
|
||||||
inline: true
|
inline: true
|
||||||
}
|
},
|
||||||
|
{
|
||||||
|
name: "Wars Won",
|
||||||
|
value: `${faction.rank.wins}`,
|
||||||
|
inline: true
|
||||||
|
},
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
11
torn.js
11
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) => {
|
module.exports.item = async (item) => {
|
||||||
const response = await fetch(`https://api.torn.com/v2/torn/${item}/items?sort=ASC&key=${config.torn}`);
|
const response = await fetch(`https://api.torn.com/v2/torn/${item}/items?sort=ASC&key=${config.torn}`);
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|||||||
Reference in New Issue
Block a user