Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64be8a5558 | ||
|
|
52c946bee5 | ||
|
|
14a8833f0d | ||
|
|
30acabde1d |
No files matched your search
@@ -0,0 +1,38 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Execute command '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Smartphone (please complete the following information):**
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
- Browser [e.g. stock browser, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
@@ -0,0 +1,33 @@
|
||||
const DayzR = require('./src/DayzRBot');
|
||||
const config = require('./config/config');
|
||||
const { GatewayIntentBits } = require('discord.js');
|
||||
|
||||
const path = require("path");
|
||||
const fs = require('fs');
|
||||
const { HandleActivePlayersList } = require('./util/LogsHandler');
|
||||
|
||||
// Log all uncaught exceptions before killing process.
|
||||
process.on('uncaughtException', async (error) => {
|
||||
console.trace(error);
|
||||
let d = new Date();
|
||||
// Asynchronously write the error message to a log file using Promises
|
||||
await new Promise((resolve, reject) => {
|
||||
if (HandleActivePlayersList.lastSendMessage) HandleActivePlayersList.lastSendMessage.delete().catch(error => client.sendError(channel, `HandleActivePlayersList Error: \n${error}`)); // Remove previous embed message before closing
|
||||
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 gracefully close the program
|
||||
process.exit()
|
||||
});
|
||||
|
||||
let client = new DayzR({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMembers] }, config);
|
||||
client.build()
|
||||
+16
-7
@@ -133,17 +133,26 @@ module.exports = {
|
||||
return interaction.send({ embeds: [creditsEmbed] })
|
||||
} else if (args[0].name == 'stats') {
|
||||
const end = new Date().getTime();
|
||||
|
||||
const totalGuilds = await client.shard.fetchClientValues("guilds.cache.size").then(results => {
|
||||
return results.reduce((acc, guildCount) => acc + guildCount, 0);
|
||||
});
|
||||
|
||||
const totalUsers = await client.shard.broadcastEval(c => {
|
||||
c.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0);
|
||||
}).then(data => data.reduce((acc, memberCount) => acc + memberCount, 0));
|
||||
|
||||
const stats = new EmbedBuilder()
|
||||
.setColor(client.config.Colors.Default)
|
||||
.setTitle('DayZ Reforger Bot Statistics')
|
||||
.addFields(
|
||||
{ name: 'Guilds', value: `${client.guilds.cache.size}`, inline: true },
|
||||
{ name: 'Users', value: `${client.users.cache.size}`, inline: true },
|
||||
{ name: 'Latency', value: `${end - start}ms`, inline: true },
|
||||
{ name: 'Uptime', value: `${client.secondsToDhms(process.uptime().toFixed(2))}`, inline: true },
|
||||
{ name: 'Bot Version', value: `${client.config.Dev} v${client.config.Version}`, inline: true },
|
||||
{ name: 'Discord Version', value: `Discord.js ${package.dependencies["discord.js"]}`, inline: true },
|
||||
{ name: 'MongoDB Version', value: `MongoDB ${package.dependencies.mongodb}`, inline: true},
|
||||
{ name: 'Guilds', value: `${totalGuilds}`, inline: false },
|
||||
{ name: 'Users', value: `${totalUsers}`, inline: false },
|
||||
{ name: 'Latency', value: `${end - start}ms`, inline: false },
|
||||
{ name: 'Uptime', value: `${client.secondsToDhms(process.uptime().toFixed(2))}`, inline: false },
|
||||
{ name: 'Bot Version', value: `${client.config.Dev} v${client.config.Version}`, inline: false },
|
||||
{ name: 'Discord Version', value: `Discord.js ${package.dependencies["discord.js"]}`, inline: false },
|
||||
{ name: 'MongoDB Version', value: `MongoDB ${package.dependencies.mongodb}`, inline: false },
|
||||
);
|
||||
|
||||
return interaction.send({ embeds: [stats] })
|
||||
|
||||
@@ -1,33 +1,8 @@
|
||||
const DayzR = require('./src/DayzRBot');
|
||||
const { ShardingManager } = require('discord.js');
|
||||
const config = require('./config/config');
|
||||
const { GatewayIntentBits } = require('discord.js');
|
||||
|
||||
const path = require("path");
|
||||
const fs = require('fs');
|
||||
const { HandleActivePlayersList } = require('./util/LogsHandler');
|
||||
const manager = new ShardingManager('./bot.js', { token: config.Token });
|
||||
|
||||
// Log all uncaught exceptions before killing process.
|
||||
process.on('uncaughtException', async (error) => {
|
||||
console.trace(error);
|
||||
let d = new Date();
|
||||
// Asynchronously write the error message to a log file using Promises
|
||||
await new Promise((resolve, reject) => {
|
||||
if (HandleActivePlayersList.lastSendMessage) HandleActivePlayersList.lastSendMessage.delete().catch(error => client.sendError(channel, `HandleActivePlayersList Error: \n${error}`)); // Remove previous embed message before closing
|
||||
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();
|
||||
}
|
||||
});
|
||||
});
|
||||
manager.on('shardCreate', shard => console.log(`Launched shard ${shard.id}`));
|
||||
|
||||
// Now gracefully close the program
|
||||
process.exit()
|
||||
});
|
||||
|
||||
let client = new DayzR({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMembers] }, config);
|
||||
client.build()
|
||||
manager.spawn();
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "dayzr-bot",
|
||||
"version": "13.2.0",
|
||||
"version": "13.3.1",
|
||||
"description": "A General Purpose Discord Bot for DayZ Nitrado Servers.",
|
||||
"main": "index.js",
|
||||
"nodemonConfig": {
|
||||
|
||||
Reference in new issue
Block a user