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'; |
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 |
} |
} |