2020-05-02 05:35:33 +00:00
|
|
|
import UserWarning from './models/UserWarning';
|
|
|
|
import UserBan from './models/UserBan';
|
2020-05-02 19:06:35 +00:00
|
|
|
import { IGameDBEntry, IResponses } from './models/interfaces';
|
2022-09-14 08:30:27 +00:00
|
|
|
import * as discord from 'discord.js';
|
2020-05-02 05:35:33 +00:00
|
|
|
|
|
|
|
/* Application State */
|
|
|
|
class State {
|
2021-09-13 03:08:43 +00:00
|
|
|
logChannel: discord.TextChannel | discord.DMChannel | null;
|
|
|
|
msglogChannel: discord.TextChannel | discord.DMChannel | null;
|
2020-05-02 05:35:33 +00:00
|
|
|
warnings: UserWarning[];
|
2020-05-02 19:06:35 +00:00
|
|
|
responses: IResponses;
|
2020-05-02 05:35:33 +00:00
|
|
|
bans: UserBan[];
|
|
|
|
stats: { joins: number; ruleAccepts: number; leaves: number; warnings: number; };
|
|
|
|
lastGameDBUpdate: number;
|
|
|
|
gameDB: IGameDBEntry[];
|
2020-05-03 02:17:51 +00:00
|
|
|
gameDBPromise: Promise<void> | null;
|
2020-05-02 05:35:33 +00:00
|
|
|
|
|
|
|
constructor () {
|
2021-09-13 03:08:43 +00:00
|
|
|
this.logChannel = null;
|
|
|
|
this.msglogChannel = null;
|
2020-05-02 05:35:33 +00:00
|
|
|
this.warnings = [];
|
2021-09-13 03:08:43 +00:00
|
|
|
this.responses = require('./responses.json');
|
2020-05-02 05:35:33 +00:00
|
|
|
this.bans = [];
|
|
|
|
this.stats = {
|
|
|
|
joins: 0,
|
|
|
|
ruleAccepts: 0,
|
|
|
|
leaves: 0,
|
|
|
|
warnings: 0
|
|
|
|
};
|
|
|
|
this.lastGameDBUpdate = 0;
|
|
|
|
this.gameDB = [];
|
|
|
|
this.gameDBPromise = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default new State();
|