4 |
import { Config } from './Config'; |
import { Config } from './Config'; |
5 |
import Database from './Database'; |
import Database from './Database'; |
6 |
import path from 'path'; |
import path from 'path'; |
7 |
|
import { appendFile } from "fs/promises"; |
8 |
import Logger from '../automod/Logger'; |
import Logger from '../automod/Logger'; |
9 |
import SnippetManager from '../services/SnippetManager'; |
import SnippetManager from '../services/SnippetManager'; |
10 |
import AFKEngine from '../services/AFKEngine'; |
import AFKEngine from '../services/AFKEngine'; |
13 |
import AntiRaid from '../automod/AntiRaid'; |
import AntiRaid from '../automod/AntiRaid'; |
14 |
import Starboard from '../services/Starboard'; |
import Starboard from '../services/Starboard'; |
15 |
import Server from '../api/Server'; |
import Server from '../api/Server'; |
|
import Cooldown from '../automod/Cooldown'; |
|
16 |
import StartupManager from '../services/StartupManager'; |
import StartupManager from '../services/StartupManager'; |
17 |
import AutoClear from '../automod/AutoClear'; |
import AutoClear from '../automod/AutoClear'; |
18 |
import RandomStatus from '../services/RandomStatus'; |
import RandomStatus from '../services/RandomStatus'; |
25 |
import Antijoin from '../automod/Antijoin'; |
import Antijoin from '../automod/Antijoin'; |
26 |
import Automute from '../automod/Automute'; |
import Automute from '../automod/Automute'; |
27 |
import ServiceManager from './ServiceManager'; |
import ServiceManager from './ServiceManager'; |
28 |
|
import ChannelLockManager from '../services/ChannelLockManager'; |
29 |
|
|
30 |
export default class DiscordClient extends Client { |
export default class DiscordClient extends Client { |
31 |
private _commands = new Collection<string, BaseCommand>(); |
private _commands = new Collection<string, BaseCommand>(); |
48 |
messageFilter: MessageFilter = {} as MessageFilter; |
messageFilter: MessageFilter = {} as MessageFilter; |
49 |
antiraid: AntiRaid = {} as AntiRaid; |
antiraid: AntiRaid = {} as AntiRaid; |
50 |
starboard: Starboard = {} as Starboard; |
starboard: Starboard = {} as Starboard; |
|
cooldown: Cooldown = {} as Cooldown; |
|
51 |
startupManager: StartupManager = {} as StartupManager; |
startupManager: StartupManager = {} as StartupManager; |
52 |
autoClear: AutoClear = {} as AutoClear; |
autoClear: AutoClear = {} as AutoClear; |
53 |
randomStatus: RandomStatus = {} as RandomStatus; |
randomStatus: RandomStatus = {} as RandomStatus; |
56 |
welcomer: Welcomer = {} as Welcomer; |
welcomer: Welcomer = {} as Welcomer; |
57 |
antijoin: Antijoin = {} as Antijoin; |
antijoin: Antijoin = {} as Antijoin; |
58 |
automute: Automute = {} as Automute; |
automute: Automute = {} as Automute; |
59 |
|
channelLock: ChannelLockManager = {} as ChannelLockManager; |
60 |
|
|
61 |
aliases = { |
aliases = { |
62 |
automod: path.resolve(__dirname, '..', 'automod'), |
automod: path.resolve(__dirname, '..', 'automod'), |
73 |
"@automod/MessageFilter": "messageFilter", |
"@automod/MessageFilter": "messageFilter", |
74 |
"@automod/AntiRaid": "antiraid", |
"@automod/AntiRaid": "antiraid", |
75 |
"@services/Starboard": "starboard", |
"@services/Starboard": "starboard", |
|
"@automod/Cooldown": "cooldown", |
|
76 |
"@services/StartupManager": "startupManager", |
"@services/StartupManager": "startupManager", |
77 |
"@automod/AutoClear": "autoClear", |
"@automod/AutoClear": "autoClear", |
78 |
"@services/RandomStatus": "randomStatus", |
"@services/RandomStatus": "randomStatus", |
79 |
"@services/Verification": "verification", |
"@services/Verification": "verification", |
80 |
"@services/Welcomer": "welcomer", |
"@services/Welcomer": "welcomer", |
81 |
|
"@services/ChannelLockManager": "channelLock", |
82 |
"@automod/Antijoin": "antijoin", |
"@automod/Antijoin": "antijoin", |
83 |
"@automod/Automute": "automute", |
"@automod/Automute": "automute", |
84 |
}; |
}; |
154 |
} |
} |
155 |
|
|
156 |
async handleCrash(error: Error, origin: NodeJS.UncaughtExceptionOrigin) { |
async handleCrash(error: Error, origin: NodeJS.UncaughtExceptionOrigin) { |
157 |
|
console.log('here'); |
158 |
|
await appendFile(path.resolve(__dirname, "..", "..", "logs", "error.log"), `Uncaught ${error.name}: ${error.message}\n${error.stack}`); |
159 |
await this.debugLogger.logToHomeServer(`Uncaught ${error.name}: ${error.message}\n${error.stack}`); |
await this.debugLogger.logToHomeServer(`Uncaught ${error.name}: ${error.message}\n${error.stack}`); |
160 |
} |
} |
161 |
} |
} |