Compare commits
17
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
37b6f3b1e1
|
||
|
|
71cd1808d9
|
||
|
|
8abd3dadd1
|
||
|
|
67116c85be
|
||
|
|
bf95bba612
|
||
|
|
11432cb262
|
||
|
|
3b32c65340
|
||
|
|
e8303fc14a
|
||
|
|
df6b9140ec
|
||
|
|
8249feaf62
|
||
|
|
66955361b0
|
||
|
|
316f4d44b6
|
||
|
|
15d250eb76 | ||
|
|
265f0d3f38 | ||
|
|
cd2ae35a1f | ||
|
|
0abde2d041 | ||
|
|
fff476c725 |
No files matched your search
+2
-2
@@ -6,8 +6,8 @@ mongoURI='Your mongodb URI'
|
|||||||
dbo='Your mongodb database'
|
dbo='Your mongodb database'
|
||||||
|
|
||||||
# Encryption
|
# Encryption
|
||||||
key='Secret Encryption Key',
|
key='Secret Encryption Key'
|
||||||
iv='Secret Initialization Vector',
|
iv='Secret Initialization Vector'
|
||||||
|
|
||||||
# Other Bot Configuration
|
# Other Bot Configuration
|
||||||
Dev=PROD. # or DEV.
|
Dev=PROD. # or DEV.
|
||||||
|
|||||||
@@ -1,21 +1,121 @@
|
|||||||
MIT License
|
Creative Commons Legal Code
|
||||||
|
|
||||||
Copyright (c) 2023 Braeden Sowinski
|
CC0 1.0 Universal
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
||||||
in the Software without restriction, including without limitation the rights
|
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
||||||
furnished to do so, subject to the following conditions:
|
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
||||||
|
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
||||||
|
HEREUNDER.
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
Statement of Purpose
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
The laws of most jurisdictions throughout the world automatically confer
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
exclusive Copyright and Related Rights (defined below) upon the creator
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
and subsequent owner(s) (each and all, an "owner") of an original work of
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
authorship and/or a database (each, a "Work").
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
Certain owners wish to permanently relinquish those rights to a Work for
|
||||||
SOFTWARE.
|
the purpose of contributing to a commons of creative, cultural and
|
||||||
|
scientific works ("Commons") that the public can reliably and without fear
|
||||||
|
of later claims of infringement build upon, modify, incorporate in other
|
||||||
|
works, reuse and redistribute as freely as possible in any form whatsoever
|
||||||
|
and for any purposes, including without limitation commercial purposes.
|
||||||
|
These owners may contribute to the Commons to promote the ideal of a free
|
||||||
|
culture and the further production of creative, cultural and scientific
|
||||||
|
works, or to gain reputation or greater distribution for their Work in
|
||||||
|
part through the use and efforts of others.
|
||||||
|
|
||||||
|
For these and/or other purposes and motivations, and without any
|
||||||
|
expectation of additional consideration or compensation, the person
|
||||||
|
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
||||||
|
is an owner of Copyright and Related Rights in the Work, voluntarily
|
||||||
|
elects to apply CC0 to the Work and publicly distribute the Work under its
|
||||||
|
terms, with knowledge of his or her Copyright and Related Rights in the
|
||||||
|
Work and the meaning and intended legal effect of CC0 on those rights.
|
||||||
|
|
||||||
|
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||||
|
protected by copyright and related or neighboring rights ("Copyright and
|
||||||
|
Related Rights"). Copyright and Related Rights include, but are not
|
||||||
|
limited to, the following:
|
||||||
|
|
||||||
|
i. the right to reproduce, adapt, distribute, perform, display,
|
||||||
|
communicate, and translate a Work;
|
||||||
|
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||||
|
iii. publicity and privacy rights pertaining to a person's image or
|
||||||
|
likeness depicted in a Work;
|
||||||
|
iv. rights protecting against unfair competition in regards to a Work,
|
||||||
|
subject to the limitations in paragraph 4(a), below;
|
||||||
|
v. rights protecting the extraction, dissemination, use and reuse of data
|
||||||
|
in a Work;
|
||||||
|
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||||
|
European Parliament and of the Council of 11 March 1996 on the legal
|
||||||
|
protection of databases, and under any national implementation
|
||||||
|
thereof, including any amended or successor version of such
|
||||||
|
directive); and
|
||||||
|
vii. other similar, equivalent or corresponding rights throughout the
|
||||||
|
world based on applicable law or treaty, and any national
|
||||||
|
implementations thereof.
|
||||||
|
|
||||||
|
2. Waiver. To the greatest extent permitted by, but not in contravention
|
||||||
|
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
||||||
|
irrevocably and unconditionally waives, abandons, and surrenders all of
|
||||||
|
Affirmer's Copyright and Related Rights and associated claims and causes
|
||||||
|
of action, whether now known or unknown (including existing as well as
|
||||||
|
future claims and causes of action), in the Work (i) in all territories
|
||||||
|
worldwide, (ii) for the maximum duration provided by applicable law or
|
||||||
|
treaty (including future time extensions), (iii) in any current or future
|
||||||
|
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
||||||
|
including without limitation commercial, advertising or promotional
|
||||||
|
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
||||||
|
member of the public at large and to the detriment of Affirmer's heirs and
|
||||||
|
successors, fully intending that such Waiver shall not be subject to
|
||||||
|
revocation, rescission, cancellation, termination, or any other legal or
|
||||||
|
equitable action to disrupt the quiet enjoyment of the Work by the public
|
||||||
|
as contemplated by Affirmer's express Statement of Purpose.
|
||||||
|
|
||||||
|
3. Public License Fallback. Should any part of the Waiver for any reason
|
||||||
|
be judged legally invalid or ineffective under applicable law, then the
|
||||||
|
Waiver shall be preserved to the maximum extent permitted taking into
|
||||||
|
account Affirmer's express Statement of Purpose. In addition, to the
|
||||||
|
extent the Waiver is so judged Affirmer hereby grants to each affected
|
||||||
|
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
||||||
|
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
||||||
|
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
||||||
|
maximum duration provided by applicable law or treaty (including future
|
||||||
|
time extensions), (iii) in any current or future medium and for any number
|
||||||
|
of copies, and (iv) for any purpose whatsoever, including without
|
||||||
|
limitation commercial, advertising or promotional purposes (the
|
||||||
|
"License"). The License shall be deemed effective as of the date CC0 was
|
||||||
|
applied by Affirmer to the Work. Should any part of the License for any
|
||||||
|
reason be judged legally invalid or ineffective under applicable law, such
|
||||||
|
partial invalidity or ineffectiveness shall not invalidate the remainder
|
||||||
|
of the License, and in such case Affirmer hereby affirms that he or she
|
||||||
|
will not (i) exercise any of his or her remaining Copyright and Related
|
||||||
|
Rights in the Work or (ii) assert any associated claims and causes of
|
||||||
|
action with respect to the Work, in either case contrary to Affirmer's
|
||||||
|
express Statement of Purpose.
|
||||||
|
|
||||||
|
4. Limitations and Disclaimers.
|
||||||
|
|
||||||
|
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||||
|
surrendered, licensed or otherwise affected by this document.
|
||||||
|
b. Affirmer offers the Work as-is and makes no representations or
|
||||||
|
warranties of any kind concerning the Work, express, implied,
|
||||||
|
statutory or otherwise, including without limitation warranties of
|
||||||
|
title, merchantability, fitness for a particular purpose, non
|
||||||
|
infringement, or the absence of latent or other defects, accuracy, or
|
||||||
|
the present or absence of errors, whether or not discoverable, all to
|
||||||
|
the greatest extent permissible under applicable law.
|
||||||
|
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||||
|
that may apply to the Work or any use thereof, including without
|
||||||
|
limitation any person's Copyright and Related Rights in the Work.
|
||||||
|
Further, Affirmer disclaims responsibility for obtaining any necessary
|
||||||
|
consents, permissions or other rights required for any use of the
|
||||||
|
Work.
|
||||||
|
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||||
|
party to this document and has no duty or obligation with respect to
|
||||||
|
this CC0 or use of the Work.
|
||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuBuilder } = require('discord.js');
|
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuBuilder, PermissionsBitField } = require('discord.js');
|
||||||
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
|
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
|
||||||
const bitfieldCalculator = require('discord-bitfield-calculator');
|
const bitfieldCalculator = require('discord-bitfield-calculator');
|
||||||
const { Armbands } = require('../database/armbands.js');
|
const { Armbands } = require('../database/armbands.js');
|
||||||
@@ -125,10 +125,10 @@ module.exports = {
|
|||||||
*/
|
*/
|
||||||
run: async (client, interaction, args, { GuildDB }) => {
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
|
||||||
const permissions = bitfieldCalculator.permissions(interaction.member.permissions);
|
const permissions = new PermissionsBitField(interaction.member.permissions).toArray();
|
||||||
let canUseCommand = false;
|
let canUseCommand = false;
|
||||||
|
|
||||||
if (permissions.includes("MANAGE_GUILD")) canUseCommand = true;
|
if (permissions.includes("ManageGuild")) canUseCommand = true;
|
||||||
if (GuildDB.hasBotAdmin && interaction.member.roles.filter(e => GuildDB.botAdminRoles.indexOf(e) !== -1).length > 0) canUseCommand = true;
|
if (GuildDB.hasBotAdmin && interaction.member.roles.filter(e => GuildDB.botAdminRoles.indexOf(e) !== -1).length > 0) canUseCommand = true;
|
||||||
if (!canUseCommand) return interaction.send({ content: 'You don\'t have the permissions to use this command.' });
|
if (!canUseCommand) return interaction.send({ content: 'You don\'t have the permissions to use this command.' });
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuBuilder } = require('discord.js');
|
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, StringSelectMenuBuilder, PermissionsBitField } = require('discord.js');
|
||||||
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
|
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
|
||||||
const bitfieldCalculator = require('discord-bitfield-calculator');
|
const bitfieldCalculator = require('discord-bitfield-calculator');
|
||||||
|
|
||||||
@@ -230,10 +230,10 @@ module.exports = {
|
|||||||
* @param {*} param3
|
* @param {*} param3
|
||||||
*/
|
*/
|
||||||
run: async (client, interaction, args, { GuildDB }) => {
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
const permissions = bitfieldCalculator.permissions(interaction.member.permissions);
|
const permissions = new PermissionsBitField(interaction.member.permissions).toArray();
|
||||||
let canUseCommand = false;
|
let canUseCommand = false;
|
||||||
|
|
||||||
if (permissions.includes("MANAGE_GUILD")) canUseCommand = true;
|
if (permissions.includes("ManageGuild")) canUseCommand = true;
|
||||||
if (GuildDB.hasBotAdmin && interaction.member.roles.filter(e => GuildDB.botAdminRoles.indexOf(e) !== -1).length > 0) canUseCommand = true;
|
if (GuildDB.hasBotAdmin && interaction.member.roles.filter(e => GuildDB.botAdminRoles.indexOf(e) !== -1).length > 0) canUseCommand = true;
|
||||||
if (!canUseCommand) return interaction.send({ content: 'You don\'t have the permissions to use this command.' });
|
if (!canUseCommand) return interaction.send({ content: 'You don\'t have the permissions to use this command.' });
|
||||||
|
|
||||||
|
|||||||
+5
-4
@@ -1,6 +1,6 @@
|
|||||||
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
|
const { PermissionsBitField, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
|
||||||
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
|
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
|
||||||
const bitfieldCalculator = require('discord-bitfield-calculator');
|
// const bitfieldCalculator = require('discord-bitfield-calculator');
|
||||||
const { getDefaultSettings } = require('../database/guild');
|
const { getDefaultSettings } = require('../database/guild');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@@ -429,10 +429,11 @@ module.exports = {
|
|||||||
* @param {*} param3
|
* @param {*} param3
|
||||||
*/
|
*/
|
||||||
run: async (client, interaction, args, { GuildDB }) => {
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
const permissions = bitfieldCalculator.permissions(interaction.member.permissions);
|
// const permissions = new PermissionsBitField(interaction.member.permissions).toArray();
|
||||||
|
const permissions = new PermissionsBitField(interaction.member.permissions).toArray();
|
||||||
let canUseCommand = false;
|
let canUseCommand = false;
|
||||||
|
|
||||||
if (permissions.includes("MANAGE_GUILD")) canUseCommand = true;
|
if (permissions.includes("ManageGuild")) canUseCommand = true;
|
||||||
if (GuildDB.hasBotAdmin && interaction.member.roles.filter(e => GuildDB.botAdminRoles.indexOf(e) !== -1).length > 0) canUseCommand = true;
|
if (GuildDB.hasBotAdmin && interaction.member.roles.filter(e => GuildDB.botAdminRoles.indexOf(e) !== -1).length > 0) canUseCommand = true;
|
||||||
if (!canUseCommand) return interaction.send({ content: 'You don\'t have the permissions to use this command.' });
|
if (!canUseCommand) return interaction.send({ content: 'You don\'t have the permissions to use this command.' });
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
const { EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder } = require('discord.js');
|
const { EmbedBuilder, ActionRowBuilder, StringSelectMenuBuilder, PermissionsBitField } = require('discord.js');
|
||||||
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
|
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
|
||||||
const bitfieldCalculator = require('discord-bitfield-calculator');
|
const bitfieldCalculator = require('discord-bitfield-calculator');
|
||||||
|
|
||||||
@@ -80,10 +80,10 @@ module.exports = {
|
|||||||
return interaction.send({ embeds: [warnNitradoNotInitialized], flags: (1 << 6) });
|
return interaction.send({ embeds: [warnNitradoNotInitialized], flags: (1 << 6) });
|
||||||
}
|
}
|
||||||
|
|
||||||
const permissions = bitfieldCalculator.permissions(interaction.member.permissions);
|
const permissions = new PermissionsBitField(interaction.member.permissions).toArray();
|
||||||
let canUseCommand = false;
|
let canUseCommand = false;
|
||||||
|
|
||||||
if (permissions.includes("MANAGE_GUILD")) canUseCommand = true;
|
if (permissions.includes("ManageGuild")) canUseCommand = true;
|
||||||
if (GuildDB.hasBotAdmin && interaction.member.roles.filter(e => GuildDB.botAdminRoles.indexOf(e) !== -1).length > 0) canUseCommand = true;
|
if (GuildDB.hasBotAdmin && interaction.member.roles.filter(e => GuildDB.botAdminRoles.indexOf(e) !== -1).length > 0) canUseCommand = true;
|
||||||
if (!canUseCommand) return interaction.send({ content: 'You don\'t have the permissions to use this command.' });
|
if (!canUseCommand) return interaction.send({ content: 'You don\'t have the permissions to use this command.' });
|
||||||
|
|
||||||
|
|||||||
@@ -31,15 +31,16 @@ module.exports = {
|
|||||||
return interaction.send({ embeds: [warnNitradoNotInitialized], flags: (1 << 6) });
|
return interaction.send({ embeds: [warnNitradoNotInitialized], flags: (1 << 6) });
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await FetchServerSettings(GuildDB.Nitrado, client, 'commands/player-list.js'); // Fetch server status
|
await interaction.deferReply();
|
||||||
|
|
||||||
|
const data = await FetchServerSettings(GuildDB.Nitrado, client, 'commands/player-list.js'); // Fetch server status
|
||||||
const e = data && data !== 1; // Check if data exists
|
const e = data && data !== 1; // Check if data exists
|
||||||
|
|
||||||
const hostname = e ? data.data.gameserver.settings.config.hostname : 'N/A';
|
const hostname = e ? data.data.gameserver.settings.config.hostname : 'N/A';
|
||||||
const map = Missions[data.data.gameserver.settings.config.mission];
|
const map = e ? Missions[data.data.gameserver.settings.config.mission] : 'N/A';
|
||||||
const status = e ? data.data.gameserver.status : 'N/A';
|
const status = e ? data.data.gameserver.status : 'N/A';
|
||||||
const slots = e ? data.data.gameserver.slots : 'N/A';
|
const slots = e ? data.data.gameserver.slots : 'N/A';
|
||||||
const playersOnline = data.data.gameserver.query.player_current;
|
const playersOnline = e ? data.data.gameserver.query.player_current : 'N/A';
|
||||||
|
|
||||||
const Statuses = {
|
const Statuses = {
|
||||||
"started": {emoji: "🟢", text: "Active"},
|
"started": {emoji: "🟢", text: "Active"},
|
||||||
@@ -47,8 +48,8 @@ module.exports = {
|
|||||||
"restarting": {emoji: "↻", text: "Restarting"},
|
"restarting": {emoji: "↻", text: "Restarting"},
|
||||||
};
|
};
|
||||||
|
|
||||||
const emojiStatus = Statuses[status].emoji || "❓";
|
const emojiStatus = e ? Statuses[status].emoji : "❓";
|
||||||
const textStatus = Statuses[status].text || "Unknown Status";
|
const textStatus = e ? Statuses[status].text : "Unknown Status";
|
||||||
|
|
||||||
let activePlayers = await client.dbo.collection("players").find({"connected": true}).toArray();
|
let activePlayers = await client.dbo.collection("players").find({"connected": true}).toArray();
|
||||||
|
|
||||||
@@ -74,7 +75,7 @@ module.exports = {
|
|||||||
.setTitle(`Players Online:`)
|
.setTitle(`Players Online:`)
|
||||||
.setDescription(des || (nodes ? "No Players Online :(" : ""));
|
.setDescription(des || (nodes ? "No Players Online :(" : ""));
|
||||||
|
|
||||||
return interaction.send({ embeds: [serverEmbed, activePlayersEmbed] });
|
return interaction.editReply({ embeds: [serverEmbed, activePlayersEmbed] });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
|
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, PermissionsBitField } = require('discord.js');
|
||||||
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
|
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
|
||||||
const { addUser } = require('../database/user');
|
const { addUser } = require('../database/user');
|
||||||
const bitfieldCalculator = require('discord-bitfield-calculator');
|
const bitfieldCalculator = require('discord-bitfield-calculator');
|
||||||
@@ -29,10 +29,10 @@ module.exports = {
|
|||||||
* @param {*} param3
|
* @param {*} param3
|
||||||
*/
|
*/
|
||||||
run: async (client, interaction, args, { GuildDB }) => {
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
const permissions = bitfieldCalculator.permissions(interaction.member.permissions);
|
const permissions = new PermissionsBitField(interaction.member.permissions).toArray();
|
||||||
let canUseCommand = false;
|
let canUseCommand = false;
|
||||||
|
|
||||||
if (permissions.includes("MANAGE_GUILD")) canUseCommand = true;
|
if (permissions.includes("ManageGuild")) canUseCommand = true;
|
||||||
if (client.exists(GuildDB.botAdmin) && interaction.member.roles.includes(GuildDB.botAdmin)) canUseCommand = true;
|
if (client.exists(GuildDB.botAdmin) && interaction.member.roles.includes(GuildDB.botAdmin)) canUseCommand = true;
|
||||||
if (!canUseCommand) return interaction.send({ content: 'You don\'t have the permissions to use this command.' });
|
if (!canUseCommand) return interaction.send({ content: 'You don\'t have the permissions to use this command.' });
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,4 +1,4 @@
|
|||||||
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, ModalBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');
|
const { PermissionsBitField, EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle, ModalBuilder, TextInputBuilder, TextInputStyle } = require('discord.js');
|
||||||
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
|
const CommandOptions = require('../util/CommandOptionTypes').CommandOptionTypes;
|
||||||
const bitfieldCalculator = require('discord-bitfield-calculator');
|
const bitfieldCalculator = require('discord-bitfield-calculator');
|
||||||
const { BanPlayer, UnbanPlayer, RestartServer, CheckServerStatus, DisableBaseDamage, DisableContainerDamage, NitradoCredentialStatus } = require('../util/NitradoAPI');
|
const { BanPlayer, UnbanPlayer, RestartServer, CheckServerStatus, DisableBaseDamage, DisableContainerDamage, NitradoCredentialStatus } = require('../util/NitradoAPI');
|
||||||
@@ -108,10 +108,10 @@ module.exports = {
|
|||||||
*/
|
*/
|
||||||
run: async (client, interaction, args, { GuildDB }) => {
|
run: async (client, interaction, args, { GuildDB }) => {
|
||||||
|
|
||||||
const permissions = bitfieldCalculator.permissions(interaction.member.permissions);
|
const permissions = new PermissionsBitField(interaction.member.permissions).toArray();
|
||||||
let canUseCommand = false;
|
let canUseCommand = false;
|
||||||
|
|
||||||
if (permissions.includes("MANAGE_GUILD")) canUseCommand = true;
|
if (permissions.includes("ManageGuild")) canUseCommand = true;
|
||||||
if (GuildDB.hasBotAdmin && interaction.member.roles.filter(e => GuildDB.botAdminRoles.indexOf(e) !== -1).length > 0) canUseCommand = true;
|
if (GuildDB.hasBotAdmin && interaction.member.roles.filter(e => GuildDB.botAdminRoles.indexOf(e) !== -1).length > 0) canUseCommand = true;
|
||||||
if (!canUseCommand) return interaction.send({ content: 'You don\'t have the permissions to use this command.' });
|
if (!canUseCommand) return interaction.send({ content: 'You don\'t have the permissions to use this command.' });
|
||||||
|
|
||||||
|
|||||||
Generated
+68
-31
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "dayzr-bot",
|
"name": "dayzr-bot",
|
||||||
"version": "12.7.1",
|
"version": "13.3.25",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "dayzr-bot",
|
"name": "dayzr-bot",
|
||||||
"version": "12.7.1",
|
"version": "13.3.25",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordjs/rest": "^1.1.0",
|
"@discordjs/rest": "^1.1.0",
|
||||||
@@ -1604,10 +1604,18 @@
|
|||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||||
},
|
},
|
||||||
"node_modules/ip": {
|
"node_modules/ip-address": {
|
||||||
"version": "2.0.1",
|
"version": "9.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz",
|
||||||
"integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ=="
|
"integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"jsbn": "1.1.0",
|
||||||
|
"sprintf-js": "^1.1.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"node_modules/is-arrayish": {
|
"node_modules/is-arrayish": {
|
||||||
"version": "0.3.2",
|
"version": "0.3.2",
|
||||||
@@ -1625,6 +1633,12 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/jsbn": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/kuler": {
|
"node_modules/kuler": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz",
|
||||||
@@ -1809,15 +1823,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/socks": {
|
"node_modules/socks": {
|
||||||
"version": "2.7.1",
|
"version": "2.8.3",
|
||||||
"resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz",
|
"resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz",
|
||||||
"integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==",
|
"integrity": "sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==",
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"ip": "^2.0.0",
|
"ip-address": "^9.0.5",
|
||||||
"smart-buffer": "^4.2.0"
|
"smart-buffer": "^4.2.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 10.13.0",
|
"node": ">= 10.0.0",
|
||||||
"npm": ">= 3.0.0"
|
"npm": ">= 3.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1830,6 +1845,12 @@
|
|||||||
"memory-pager": "^1.0.2"
|
"memory-pager": "^1.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/sprintf-js": {
|
||||||
|
"version": "1.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",
|
||||||
|
"integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==",
|
||||||
|
"license": "BSD-3-Clause"
|
||||||
|
},
|
||||||
"node_modules/stack-trace": {
|
"node_modules/stack-trace": {
|
||||||
"version": "0.0.10",
|
"version": "0.0.10",
|
||||||
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
|
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
|
||||||
@@ -1921,9 +1942,10 @@
|
|||||||
"integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA=="
|
"integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA=="
|
||||||
},
|
},
|
||||||
"node_modules/undici": {
|
"node_modules/undici": {
|
||||||
"version": "5.28.3",
|
"version": "5.28.5",
|
||||||
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz",
|
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.5.tgz",
|
||||||
"integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==",
|
"integrity": "sha512-zICwjrDrcrUE0pyyJc1I2QzBkLM8FINsgOrt6WjA+BgajVq9Nxu2PbFFXUrAggLfDXlZGZBVZYw7WNV5KiBiBA==",
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fastify/busboy": "^2.0.0"
|
"@fastify/busboy": "^2.0.0"
|
||||||
},
|
},
|
||||||
@@ -1999,9 +2021,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/ws": {
|
"node_modules/ws": {
|
||||||
"version": "8.13.0",
|
"version": "8.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz",
|
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz",
|
||||||
"integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==",
|
"integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==",
|
||||||
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.0.0"
|
"node": ">=10.0.0"
|
||||||
},
|
},
|
||||||
@@ -3323,10 +3346,14 @@
|
|||||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||||
},
|
},
|
||||||
"ip": {
|
"ip-address": {
|
||||||
"version": "2.0.1",
|
"version": "9.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz",
|
||||||
"integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ=="
|
"integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==",
|
||||||
|
"requires": {
|
||||||
|
"jsbn": "1.1.0",
|
||||||
|
"sprintf-js": "^1.1.3"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"is-arrayish": {
|
"is-arrayish": {
|
||||||
"version": "0.3.2",
|
"version": "0.3.2",
|
||||||
@@ -3338,6 +3365,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz",
|
||||||
"integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg=="
|
"integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg=="
|
||||||
},
|
},
|
||||||
|
"jsbn": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A=="
|
||||||
|
},
|
||||||
"kuler": {
|
"kuler": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/kuler/-/kuler-2.0.0.tgz",
|
||||||
@@ -3470,11 +3502,11 @@
|
|||||||
"integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg=="
|
"integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg=="
|
||||||
},
|
},
|
||||||
"socks": {
|
"socks": {
|
||||||
"version": "2.7.1",
|
"version": "2.8.3",
|
||||||
"resolved": "https://registry.npmjs.org/socks/-/socks-2.7.1.tgz",
|
"resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz",
|
||||||
"integrity": "sha512-7maUZy1N7uo6+WVEX6psASxtNlKaNVMlGQKkG/63nEDdLOWNbiUMoLK7X4uYoLhQstau72mLgfEWcXcwsaHbYQ==",
|
"integrity": "sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"ip": "^2.0.0",
|
"ip-address": "^9.0.5",
|
||||||
"smart-buffer": "^4.2.0"
|
"smart-buffer": "^4.2.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -3487,6 +3519,11 @@
|
|||||||
"memory-pager": "^1.0.2"
|
"memory-pager": "^1.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"sprintf-js": {
|
||||||
|
"version": "1.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz",
|
||||||
|
"integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA=="
|
||||||
|
},
|
||||||
"stack-trace": {
|
"stack-trace": {
|
||||||
"version": "0.0.10",
|
"version": "0.0.10",
|
||||||
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
|
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
|
||||||
@@ -3558,9 +3595,9 @@
|
|||||||
"integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA=="
|
"integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA=="
|
||||||
},
|
},
|
||||||
"undici": {
|
"undici": {
|
||||||
"version": "5.28.3",
|
"version": "5.28.5",
|
||||||
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz",
|
"resolved": "https://registry.npmjs.org/undici/-/undici-5.28.5.tgz",
|
||||||
"integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==",
|
"integrity": "sha512-zICwjrDrcrUE0pyyJc1I2QzBkLM8FINsgOrt6WjA+BgajVq9Nxu2PbFFXUrAggLfDXlZGZBVZYw7WNV5KiBiBA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@fastify/busboy": "^2.0.0"
|
"@fastify/busboy": "^2.0.0"
|
||||||
}
|
}
|
||||||
@@ -3618,9 +3655,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ws": {
|
"ws": {
|
||||||
"version": "8.13.0",
|
"version": "8.18.0",
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz",
|
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz",
|
||||||
"integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==",
|
"integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==",
|
||||||
"requires": {}
|
"requires": {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "dayzr-bot",
|
"name": "dayzr-bot",
|
||||||
"version": "13.3.21",
|
"version": "13.4.3",
|
||||||
"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": {
|
||||||
|
|||||||
+14
-10
@@ -6,7 +6,7 @@ const Logger = require("../util/Logger");
|
|||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
|
|
||||||
// custom util imports
|
// custom util imports
|
||||||
const { DownloadNitradoFile, CheckServerStatus, FetchServerSettings, PostServerSettings, NitradoCredentialStatus } = require('../util/NitradoAPI');
|
const { DownloadNitradoFile, CheckServerStatus, FetchServerSettings, PostServerSettings, NitradoCredentialStatus, GetRemoteDir } = require('../util/NitradoAPI');
|
||||||
const { HandlePlayerLogs, HandleActivePlayersList } = require('../util/LogsHandler');
|
const { HandlePlayerLogs, HandleActivePlayersList } = require('../util/LogsHandler');
|
||||||
const { HandleKillfeed, UpdateLastDeathDate } = require('../util/KillfeedHandler');
|
const { HandleKillfeed, UpdateLastDeathDate } = require('../util/KillfeedHandler');
|
||||||
const { HandleExpiredUAVs, HandleEvents, PlaceFireplaceInAlarm } = require('../util/AlarmsHandler');
|
const { HandleExpiredUAVs, HandleEvents, PlaceFireplaceInAlarm } = require('../util/AlarmsHandler');
|
||||||
@@ -226,7 +226,7 @@ class DayzRBot extends Client {
|
|||||||
|
|
||||||
data.forEach(async (embeds, role) => {
|
data.forEach(async (embeds, role) => {
|
||||||
let embedArrays = [];
|
let embedArrays = [];
|
||||||
while (embeds.length > 0);
|
while (embeds.length > 0)
|
||||||
embedArrays.push(embeds.splice(0, maxEmbed));
|
embedArrays.push(embeds.splice(0, maxEmbed));
|
||||||
|
|
||||||
for (let i = 0; i < embedArrays.length; i++) {
|
for (let i = 0; i < embedArrays.length; i++) {
|
||||||
@@ -349,15 +349,17 @@ class DayzRBot extends Client {
|
|||||||
|
|
||||||
GuildDB.Nitrado.Mission = Missions[settings.settings.config.mission];
|
GuildDB.Nitrado.Mission = Missions[settings.settings.config.mission];
|
||||||
|
|
||||||
if (settings.game_specific.log_files.length == 0) return; // Ignore if no log files on Nitrado server
|
let filenames = await GetRemoteDir(NitradoCred, c, `${settings.game_specific.path}config`);
|
||||||
const filename = settings.game_specific.log_files.sort((a, b) => a.length - b.length)[0];
|
filenames = filenames.sort((a, b) => a.modified_at - b.modified_at)
|
||||||
const path = `${settings.game_specific.path.slice(0, -1)}${filename.split(settings.game)[1]}`;
|
filenames = filenames.filter(path => path.path.includes(".ADM"))
|
||||||
|
filenames = filenames.map(path => path.path)
|
||||||
|
const filename = filenames[filenames.length - 1];
|
||||||
|
|
||||||
// Ensure Player List is logged for next update
|
// Ensure Player List is logged for next update
|
||||||
const playerListEnabled = parseInt(settings.settings.config.adminLogPlayerList)
|
const playerListEnabled = parseInt(settings.settings.config.adminLogPlayerList)
|
||||||
if (!playerListEnabled) PostServerSettings(NitradoCred, c, "config", "adminLogPlayerList", '1')
|
if (!playerListEnabled) PostServerSettings(NitradoCred, c, "config", "adminLogPlayerList", '1')
|
||||||
|
|
||||||
await DownloadNitradoFile(NitradoCred, c, path, `./logs/${NitradoCred.ServerID}-logs.ADM`).then(async (status) => {
|
await DownloadNitradoFile(NitradoCred, c, filename, `./logs/${NitradoCred.ServerID}-logs.ADM`).then(async (status) => {
|
||||||
if (status == 1) return c.error(`Failed to Download Nitrado Log Files - [${NitradoCred.ServerID}]`);
|
if (status == 1) return c.error(`Failed to Download Nitrado Log Files - [${NitradoCred.ServerID}]`);
|
||||||
await c.readLogs(GuildDB).then(async () => {
|
await c.readLogs(GuildDB).then(async () => {
|
||||||
HandleExpiredUAVs(c, GuildDB);
|
HandleExpiredUAVs(c, GuildDB);
|
||||||
@@ -439,9 +441,9 @@ class DayzRBot extends Client {
|
|||||||
}
|
}
|
||||||
this.logHistory.set(guilds[i].Nitrado.ServerID, guilds[i].server.lastLog); // Using Nitrado Server ID over guild ID in case of future support for multiple nitrado servers in a single guild
|
this.logHistory.set(guilds[i].Nitrado.ServerID, guilds[i].server.lastLog); // Using Nitrado Server ID over guild ID in case of future support for multiple nitrado servers in a single guild
|
||||||
this.playerSessions.set(guilds[i].Nitrado.ServerID, new Map()); // Same reason here as named above.
|
this.playerSessions.set(guilds[i].Nitrado.ServerID, new Map()); // Same reason here as named above.
|
||||||
this.alarmPingQueue.set(guilds[i].serverID, new Map()); // Initialize alarm queue to be empty
|
this.alarmPingQueue.set(guilds[i].server.serverID, new Map()); // Initialize alarm queue to be empty
|
||||||
this.playerListMsgIds.set(guilds[i].serverID, ""); // Initialize player list message ids
|
this.playerListMsgIds.set(guilds[i].server.serverID, ""); // Initialize player list message ids
|
||||||
this.log(`[${guilds[i].server.serverID}] Initialized existing Nitrado`);
|
this.log(`[${guilds[i].server.serverID}] Initialized existing Nitrado Server: (${guilds[i].Nitrado.ServerID})`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,7 +453,9 @@ class DayzRBot extends Client {
|
|||||||
if (guild.autoRestart) this.arIntervalIds.set(guildId, setInterval(CheckServerStatus, this.arInterval, Nitrado, this))
|
if (guild.autoRestart) this.arIntervalIds.set(guildId, setInterval(CheckServerStatus, this.arInterval, Nitrado, this))
|
||||||
this.logHistory.set(Nitrado.ServerID, guild.lastLog);
|
this.logHistory.set(Nitrado.ServerID, guild.lastLog);
|
||||||
this.playerSessions.set(Nitrado.ServerID, new Map());
|
this.playerSessions.set(Nitrado.ServerID, new Map());
|
||||||
this.log(`[${guild.serverID}] Initialized new Nitrado`);
|
this.alarmPingQueue.set(guildId, new Map());
|
||||||
|
this.playerListMsgIds.set(guildId, "");
|
||||||
|
this.log(`[${guildId}] Initialized new Nitrado`);
|
||||||
}
|
}
|
||||||
|
|
||||||
exists(n) { return typeof(n) == 'number' ? !isNaN(n) : null != n && undefined != n && "" != n }
|
exists(n) { return typeof(n) == 'number' ? !isNaN(n) : null != n && undefined != n && "" != n }
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ module.exports = {
|
|||||||
// channel.send({ content: `<@&${alarm.role}>`, embeds: [alarmEmbed] });
|
// channel.send({ content: `<@&${alarm.role}>`, embeds: [alarmEmbed] });
|
||||||
|
|
||||||
BanPlayer(client, data.killer);
|
BanPlayer(client, data.killer);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ module.exports = {
|
|||||||
await UpdatePlayer(client, victimStat);
|
await UpdatePlayer(client, victimStat);
|
||||||
|
|
||||||
if (!channel) return;
|
if (!channel) return;
|
||||||
const webhook = await GetWebhook(this, NAME, guild.killfeedChannel);
|
const webhook = await GetWebhook(client, NAME, guild.killfeedChannel);
|
||||||
WebhookSend(client, webhook, { embeds: [killEvent]});
|
WebhookSend(client, webhook, { embeds: [killEvent]});
|
||||||
|
|
||||||
// if (client.exists(channel)) await channel.send({ embeds: [killEvent] });
|
// if (client.exists(channel)) await channel.send({ embeds: [killEvent] });
|
||||||
@@ -264,7 +264,12 @@ module.exports = {
|
|||||||
const killData = `\n> **__Kill Data__**\n> Weapon: \` ${info.weapon} \`\n> Distance: \` ${info.distance}m \`\n> Body Part: \` ${info.bodyPart != undefined ? info.bodyPart.split('(')[0] : 'N/A'} \`\n> Damage: \` ${info.damage != undefined ? info.damage : 'N/A'} \``;
|
const killData = `\n> **__Kill Data__**\n> Weapon: \` ${info.weapon} \`\n> Distance: \` ${info.distance}m \`\n> Body Part: \` ${info.bodyPart != undefined ? info.bodyPart.split('(')[0] : 'N/A'} \`\n> Damage: \` ${info.damage != undefined ? info.damage : 'N/A'} \``;
|
||||||
const killerStatsView = `\n**Killer Rating** (${kdiff >= 0 ? '+' : ''}${kdiff}) ${killerStat.combatRating}\n${killerStat.KDR.toFixed(2)} K/D - ${killerStat.kills} Kill${(killerStat.kills == 0 || killerStat.kills > 1) ? 's':''} - Killstreak: ${killerStat.killStreak}`;
|
const killerStatsView = `\n**Killer Rating** (${kdiff >= 0 ? '+' : ''}${kdiff}) ${killerStat.combatRating}\n${killerStat.KDR.toFixed(2)} K/D - ${killerStat.kills} Kill${(killerStat.kills == 0 || killerStat.kills > 1) ? 's':''} - Killstreak: ${killerStat.killStreak}`;
|
||||||
const victimStatsView = `\n**Victim Rating** (${vdiff >= 0 ? '+' : ''}${vdiff}) ${victimStat.combatRating}\n${victimStat.KDR.toFixed(2)} K/D - ${victimStat.deaths} Death${victimStat.deaths == 0 || victimStat.deaths>1?'s':''} - Deathstreak: ${victimStat.deathStreak}`;
|
const victimStatsView = `\n**Victim Rating** (${vdiff >= 0 ? '+' : ''}${vdiff}) ${victimStat.combatRating}\n${victimStat.KDR.toFixed(2)} K/D - ${victimStat.deaths} Death${victimStat.deaths == 0 || victimStat.deaths>1?'s':''} - Deathstreak: ${victimStat.deathStreak}`;
|
||||||
const coord = showCoords ? `\n***Location [${info.victimPOS[0]}, ${info.victimPOS[1]}](https://www.izurvive.com/chernarusplussatmap/#location=${info.victimPOS[0]};${info.victimPOS[1]})***\n${destination}` : '';
|
|
||||||
|
const map = guild.Nitrado.Mission == "Chernarus" ? "chernarusplus" :
|
||||||
|
guild.Nitrado.Mission == "Livonia" ? "livonia" :
|
||||||
|
"sakhal";
|
||||||
|
|
||||||
|
const coord = showCoords ? `\n***Location [${info.victimPOS[0]}, ${info.victimPOS[1]}](https://www.izurvive.com/${map}/#location=${info.victimPOS[0]};${info.victimPOS[1]})***\n${destination}` : '';
|
||||||
|
|
||||||
let killEvent = new EmbedBuilder()
|
let killEvent = new EmbedBuilder()
|
||||||
.setColor(client.config.Colors.Default)
|
.setColor(client.config.Colors.Default)
|
||||||
@@ -277,7 +282,7 @@ module.exports = {
|
|||||||
|
|
||||||
if (!channel) return;
|
if (!channel) return;
|
||||||
|
|
||||||
const webhook = await GetWebhook(this, NAME, guild.killfeedChannel);
|
const webhook = await GetWebhook(client, NAME, guild.killfeedChannel);
|
||||||
|
|
||||||
WebhookSend(client, webhook, { embeds: [killEvent] });
|
WebhookSend(client, webhook, { embeds: [killEvent] });
|
||||||
if (client.exists(receivedBounty) && client.exists(channel)) WebhookSend(client, webhook, { content: `<@${killerStat.discordID}>`, embeds: [receivedBounty] });
|
if (client.exists(receivedBounty) && client.exists(channel)) WebhookSend(client, webhook, { content: `<@${killerStat.discordID}>`, embeds: [receivedBounty] });
|
||||||
|
|||||||
+9
-2
@@ -33,6 +33,7 @@ module.exports = {
|
|||||||
if (!client.exists(playerStat)) playerStat = getDefaultPlayer(info.player, info.playerID, NitradoServerID);
|
if (!client.exists(playerStat)) playerStat = getDefaultPlayer(info.player, info.playerID, NitradoServerID);
|
||||||
const newDt = await client.getDateEST(info.time);
|
const newDt = await client.getDateEST(info.time);
|
||||||
|
|
||||||
|
playerStat.gamertag = info.player; // update username if changed
|
||||||
playerStat.lastConnectionDate = newDt;
|
playerStat.lastConnectionDate = newDt;
|
||||||
playerStat.connected = true;
|
playerStat.connected = true;
|
||||||
if (!client.exists(playerStat.connections)) playerStat.connections = 0;
|
if (!client.exists(playerStat.connections)) playerStat.connections = 0;
|
||||||
@@ -87,6 +88,7 @@ module.exports = {
|
|||||||
} else sessionTimeSeconds = 0;
|
} else sessionTimeSeconds = 0;
|
||||||
if (!client.exists(playerStat.longestSessionTime)) playerStat.longestSessionTime = 0;
|
if (!client.exists(playerStat.longestSessionTime)) playerStat.longestSessionTime = 0;
|
||||||
|
|
||||||
|
playerStat.gamertag = info.player; // update username if changed
|
||||||
playerStat.totalSessionTime = playerStat.totalSessionTime + sessionTimeSeconds;
|
playerStat.totalSessionTime = playerStat.totalSessionTime + sessionTimeSeconds;
|
||||||
playerStat.lastSessionTime = sessionTimeSeconds;
|
playerStat.lastSessionTime = sessionTimeSeconds;
|
||||||
playerStat.longestSessionTime = sessionTimeSeconds > playerStat.longestSessionTime ? sessionTimeSeconds : playerStat.longestSessionTime;
|
playerStat.longestSessionTime = sessionTimeSeconds > playerStat.longestSessionTime ? sessionTimeSeconds : playerStat.longestSessionTime;
|
||||||
@@ -132,6 +134,7 @@ module.exports = {
|
|||||||
if (!client.exists(playerStat)) playerStat = getDefaultPlayer(info.player, info.playerID, NitradoServerID);
|
if (!client.exists(playerStat)) playerStat = getDefaultPlayer(info.player, info.playerID, NitradoServerID);
|
||||||
if (!client.exists(playerStat.lastConnectionDate)) playerStat.lastConnectionDate = await client.getDateEST(info.time);
|
if (!client.exists(playerStat.lastConnectionDate)) playerStat.lastConnectionDate = await client.getDateEST(info.time);
|
||||||
|
|
||||||
|
playerStat.gamertag = info.player; // update username if changed
|
||||||
playerStat.lastPos = playerStat.pos;
|
playerStat.lastPos = playerStat.pos;
|
||||||
playerStat.pos = info.pos;
|
playerStat.pos = info.pos;
|
||||||
playerStat.lastTime = playerStat.time;
|
playerStat.lastTime = playerStat.time;
|
||||||
@@ -172,9 +175,12 @@ module.exports = {
|
|||||||
if (!client.exists(playerStat)) playerStat = getDefaultPlayer(info.player, info.playerID, NitradoServerID);
|
if (!client.exists(playerStat)) playerStat = getDefaultPlayer(info.player, info.playerID, NitradoServerID);
|
||||||
if (!client.exists(attackerStat)) attackerStat = getDefaultPlayer(info.attacker, info.attackerID, NitradoServerID);
|
if (!client.exists(attackerStat)) attackerStat = getDefaultPlayer(info.attacker, info.attackerID, NitradoServerID);
|
||||||
|
|
||||||
|
playerStat.gamertag = info.player; // update username if changed
|
||||||
playerStat.lastDamageDate = await client.getDateEST(info.time);
|
playerStat.lastDamageDate = await client.getDateEST(info.time);
|
||||||
playerStat.lastHitBy = info.attacker;
|
playerStat.lastHitBy = info.attacker;
|
||||||
|
|
||||||
|
attackerStat.gamertag = info.attacker; // update username if changed
|
||||||
|
|
||||||
if (!client.exists(playerStat.shotsLanded)) playerStat = insertPVPstats(playerStat);
|
if (!client.exists(playerStat.shotsLanded)) playerStat = insertPVPstats(playerStat);
|
||||||
if (!client.exists(attackerStat.shotsLanded)) attackerStat = insertPVPstats(attackerStat);
|
if (!client.exists(attackerStat.shotsLanded)) attackerStat = insertPVPstats(attackerStat);
|
||||||
|
|
||||||
@@ -227,7 +233,8 @@ module.exports = {
|
|||||||
const emojiStatus = Statuses[status].emoji || "❓";
|
const emojiStatus = Statuses[status].emoji || "❓";
|
||||||
const textStatus = Statuses[status].text || "Unknown Status";
|
const textStatus = Statuses[status].text || "Unknown Status";
|
||||||
|
|
||||||
let activePlayers = await client.dbo.collection("players").find({"nitradoServerID": nitrado_cred.ServerID}).toArray().filter(player => player.connected);
|
let activePlayers = await client.dbo.collection("players").find({ "nitradoServerID": parseInt(nitrado_cred.ServerID) }).toArray();
|
||||||
|
activePlayers = activePlayers.filter(player => player.connected);
|
||||||
|
|
||||||
let des = activePlayers.length > 0 ? `` : `**No Players Online**`;
|
let des = activePlayers.length > 0 ? `` : `**No Players Online**`;
|
||||||
for (let i = 0; i < activePlayers.length; i++) {
|
for (let i = 0; i < activePlayers.length; i++) {
|
||||||
@@ -252,7 +259,7 @@ module.exports = {
|
|||||||
.setDescription(des || (nodes ? "No Players Online :(" : ""));
|
.setDescription(des || (nodes ? "No Players Online :(" : ""));
|
||||||
|
|
||||||
const NAME = "DayZ.R Admin Logs";
|
const NAME = "DayZ.R Admin Logs";
|
||||||
const webhook = await GetWebhook(client, NAME, guild.connectionLogsChannel);
|
const webhook = await GetWebhook(client, NAME, guild.activePlayersChannel);
|
||||||
|
|
||||||
let id = client.playerListMsgIds.get(guild.serverID);
|
let id = client.playerListMsgIds.get(guild.serverID);
|
||||||
if (id == "") {
|
if (id == "") {
|
||||||
|
|||||||
+28
-26
@@ -63,36 +63,37 @@ const HandlePlayerBan = async (nitrado_cred, client, gamertag, ban) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const GetRemoteDir = async (nitrado_cred, client, dir="") => {
|
|
||||||
const dirParam = client.exists(dir) ? `?dir=${dir}` : "";
|
|
||||||
for (let retries = 0; retries <= maxRetries; retries++) {
|
|
||||||
try {
|
|
||||||
const res = await fetch(`https://api.nitrado.net/services/${nitrado_cred.ServerID}/gameservers/file_server/list${dirParam}`, {
|
|
||||||
headers: {
|
|
||||||
"Authorization": nitrado_cred.Auth
|
|
||||||
}
|
|
||||||
}).then(response =>
|
|
||||||
response.json().then(data => data)
|
|
||||||
).then(res => res);
|
|
||||||
|
|
||||||
if (res.status === "error") return 1;
|
|
||||||
|
|
||||||
return res.data.entries;
|
|
||||||
} catch (error) {
|
|
||||||
client.error(`GetRemoteDir: Error connecting to server (${nitrado_cred.ServerID}): ${error}`);
|
|
||||||
if (retries == maxRetries) {
|
|
||||||
client.error(`GetRemoteDir: Error connecting to server (${nitrado_cred.ServerID}) after ${maxRetries} retries`);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await new Promise(resolve => setTimeout(resolve, retryDelay)); // Delay before retrying
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Public functions (called externally)
|
// Public functions (called externally)
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
|
|
||||||
|
GetRemoteDir: async (nitrado_cred, client, dir="") => {
|
||||||
|
const dirParam = client.exists(dir) ? `?dir=${dir}` : "";
|
||||||
|
for (let retries = 0; retries <= maxRetries; retries++) {
|
||||||
|
try {
|
||||||
|
const res = await fetch(`https://api.nitrado.net/services/${nitrado_cred.ServerID}/gameservers/file_server/list${dirParam}`, {
|
||||||
|
headers: {
|
||||||
|
"Authorization": nitrado_cred.Auth
|
||||||
|
}
|
||||||
|
}).then(response =>
|
||||||
|
response.json().then(data => data)
|
||||||
|
).then(res => res);
|
||||||
|
|
||||||
|
if (res.status === "error") return 1;
|
||||||
|
|
||||||
|
return res.data.entries;
|
||||||
|
} catch (error) {
|
||||||
|
client.error(`GetRemoteDir: Error connecting to server (${nitrado_cred.ServerID}): ${error}`);
|
||||||
|
if (retries == maxRetries) {
|
||||||
|
client.error(`GetRemoteDir: Error connecting to server (${nitrado_cred.ServerID}) after ${maxRetries} retries`);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await new Promise(resolve => setTimeout(resolve, retryDelay)); // Delay before retrying
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
DownloadNitradoFile: async(nitrado_cred, client, filename, outputDir) => {
|
DownloadNitradoFile: async(nitrado_cred, client, filename, outputDir) => {
|
||||||
for (let retries = 0; retries <= maxRetries; retries++) {
|
for (let retries = 0; retries <= maxRetries; retries++) {
|
||||||
try {
|
try {
|
||||||
@@ -176,6 +177,7 @@ module.exports = {
|
|||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
client.error(`Failed to get Nitrado server stats (${nitrado_cred.ServerID}): status: ${res.status}, message: ${res.statusText}: ${fetcher} via FetchServerSettings`);
|
client.error(`Failed to get Nitrado server stats (${nitrado_cred.ServerID}): status: ${res.status}, message: ${res.statusText}: ${fetcher} via FetchServerSettings`);
|
||||||
|
if (res.status == 401) return 1; // return immediately if unauthorized
|
||||||
if (retries === 2) return 1; // Return error status on the second failed status code.
|
if (retries === 2) return 1; // Return error status on the second failed status code.
|
||||||
} else {
|
} else {
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
|
|||||||
Reference in new issue
Block a user