fix/show weapon icon

This commit is contained in:
SowinskiBraeden committed 2023-11-04 19:14:33 -07:00
1 parent 22d4dd1db4
commit 4980df99fc
2 files changed
+5 -4

No files matched your search

+4 -3
View File
@@ -79,7 +79,7 @@ module.exports = {
weaponSelect.addOptions({ weaponSelect.addOptions({
label: name, label: name,
description: `View this weapon's stats.`, 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)) if (!interaction.customId.endsWith(interaction.member.user.id))
return interaction.reply({ content: 'This interaction is not for you', flags: (1 << 6) }); 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]; const playerID = interaction.customId.split('-')[1];
let player = await client.dbo.collection("players").findOne({"playerID": playerID}); let player = await client.dbo.collection("players").findOne({"playerID": playerID});
const tag = player.discordID != "" ? `<@${player.discordID}>'s` : `**${player.gamertag}'s**`; const tag = player.discordID != "" ? `<@${player.discordID}>'s` : `**${player.gamertag}'s**`;
@@ -105,7 +106,7 @@ module.exports = {
let stats = new EmbedBuilder() let stats = new EmbedBuilder()
.setColor(client.config.Colors.Default) .setColor(client.config.Colors.Default)
.setDescription(`${tag} stats for the ${weapon}`) .setDescription(`${tag} stats for the ${weapon}`)
.setThumbnail(weapons[weapon]) .setThumbnail(weapons[weaponClass][weapon])
.addFields( .addFields(
{ name: `Shots Landed`, value: `${player.weaponStats[weapon].shotsLanded}`, inline: true }, { name: `Shots Landed`, value: `${player.weaponStats[weapon].shotsLanded}`, inline: true },
{ name: `Times Shot`, value: `${player.weaponStats[weapon].timesShot}`, inline: true }, { name: `Times Shot`, value: `${player.weaponStats[weapon].timesShot}`, inline: true },
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "dayzr-bot", "name": "dayzr-bot",
"version": "12.2.1", "version": "12.2.2",
"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": {