Compare commits

..

No commits in common. "30c62bd94ddad82ce31cb1e4afd903b0c7b4df29" and "25d099928f26e27bfda60323be11c509940904b8" have entirely different histories.

4 changed files with 9 additions and 7 deletions

View file

@ -17,6 +17,10 @@ export default class User extends AppBaseEntity {
this.Currency += amount;
}
public AddCurrency(amount: number) {
this.Currency += amount;
}
public RemoveCurrency(amount: number): boolean {
if (this.Currency < amount) return false;

View file

@ -1,12 +1,11 @@
import { CronJob } from "cron";
import { v4 } from "uuid";
import { Primitive } from "../type/primitive";
interface Timer {
id: string;
job: CronJob;
context: Map<string, Primitive>;
onTick: ((context: Map<string, Primitive>) => void) | ((context: Map<string, Primitive>) => Promise<void>);
context: Map<string, any>;
onTick: ((context: Map<string, any>) => void) | ((context: Map<string, any>) => Promise<void>);
runOnStart: boolean;
}
@ -20,9 +19,9 @@ export default class TimerHelper {
public AddTimer(
cronTime: string,
timeZone: string,
onTick: ((context: Map<string, Primitive>) => void) | ((context: Map<string, Primitive>) => Promise<void>),
onTick: ((context: Map<string, any>) => void) | ((context: Map<string, any>) => Promise<void>),
runOnStart: boolean = false): string {
const context = new Map<string, Primitive>();
const context = new Map<string, any>();
const job = new CronJob(
cronTime,

View file

@ -1,7 +1,7 @@
import AppLogger from "../client/appLogger";
import User from "../database/entities/app/User";
export default async function GiveCurrency() {
export default async function GiveCurrency(context: Map<string, any>) {
AppLogger.LogInfo("Timers/GiveCurrency", "Giving currency to every known user");
const users = await User.FetchAll(User);

View file

@ -1 +0,0 @@
export type Primitive = string | number | boolean;