Merge pull request #18 from IrPgFKS0/co-work
This commit is contained in:
2 files changed
+25
-1
No files matched your search
@@ -2,5 +2,29 @@ const DayzR = require('./structures/DayzRBot');
|
|||||||
const config = require('./config/config');
|
const config = require('./config/config');
|
||||||
const { GatewayIntentBits } = require('discord.js');
|
const { GatewayIntentBits } = require('discord.js');
|
||||||
|
|
||||||
|
const path = require("path");
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
let client = new DayzR({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMembers] }, config);
|
let client = new DayzR({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMembers] }, config);
|
||||||
client.build()
|
client.build()
|
||||||
|
|
||||||
|
// Log all uncaught exceptions before killing process.
|
||||||
|
process.on('uncaughtException', async (error) => {
|
||||||
|
let d = new Date();
|
||||||
|
// Asynchronously write the error message to a log file using Promises
|
||||||
|
await new Promise((resolve, reject) => {
|
||||||
|
fs.appendFile(path.join(__dirname, "./logs/Logs.log"),
|
||||||
|
`{"level":"error","message":"${d.getHours()}:${d.getMinutes()} - ${d.getMonth()+1}:${d.getDate()}:${d.getFullYear()} | uncaughtException: ${error.stack}"}`, (logErr) => {
|
||||||
|
if (logErr) {
|
||||||
|
console.error('Error writing uncaughtException to log file:', logErr);
|
||||||
|
reject(logErr);
|
||||||
|
process.exit()
|
||||||
|
} else {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Now, you can re-throw the error
|
||||||
|
process.exit()
|
||||||
|
});
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "dayzr-bot",
|
"name": "dayzr-bot",
|
||||||
"version": "9.8.3",
|
"version": "9.8.4",
|
||||||
"description": "A General Purpose Discord Bot for DayZ Nitrado Servers.",
|
"description": "A General Purpose Discord Bot for DayZ Nitrado Servers.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"nodemonConfig": {
|
"nodemonConfig": {
|
||||||
|
|||||||
Reference in new issue
Block a user