discord-bot/src/state.ts

37 lines
996 B
TypeScript
Raw Normal View History

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 {
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 () {
this.logChannel = null;
this.msglogChannel = null;
2020-05-02 05:35:33 +00:00
this.warnings = [];
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();