update/configure show killfeed coords

This commit is contained in:
SowinskiBraeden authored and GitHub committed 2023-09-04 10:44:01 -07:00
1 parent b94312229a
commit cbdbd18051
4 files changed
+37 -5

No files matched your search

+27 -1
View File
@@ -299,10 +299,23 @@ module.exports = {
options: [{ options: [{
name: "hours", name: "hours",
description: "Number of hours till income can be collected", description: "Number of hours till income can be collected",
value: 168.00, value: 168.00, // 1 week
type: 10, type: 10,
required: true, required: true,
}] }]
},
{
name: "show_killfeed_coords",
description: "Show the coordinates of the killer or victim in the killfeed channel.",
value: "show_killfeed_coords",
type: 1,
options: [{
name: "configuration",
description: "True or False",
value: false,
type: 5,
required: true,
}]
} }
], ],
SlashCommand: { SlashCommand: {
@@ -507,6 +520,19 @@ module.exports = {
return interaction.send({ embeds: [successSetKillfeedChannelEmbed] }); return interaction.send({ embeds: [successSetKillfeedChannelEmbed] });
case 'show_killfeed_coords':
const showKillfeedCoordsConfiguration = args[0].options[0].value;
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID},{$set: {"server.showKillfeedCoords": showKillfeedCoordsConfiguration}}, function(err, res) {
if (err) return client.sendInternalError(interaction, err);
});
const successConfigureShowKillfeedCoords = new EmbedBuilder()
.setDescription(`Successfully configured the killfeed to ${showKillfeedCoordsConfiguration ? 'show' : 'not show'} coordinates.`)
.setColor(client.config.Colors.Green);
return interaction.send({ embeds: [successConfigureShowKillfeedCoords] });
case 'admin_logs_channel': case 'admin_logs_channel':
const adminLogsChannel = args[0].options[0].value; const adminLogsChannel = args[0].options[0].value;
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "dayzr-bot", "name": "dayzr-bot",
"version": "9.5.3", "version": "9.6.0",
"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": {
+1
View File
@@ -348,6 +348,7 @@ class DayzRBot extends Client {
serverID: GuildId, serverID: GuildId,
allowedChannels: [], allowedChannels: [],
killfeedChannel: "", killfeedChannel: "",
showKillfeedCoords: false,
connectionLogsChannel: "", connectionLogsChannel: "",
activePlayersChannel: "", activePlayersChannel: "",
welcomeChannel: "", welcomeChannel: "",
+8 -3
View File
@@ -75,12 +75,15 @@ module.exports = {
let newDt = await client.getDateEST(info.time); let newDt = await client.getDateEST(info.time);
let unixTime = Math.floor(newDt.getTime()/1000); let unixTime = Math.floor(newDt.getTime()/1000);
const showCoords = client.exists(guild.showKillfeedCoords) ? guild.showKillfeedCoords : false; // default to false if no record of configuration.
if (killedBy == Templates.LandMine || killedBy == Templates.Explosion || killedBy == Templates.Vehicle) { if (killedBy == Templates.LandMine || killedBy == Templates.Explosion || killedBy == Templates.Vehicle) {
let cod = killedBy == Templates.LandMine ? `Land Mine Trap` : info.causeOfDeath; const cod = killedBy == Templates.LandMine ? `Land Mine Trap` : info.causeOfDeath;
const coord = showCoords ? `\nLocation [${info.victimPOS[0]}, ${info.victimPOS[1]}](https://www.izurvive.com/chernarusplussatmap/#location=${info.victimPOS[0]};${info.victimPOS[1]})**` : '';
const killEvent = new EmbedBuilder() const killEvent = new EmbedBuilder()
.setColor(client.config.Colors.Default) .setColor(client.config.Colors.Default)
.setDescription(`**Death Event** - <t:${unixTime}>\n**${info.victim}** killed by a **${cod}.\nLocation [${info.victimPOS[0]}, ${info.victimPOS[1]}](https://www.izurvive.com/chernarusplussatmap/#location=${info.victimPOS[0]};${info.victimPOS[1]})**`); .setDescription(`**Death Event** - <t:${unixTime}>\n**${info.victim}** killed by a **${cod}.${coord}`);
if (client.exists(channel)) await channel.send({ embeds: [killEvent] }); if (client.exists(channel)) await channel.send({ embeds: [killEvent] });
return stats; return stats;
@@ -165,9 +168,11 @@ module.exports = {
if (victimStatIndex == -1) stats.push(victimStat); if (victimStatIndex == -1) stats.push(victimStat);
else stats[victimStatIndex] = victimStat; else stats[victimStatIndex] = victimStat;
const coord = showCoord ? `\nLocation [${info.killerPOS[0]}, ${info.killerPOS[1]}](https://www.izurvive.com/chernarusplussatmap/#location=${info.killerPOS[0]};${info.killerPOS[1]})**` : '';
const killEvent = new EmbedBuilder() const killEvent = new EmbedBuilder()
.setColor(client.config.Colors.Default) .setColor(client.config.Colors.Default)
.setDescription(`**Kill Event** - <t:${unixTime}>\n**${info.killer}** killed **${info.victim}**\n> **__Kill Data__**\n> **Weapon:** \` ${info.weapon} \`\n> **Distance:** \` ${info.distance} \`\n> **Body Part:** \` ${info.bodyPart != undefined ? info.bodyPart.split('(')[0] : 'N/A'} \`\n> **Damage:** \` ${info.damage != undefined ? info.damage : 'N/A'} \`\n **Killer\n${killerStat.KDR.toFixed(2)} K/D - ${killerStat.kills} Kill${(killerStat.kills == 0 || killerStat.kills > 1) ? 's':''} - Killstreak: ${killerStat.killStreak}\nVictim\n${victimStat.KDR.toFixed(2)} K/D - ${victimStat.deaths} Deaths - Deathstreak: ${victimStat.deathStreak}\nLocation [${info.killerPOS[0]}, ${info.killerPOS[1]}](https://www.izurvive.com/chernarusplussatmap/#location=${info.killerPOS[0]};${info.killerPOS[1]})**`); .setDescription(`**Kill Event** - <t:${unixTime}>\n**${info.killer}** killed **${info.victim}**\n> **__Kill Data__**\n> **Weapon:** \` ${info.weapon} \`\n> **Distance:** \` ${info.distance} \`\n> **Body Part:** \` ${info.bodyPart != undefined ? info.bodyPart.split('(')[0] : 'N/A'} \`\n> **Damage:** \` ${info.damage != undefined ? info.damage : 'N/A'} \`\n **Killer\n${killerStat.KDR.toFixed(2)} K/D - ${killerStat.kills} Kill${(killerStat.kills == 0 || killerStat.kills > 1) ? 's':''} - Killstreak: ${killerStat.killStreak}\nVictim\n${victimStat.KDR.toFixed(2)} K/D - ${victimStat.deaths} Deaths - Deathstreak: ${victimStat.deathStreak}${coord}`);
if (client.exists(channel)) await channel.send({ embeds: [killEvent] }); if (client.exists(channel)) await channel.send({ embeds: [killEvent] });
if (client.exists(receivedBounty) && client.exists(channel)) await channel.send({ content: `<@${killerStat.discordID}>`, embeds: [receivedBounty] }); if (client.exists(receivedBounty) && client.exists(channel)) await channel.send({ content: `<@${killerStat.discordID}>`, embeds: [receivedBounty] });