discord-bot/src/state.ts

37 lines
939 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';
2020-05-02 05:35:33 +00:00
import discord = require('discord.js');
/* Application State */
class State {
logChannel: discord.TextChannel | discord.DMChannel;
msglogChannel: discord.TextChannel | discord.DMChannel;
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 () {
2020-05-03 02:17:51 +00:00
this.logChannel;
this.msglogChannel;
2020-05-02 05:35:33 +00:00
this.warnings = [];
2020-05-03 02:17:51 +00:00
this.responses;
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();