4 |
import path from "path"; |
import path from "path"; |
5 |
import { exit } from "process"; |
import { exit } from "process"; |
6 |
import DiscordClient from "../../client/Client"; |
import DiscordClient from "../../client/Client"; |
7 |
|
import { LogLevel } from "../../services/DebugLogger"; |
8 |
import BaseEvent from "../../utils/structures/BaseEvent"; |
import BaseEvent from "../../utils/structures/BaseEvent"; |
9 |
|
|
10 |
export default class DebugEvent extends BaseEvent { |
export default class DebugEvent extends BaseEvent { |
25 |
await appendFile(this.logFile, `[${format(new Date(), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")}] [LOG] ${e}\n`); |
await appendFile(this.logFile, `[${format(new Date(), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")}] [LOG] ${e}\n`); |
26 |
|
|
27 |
if (process.env.PLATFORM === 'replit' && e.includes("Hit a 429 while executing a request") && !client.isReady()) { |
if (process.env.PLATFORM === 'replit' && e.includes("Hit a 429 while executing a request") && !client.isReady()) { |
28 |
|
console.log("DEBUG: ", "Restart Required"); |
29 |
|
await appendFile(this.logFile, `[${format(new Date(), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")}] [LOG] ${e}\n`); |
30 |
|
await appendFile(this.logFile, `[${format(new Date(), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")}] [FATAL] Restart Required\n`); |
31 |
|
await client.debugLogger.logToHomeServer("Discord Ratelimit [419]: System restart required.\nAutomated restart is in progress.", LogLevel.WARN); |
32 |
|
|
33 |
exec("kill 1"); |
exec("kill 1"); |
34 |
return; |
return; |
35 |
} |
} |