diff --git a/config/config.js b/config/config.js index 6e63f8b..e079aeb 100644 --- a/config/config.js +++ b/config/config.js @@ -3,7 +3,7 @@ require('dotenv').config(); module.exports = { Dev: process.env.Dev || "DEV.", - Version: package.version, // (major).(feature).(revision/bug/refactoring) + Version: package.version, // (major).(feature).(patch) Admins: ["362791661274660874", "329371697570381824"], // Admins of the bot ServerID: "1050215624053374976", GuildID: process.env.GuildID || "", diff --git a/package.json b/package.json index 96ee6d0..faabe52 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dayzr-bot", - "version": "10.1.2", + "version": "10.1.3", "description": "A General Purpose Discord Bot for DayZ Nitrado Servers.", "main": "index.js", "nodemonConfig": { diff --git a/util/AdminLogsHandler.js b/util/AdminLogsHandler.js index d63b60c..95392e2 100644 --- a/util/AdminLogsHandler.js +++ b/util/AdminLogsHandler.js @@ -28,6 +28,9 @@ module.exports = { DetectCombatLog: async (client, guildId, data) => { if (!client.exists(data.lastDamageDate)) return; + let guild = await client.GetGuild(guildId); + if (!client.exists(guild.connectionLogsChannel)) return; + const newDt = await client.getDateEST(data.time); const diffSeconds = Math.round((newDt.getTime() - data.lastDamageDate.getTime()) / 1000); @@ -36,8 +39,11 @@ module.exports = { if (diffSeconds > (data.combatLogTimer * 60)) return; if (data.lastDamageDate <= data.lastDeathDate) return; - let guild = await client.GetGuild(guildId); - if (!client.exists(guild.connectionLogsChannel)) return; + // If lastHitBy (attacker) died to this player or another, + // then it does not count as combat logging, (the combat ended) + let attacker = guild.playerstats.find(stat => stat.gamertag = data.lastHitBy); + if (attacker.lastDeathDate > data.lastDamageDate) return; + const channel = client.GetChannel(guild.connectionLogsChannel); if (!channel) return;