From 4980df99fca2de4e5034dd3237de41d0b606aaa3 Mon Sep 17 00:00:00 2001 From: Braeden Sowinski Date: Sat, 4 Nov 2023 19:14:33 -0700 Subject: [PATCH] fix/show weapon icon --- commands/weapon-stats.js | 7 ++++--- package.json | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/commands/weapon-stats.js b/commands/weapon-stats.js index 5d37e08..5dbefed 100644 --- a/commands/weapon-stats.js +++ b/commands/weapon-stats.js @@ -79,7 +79,7 @@ module.exports = { weaponSelect.addOptions({ label: name, description: `View this weapon's stats.`, - value: name, + value: `${weaponClass}_${name}`, }); } @@ -95,7 +95,8 @@ module.exports = { if (!interaction.customId.endsWith(interaction.member.user.id)) return interaction.reply({ content: 'This interaction is not for you', flags: (1 << 6) }); - const weapon = interaction.values[0]; + const weapon = interaction.values[0].split("_")[1]; + const weaponClass = interaction.values[0].split("_")[0]; const playerID = interaction.customId.split('-')[1]; let player = await client.dbo.collection("players").findOne({"playerID": playerID}); const tag = player.discordID != "" ? `<@${player.discordID}>'s` : `**${player.gamertag}'s**`; @@ -105,7 +106,7 @@ module.exports = { let stats = new EmbedBuilder() .setColor(client.config.Colors.Default) .setDescription(`${tag} stats for the ${weapon}`) - .setThumbnail(weapons[weapon]) + .setThumbnail(weapons[weaponClass][weapon]) .addFields( { name: `Shots Landed`, value: `${player.weaponStats[weapon].shotsLanded}`, inline: true }, { name: `Times Shot`, value: `${player.weaponStats[weapon].timesShot}`, inline: true }, diff --git a/package.json b/package.json index 958bdfb..165ab39 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dayzr-bot", - "version": "12.2.1", + "version": "12.2.2", "description": "A General Purpose Discord Bot for DayZ Nitrado Servers.", "main": "index.js", "nodemonConfig": {