refactor caching to be better , uhh changed some things to v2,,,, other things?

This commit is contained in:
2026-01-12 10:06:40 -05:00
parent d00d5bb313
commit 3b8aeff340
7 changed files with 112 additions and 141 deletions

View File

@@ -5,13 +5,13 @@ module.exports = {
data: new SlashCommandBuilder()
.setName('profile')
.setDescription('Get your Torn profile')
.addIntegerOption(option =>
.addIntegerOption(option =>
option.setName('id')
.setDescription('User ID')),
.setDescription('User ID')),
async execute(interaction) {
let id
if (!interaction.options.getInteger('id')) {
id = await torn.self.id()
id = torn.self.player_id
console.log(`Profile: Looking up "${id}"`)
} else {
id = interaction.options.getInteger('id');

View File

@@ -98,7 +98,7 @@ module.exports = {
let companyFemales = 0;
let companyTotal = 0;
const companyFemalePromises = Object.entries(company.employees).map(([user]) => {
return torn.cache.user(user).then(data => {
return torn.user.basic(user).then(data => {
companyTotal++;
if (data.gender === "Female") {
companyFemales++;
@@ -110,7 +110,7 @@ module.exports = {
let factionTotal = 0;
const factionMembers = await torn.faction.members(KZNKing.faction.faction_id);
const factionFemalePromises = factionMembers.map((user) => {
return torn.cache.user(user.id).then(data => {
return torn.user.basic(user.id).then(data => {
factionTotal++;
if (data.gender === "Female") {
factionFemales++;

View File

@@ -55,7 +55,7 @@ module.exports = {
? rewards.items.find(i => (i.id == itemId || i.ID == itemId)).quantity
: rewards.items[itemId];
const itemData = await torn.item(itemId);
const itemData = await torn.item(itemId, true);
if (itemData && itemData.value && itemData.value.market_price) {
calculatedTotal += itemData.value.market_price * qt;
}