From 5317e96a485e9c07bcfdd2d396a27354a19d2b93 Mon Sep 17 00:00:00 2001 From: SowinskiBraeden Date: Tue, 25 Oct 2022 12:21:31 -0700 Subject: [PATCH] 13.1.5 debug /search command and /config only_officers_search configuration --- commands/config.js | 7 +++---- commands/search.js | 8 ++++++-- config/config.js | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/commands/config.js b/commands/config.js index d75f24d..b69d9af 100644 --- a/commands/config.js +++ b/commands/config.js @@ -825,12 +825,11 @@ module.exports = { } } else if (args[0].name == 'only_officers_search') { - const setting = args[0].options[0]; - client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.onlyOfficersSearch": setting}}, function(err, res) { + client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.onlyOfficersSearch": args[0].options[0].value}}, function(err, res) { if (err) return client.sendInternalError(interaction, err); }); - const title = setting ? 'True: Only officers can use /search' : 'False: Any user can use /search'; + let title = args[0].options[0].value ? 'True: Only officers can use /search' : 'False: Any user can use /search'; const successEmbed = new EmbedBuilder() .setColor(client.config.Colors.Green) @@ -838,7 +837,7 @@ module.exports = { return interaction.send({ embeds: [successEmbed] }); } else if (args[0].name == 'casino_multiplier') { - client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.casinoMultiplier": args[0].options[0]}}, function(err, res) { + client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$set: {"server.casinoMultiplier": args[0].options[0].value}}, function(err, res) { if (err) return client.sendInternalError(interaction, err); }); diff --git a/commands/search.js b/commands/search.js index c733794..576762d 100644 --- a/commands/search.js +++ b/commands/search.js @@ -39,8 +39,12 @@ module.exports = { if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) { return interaction.send({ content: `You are not allowed to use the bot in this channel.` }); } - - if (GuildDB.onlyOfficersSearch && client.exists(GuildDB.officerRole) && !interaction.member.roles.includes(GuildDB.officerRole)) { + + if (GuildDB.onlyOfficersSearch && !client.exists(GuildDB.officerRole)) { + return interaction.send({ content: 'The officer role is required to use this command but has not been configured for this server.' }); + } + + if (GuildDB.onlyOfficersSearch && !interaction.member.roles.includes(GuildDB.officerRole)) { return interaction.send({ content: 'You don\'t have the permissions to use this command.' }); } diff --git a/config/config.js b/config/config.js index 9cddc9a..2caa826 100644 --- a/config/config.js +++ b/config/config.js @@ -2,7 +2,7 @@ require('dotenv').config(); module.exports = { Dev: "PROD.", - Version: "13.1.4", // (major).(feature).(revision/bug/refactoring) + Version: "13.1.5", // (major).(feature).(revision/bug/refactoring) Admins: ["362791661274660874", "329371697570381824"], // Admins of the bot DefaultPrefix: "?", ServerID: "955668596745461830",