replace scheduler with round robin every x minutes

This commit is contained in:
2026-01-11 12:19:43 -05:00
parent b222d4a5d7
commit d00d5bb313
9 changed files with 77 additions and 59 deletions

View File

@@ -1,5 +1,5 @@
module.exports = async (client, torn, config) => {
console.debug("Task: Executing autoUpdateUpgrades");
const fs = require('fs');
const path = require('path');
const renderer = require('../utils/UpgradeRenderer.js');

View File

@@ -1,5 +1,5 @@
module.exports = async (client, torn, config) => {
console.debug("Task: Executing noItemOC");
const fs = require('fs');
const channel = client.channels.resolve(config.channels.ocAlert);
const now = new Date();

View File

@@ -1,5 +1,5 @@
module.exports = async (client, torn, config) => {
console.debug("Task: Executing unavailableOC");
const { EmbedBuilder } = require('discord.js');
const fs = require('fs');
const channel = client.channels.resolve(config.channels.ocAlert);
@@ -41,6 +41,10 @@ module.exports = async (client, torn, config) => {
let embed = new EmbedBuilder()
.setTitle('Crime Availability Check')
await torn.faction.crimes({ category: 'recruiting', offset: 0, sort: 'DESC' }).then(crimeList => {
if (!crimeList) {
console.error("unavailableOC: API returned no crimes.");
return;
}
const data = { crimes: crimeList };
data.crimes.forEach(crime => {
crimes.difficulty[crime.difficulty - 1].count++

View File

@@ -1,12 +1,17 @@
module.exports = async (client, torn, config) => {
console.debug("Task: Executing unpaidOC");
const { EmbedBuilder } = require('discord.js');
const fs = require('fs');
const channel = client.channels.resolve(config.channels.ocAlert);
const now = new Date();
const state = require('../state.json');
let embeds = [];
const data = { crimes: await torn.faction.crimes({ category: 'successful', from: now.getTime() / 1000 - 7 * 24 * 60 * 60, sort: 'DESC' }) };
const crimesList = await torn.faction.crimes({ category: 'successful', from: now.getTime() / 1000 - 7 * 24 * 60 * 60, sort: 'DESC' });
if (!crimesList) {
console.error("unpaidOC: API returned no crimes.");
return;
}
const data = { crimes: crimesList };
for (const crime of data.crimes) {
if (!crime.rewards.payout) {
console.debug(`unpaidOC: Found unpaid crime: ${crime.name}:${crime.id}`);