mirror of
https://github.com/cassoule/flopobot_v2.git
synced 2026-03-18 21:40:27 +01:00
quick fix
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { sleep } from 'openai/core';
|
||||
import { gork } from '../../utils/ai.js';
|
||||
import { formatTime, postAPOBuy, getAPOUsers } from '../../utils/index.js';
|
||||
import {formatTime, postAPOBuy, getAPOUsers, getAkhys} from '../../utils/index.js';
|
||||
import { channelPointsHandler, slowmodesHandler, randomSkinPrice, initTodaysSOTD } from '../../game/points.js';
|
||||
import { requestTimestamps, activeSlowmodes, activePolls, skins } from '../../game/state.js';
|
||||
import { flopoDB, getUser, getAllUsers, updateManyUsers } from '../../database/index.js';
|
||||
import {client} from "../client.js";
|
||||
|
||||
// Constants for the AI rate limiter
|
||||
const MAX_REQUESTS_PER_INTERVAL = parseInt(process.env.MAX_REQUESTS || "5");
|
||||
@@ -187,5 +188,7 @@ async function handleAdminCommands(message) {
|
||||
message.reply(`SQL Error: ${e.message}`);
|
||||
}
|
||||
break;
|
||||
case `${prefix}:fetch-data`:
|
||||
await getAkhys(client);
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import { DiscordRequest } from '../api/discord.js';
|
||||
import { initTodaysSOTD } from '../game/points.js';
|
||||
import {
|
||||
insertManyUsers, insertManySkins, resetDailyReward,
|
||||
pruneOldLogs, getAllUsers as dbGetAllUsers, getSOTD,
|
||||
pruneOldLogs, getAllUsers as dbGetAllUsers, getSOTD, getUser, getAllUsers,
|
||||
} from '../database/index.js';
|
||||
import { activeInventories, activeSearchs, activePredis, pokerRooms, skins } from '../game/state.js';
|
||||
|
||||
@@ -34,6 +34,7 @@ export async function InstallGlobalCommands(appId, commands) {
|
||||
export async function getAkhys(client) {
|
||||
try {
|
||||
// 1. Fetch Discord Members
|
||||
const initial_akhys = getAllUsers.all().length;
|
||||
const guild = await client.guilds.fetch(process.env.GUILD_ID);
|
||||
const members = await guild.members.fetch();
|
||||
const akhys = members.filter(m => !m.user.bot && m.roles.cache.has(process.env.AKHY_ROLE_ID));
|
||||
@@ -47,7 +48,11 @@ export async function getAkhys(client) {
|
||||
if (usersToInsert.length > 0) {
|
||||
insertManyUsers(usersToInsert);
|
||||
}
|
||||
console.log(`[Sync] Found and synced ${akhys.size} users with the 'Akhy' role.`);
|
||||
|
||||
const new_akhys = getAllUsers.all().length;
|
||||
const diff = new_akhys - initial_akhys
|
||||
|
||||
console.log(`[Sync] Found and synced ${usersToInsert.length} ${diff !== 0 ? '(' + (diff > 0 ? '+' + diff : diff) + ') ' : ''}users with the 'Akhy' role. (ID:${process.env.AKHY_ROLE_ID})`);
|
||||
|
||||
// 2. Fetch Valorant Skins
|
||||
const [fetchedSkins, fetchedTiers] = await Promise.all([getValorantSkins(), getSkinTiers()]);
|
||||
|
||||
Reference in New Issue
Block a user