card-drop/src/timers/GiveCurrency.ts
Ethan Lane 40db7cfebc
Some checks failed
Test / build (push) Failing after 8s
Add paginated view for embeds by search
2024-08-14 22:26:47 +01:00

19 lines
No EOL
687 B
TypeScript

import AppLogger from "../client/appLogger.js";
import CardConstants from "../constants/CardConstants.js";
import User from "../database/entities/app/User.js";
export default async function GiveCurrency() {
AppLogger.LogDebug("Timers/GiveCurrency", "Giving currency to every known user");
const users = await User.FetchAll(User);
const usersFiltered = users.filter(x => x.Currency < 1000);
for (const user of usersFiltered) {
user.AddCurrency(CardConstants.TimerGiveAmount);
}
User.SaveAll(User, users);
AppLogger.LogDebug("Timers/GiveCurrency", `Successfully gave +${CardConstants.TimerGiveAmount} currency to ${usersFiltered.length} users`);
}