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'; |
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; |
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", |
110 |
DiscordClient.client = this; |
DiscordClient.client = this; |
111 |
|
|
112 |
this.config = new Config(this); |
this.config = new Config(this); |
113 |
this.db = new Database(path.resolve(rootdir, 'database.db'), this); |
this.db = new Database(this); |
114 |
this.serviceManager = new ServiceManager(this, this.aliases); |
this.serviceManager = new ServiceManager(this, this.aliases); |
115 |
this.serviceManager.load(this.services); |
this.serviceManager.load(this.services); |
116 |
|
|
155 |
|
|
156 |
async handleCrash(error: Error, origin: NodeJS.UncaughtExceptionOrigin) { |
async handleCrash(error: Error, origin: NodeJS.UncaughtExceptionOrigin) { |
157 |
console.log('here'); |
console.log('here'); |
158 |
|
await appendFile(path.join(process.env.SUDO_PREFIX ?? (__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 |
} |
} |