configure combat log timer/refactor boolean configuration
This commit is contained in:
4 files changed
+38
-23
No files matched your search
@@ -148,18 +148,6 @@ module.exports = {
|
|||||||
description: "Enable/Disable periodic server checks and restart if stopped.",
|
description: "Enable/Disable periodic server checks and restart if stopped.",
|
||||||
value: "auto-restart",
|
value: "auto-restart",
|
||||||
type: CommandOptions.SubCommand,
|
type: CommandOptions.SubCommand,
|
||||||
}, {
|
|
||||||
name: "combat-log-timer",
|
|
||||||
description: "Set the number of minutes to elapse for a player to not combat log. (Set to 0 to disbable combat logging detection)",
|
|
||||||
value: "combat-log-timer",
|
|
||||||
type: CommandOptions.SubCommand,
|
|
||||||
options: [{
|
|
||||||
name: "minutes",
|
|
||||||
description: "Minutes to qualify combat log",
|
|
||||||
value: 5,
|
|
||||||
type: CommandOptions.Integer, // Integer
|
|
||||||
|
|
||||||
}]
|
|
||||||
}],
|
}],
|
||||||
SlashCommand: {
|
SlashCommand: {
|
||||||
/**
|
/**
|
||||||
|
|||||||
+24
-1
@@ -317,6 +317,18 @@ module.exports = {
|
|||||||
type: CommandOptions.Boolean,
|
type: CommandOptions.Boolean,
|
||||||
required: true,
|
required: true,
|
||||||
}]
|
}]
|
||||||
|
}, {
|
||||||
|
name: "combat-log-timer",
|
||||||
|
description: "Set the number of minutes to elapse for a player to not combat log. (Set to 0 to disbable combat logging detection)",
|
||||||
|
value: "combat-log-timer",
|
||||||
|
type: CommandOptions.SubCommand,
|
||||||
|
options: [{
|
||||||
|
name: "minutes",
|
||||||
|
description: "Minutes to qualify combat log",
|
||||||
|
value: 5,
|
||||||
|
type: CommandOptions.Integer,
|
||||||
|
min_value: 0,
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
SlashCommand: {
|
SlashCommand: {
|
||||||
@@ -522,7 +534,7 @@ module.exports = {
|
|||||||
return interaction.send({ embeds: [successSetKillfeedChannelEmbed] });
|
return interaction.send({ embeds: [successSetKillfeedChannelEmbed] });
|
||||||
|
|
||||||
case 'show_killfeed_coords':
|
case 'show_killfeed_coords':
|
||||||
const showKillfeedCoordsConfiguration = args[0].options[0].value;
|
const showKillfeedCoordsConfiguration = args[0].options[0].value ? 1 : 0;
|
||||||
|
|
||||||
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.showKillfeedCoords": showKillfeedCoordsConfiguration}}, (err, res) => {
|
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.showKillfeedCoords": showKillfeedCoordsConfiguration}}, (err, res) => {
|
||||||
if (err) return client.sendInternalError(interaction, err);
|
if (err) return client.sendInternalError(interaction, err);
|
||||||
@@ -715,6 +727,17 @@ module.exports = {
|
|||||||
|
|
||||||
return interaction.send({ embeds: [successEMPPriceEmbed] });
|
return interaction.send({ embeds: [successEMPPriceEmbed] });
|
||||||
|
|
||||||
|
case 'combat-log-timer':
|
||||||
|
client.dbo.collection("guilds").updateOne({"server.serverID": GuildDB.serverID}, {$set: {"server.combatLogTimer":args[0].options[0].value}}, (err, res) => {
|
||||||
|
if (err) return client.sendInternalError(interaction, err);
|
||||||
|
});
|
||||||
|
|
||||||
|
let successCobatLogTimerEmbed = new EmbedBuilder()
|
||||||
|
.setColor(client.config.Colors.Green)
|
||||||
|
.setDescription(`Successfully set combat log timer to **${args[0].options[0].value.toFixed(0)} minutes.**`);
|
||||||
|
|
||||||
|
return interaction.send({ embeds: [successCobatLogTimerEmbed] });
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return client.sendInternalError(interaction, 'There was an error parsing the config command');
|
return client.sendInternalError(interaction, 'There was an error parsing the config command');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ class DayzRBot extends Client {
|
|||||||
if (lines[i].includes('| ####')) continue;
|
if (lines[i].includes('| ####')) continue;
|
||||||
if (lines[i].includes("(id=Unknown") || lines[i].includes("Player \"Unknown Entity\"")) continue;
|
if (lines[i].includes("(id=Unknown") || lines[i].includes("Player \"Unknown Entity\"")) continue;
|
||||||
if ((i - 1) >= 0 && lines[i] == lines[i - 1]) continue; // continue if this line is a duplicate of the last line
|
if ((i - 1) >= 0 && lines[i] == lines[i - 1]) continue; // continue if this line is a duplicate of the last line
|
||||||
if (lines[i].includes('connected') || lines[i].includes('pos=<') || lines[i].includes('hit by Player')) s = await HandlePlayerLogs(this, guildId, s, lines[i]);
|
if (lines[i].includes('connected') || lines[i].includes('pos=<')) s = await HandlePlayerLogs(this, guildId, s, lines[i], guild.combatLogTimer);
|
||||||
if (lines[i].includes('killed by with') || lines[i].includes('killed by LandMineTrap')) s = await HandleKillfeed(this, guildId, s, lines[i]); // Handles explosive deaths
|
if (lines[i].includes('killed by with') || lines[i].includes('killed by LandMineTrap')) s = await HandleKillfeed(this, guildId, s, lines[i]); // Handles explosive deaths
|
||||||
if (!(i + 1 >= lines.length) && lines[i + 1].includes('killed by') && lines[i].includes('TransportHit')) s = await HandleKillfeed(this, guildId, s, lines[i]) // Handles vehicle deaths
|
if (!(i + 1 >= lines.length) && lines[i + 1].includes('killed by') && lines[i].includes('TransportHit')) s = await HandleKillfeed(this, guildId, s, lines[i]) // Handles vehicle deaths
|
||||||
if (!(i + 1 >= lines.length) && lines[i + 1].includes('killed by Player') && lines[i].includes('hit by Player')) s = await HandleKillfeed(this, guildId, s, lines[i]); // Handles regular deaths
|
if (!(i + 1 >= lines.length) && lines[i + 1].includes('killed by Player') && lines[i].includes('hit by Player')) s = await HandleKillfeed(this, guildId, s, lines[i]); // Handles regular deaths
|
||||||
@@ -411,6 +411,7 @@ class DayzRBot extends Client {
|
|||||||
empPrice: 500000,
|
empPrice: 500000,
|
||||||
memberRole: "",
|
memberRole: "",
|
||||||
adminRole: "",
|
adminRole: "",
|
||||||
|
combatLogTimer: 5, // minutes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -484,6 +485,7 @@ class DayzRBot extends Client {
|
|||||||
uavPrice: guild.server.uavPrice,
|
uavPrice: guild.server.uavPrice,
|
||||||
memberRole: guild.server.memberRole,
|
memberRole: guild.server.memberRole,
|
||||||
adminRole: guild.server.adminRole,
|
adminRole: guild.server.adminRole,
|
||||||
|
combatLogTimer: guild.server.combatLogTimer,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-9
@@ -9,7 +9,7 @@ let lastSendMessage;
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
|
||||||
HandlePlayerLogs: async (client, guildId, stats, line) => {
|
HandlePlayerLogs: async (client, guildId, stats, line, combatLogTimer = 5) => {
|
||||||
|
|
||||||
const connectTemplate = /(.*) \| Player \"(.*)\" is connected \(id=(.*)\)/g;
|
const connectTemplate = /(.*) \| Player \"(.*)\" is connected \(id=(.*)\)/g;
|
||||||
const disconnectTemplate = /(.*) \| Player \"(.*)\"\(id=(.*)\) has been disconnected/g;
|
const disconnectTemplate = /(.*) \| Player \"(.*)\"\(id=(.*)\) has been disconnected/g;
|
||||||
@@ -86,14 +86,16 @@ module.exports = {
|
|||||||
lastConnectionDate: playerStat.lastConnectionDate,
|
lastConnectionDate: playerStat.lastConnectionDate,
|
||||||
});
|
});
|
||||||
|
|
||||||
DetectCombatLog(client, guildId, {
|
if (combatLogTimer != 0) {
|
||||||
time: info.time,
|
DetectCombatLog(client, guildId, {
|
||||||
player: info.player,
|
time: info.time,
|
||||||
pos: playerStat.pos,
|
player: info.player,
|
||||||
lastDamageDate: playerStat.lastDamageDate,
|
pos: playerStat.pos,
|
||||||
lastHitBy: playerStat.lastHitBy,
|
lastDamageDate: playerStat.lastDamageDate,
|
||||||
lastDeathDate: playerStat.lastDeathDate,
|
lastHitBy: playerStat.lastHitBy,
|
||||||
});
|
lastDeathDate: playerStat.lastDeathDate,
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line.includes('pos=<') && !line.includes('hit by')) {
|
if (line.includes('pos=<') && !line.includes('hit by')) {
|
||||||
|
|||||||
Reference in new issue
Block a user