Compare commits
2 commits
caa991a259
...
981acefcf6
Author | SHA1 | Date | |
---|---|---|---|
981acefcf6 | |||
37ce41a384 |
3 changed files with 7 additions and 3 deletions
|
@ -79,7 +79,7 @@ export class CoreClient extends Client {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
AppLogger.LogInfo("Client", "App Data Source Initialised");
|
AppLogger.LogInfo("Client", "App Data Source Initialised");
|
||||||
|
|
||||||
const timerId = this._timerHelper.AddTimer("*/30 * * * * *", "Europe/London", GiveCurrency, false);
|
const timerId = this._timerHelper.AddTimer("*/20 * * * *", "Europe/London", GiveCurrency, false);
|
||||||
this._timerHelper.StartTimer(timerId);
|
this._timerHelper.StartTimer(timerId);
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
|
|
3
src/constants/CardConstants.ts
Normal file
3
src/constants/CardConstants.ts
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
export default class CardConstants {
|
||||||
|
public static readonly TimerGiveAmount = 10;
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
import AppLogger from "../client/appLogger";
|
import AppLogger from "../client/appLogger";
|
||||||
|
import CardConstants from "../constants/CardConstants";
|
||||||
import User from "../database/entities/app/User";
|
import User from "../database/entities/app/User";
|
||||||
|
|
||||||
export default async function GiveCurrency() {
|
export default async function GiveCurrency() {
|
||||||
|
@ -7,10 +8,10 @@ export default async function GiveCurrency() {
|
||||||
const users = await User.FetchAll(User);
|
const users = await User.FetchAll(User);
|
||||||
|
|
||||||
for (const user of users) {
|
for (const user of users) {
|
||||||
user.AddCurrency(5);
|
user.AddCurrency(CardConstants.TimerGiveAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
User.SaveAll(User, users);
|
User.SaveAll(User, users);
|
||||||
|
|
||||||
AppLogger.LogInfo("Timers/GiveCurrency", `Successfully gave +5 currency to ${users.length} users`);
|
AppLogger.LogInfo("Timers/GiveCurrency", `Successfully gave +${CardConstants.TimerGiveAmount} currency to ${users.length} users`);
|
||||||
}
|
}
|
Loading…
Reference in a new issue