/[sudobot]/trunk/src/events/debug/DebugEvent.ts
ViewVC logotype

Diff of /trunk/src/events/debug/DebugEvent.ts

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 294 by rakin, Mon Jul 29 17:29:24 2024 UTC revision 344 by rakin, Mon Jul 29 17:29:40 2024 UTC
# Line 2  import { exec } from "child_process"; Line 2  import { exec } from "child_process";
2  import { format } from "date-fns";  import { format } from "date-fns";
3  import { appendFile } from "fs/promises";  import { appendFile } from "fs/promises";
4  import path from "path";  import path from "path";
 import { exit } from "process";  
5  import DiscordClient from "../../client/Client";  import DiscordClient from "../../client/Client";
6  import { LogLevel } from "../../services/DebugLogger";  import { LogLevel } from "../../services/DebugLogger";
7  import BaseEvent from "../../utils/structures/BaseEvent";  import BaseEvent from "../../utils/structures/BaseEvent";
# Line 24  export default class DebugEvent extends Line 23  export default class DebugEvent extends
23          console.log("DEBUG: ", e);          console.log("DEBUG: ", e);
24          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`);
25    
26          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") && !client.isReady()) {
27              console.log("DEBUG: ", "Restart Required");              console.log("DEBUG: ", "Restart Required");
28              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`);
29              await appendFile(this.logFile, `[${format(new Date(), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")}] [FATAL] Restart Required\n`);              await appendFile(this.logFile, `[${format(new Date(), "yyyy-MM-dd'T'HH:mm:ss.SSSxxx")}] [FATAL] Restart Required\n`);
30              await client.debugLogger.logToHomeServer("Discord Ratelimit [419]: System restart required.\nAutomated restart is in progress.", LogLevel.WARN);              await client.debugLogger.logToHomeServer("Discord Ratelimit [429]: System restart required.\nAutomated restart is in progress.", LogLevel.WARN);
31    
32              exec("kill 1");              exec("kill 1");
33              return;              return;

Legend:
Removed from v.294  
changed lines
  Added in v.344

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26