From b2cd38f9e541889044a4102027a520e10c555132 Mon Sep 17 00:00:00 2001 From: SowinskiBraeden Date: Wed, 7 Dec 2022 17:31:26 -0800 Subject: [PATCH] 4.1.4 check excluded list before claim --- commands/claim.js | 12 ++++++------ package.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/commands/claim.js b/commands/claim.js index ad6c959..b99e1e1 100644 --- a/commands/claim.js +++ b/commands/claim.js @@ -27,13 +27,13 @@ module.exports = { * @param {*} param3 */ run: async (client, interaction, args, { GuildDB }) => { - if (!interaction.member.roles.includes(args[0].value)) { - const invalidRoleEmbed = new EmbedBuilder() - .setColor(client.config.Colors.Yellow) - .setDescription('**Notice:**\n> You cannot claim an armband for a role you don\'t have.'); - return interaction.send({ embeds: [invalidRoleEmbed], flags: (1 << 6) }); - } + let des; + + if (GuildDB.excludedRoles.includes(args[0].value)) des = '**Notice:**\n> This role has been configured to be excluded to claim an armband.'; + if (!interaction.member.roles.includes(args[0].value)) des = '**Notice:**\n> You cannot claim an armband for a role you don\'t have.'; + + if (des) return interaction.send({ embeds: [new EmbedBuilder().setColor(client.config.Colors.Yellow).setDescription(des)], flags: (1 << 6) }); // If this faction has an existing record in the db if (GuildDB.factionArmbands[args[0].value]) { diff --git a/package.json b/package.json index ae85749..8f6a2d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dayz-armbands", - "version": "4.1.3", + "version": "4.1.4", "description": "A Discord Bot to handle DayZ server flags and armbands for in game factions.", "main": "index.js", "nodemonConfig": {