updates to check because apparently v1 has a decent companies endpoint

This commit is contained in:
2025-11-10 14:46:28 -05:00
parent 066aa84ecd
commit a31310c4e8
2 changed files with 51 additions and 7 deletions

11
torn.js
View File

@@ -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();