From 7c2b8eb27b8788eb22aa3df59e13bcf85a9f923d Mon Sep 17 00:00:00 2001 From: Dotwood Media <55753961+DotwoodMedia@users.noreply.github.com> Date: Tue, 17 Jan 2023 14:43:45 +0100 Subject: [PATCH] Code made more compact --- src/commands/setup/welcomechannels.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/commands/setup/welcomechannels.js b/src/commands/setup/welcomechannels.js index 356ec82..f27ca16 100644 --- a/src/commands/setup/welcomechannels.js +++ b/src/commands/setup/welcomechannels.js @@ -7,13 +7,12 @@ module.exports = async (client, interaction, args) => { const choice = interaction.options.getString('setup'); const channel = interaction.options.getChannel('channel'); - if (choice == "welcomechannel") { - client.createChannelSetup(welcomeChannel, channel, interaction) - } + const choices = { + welcomechannel : welcomeChannel, + leavechannel : leaveChannel + }; - if (choice == "leavechannel") { - client.createChannelSetup(leaveChannel, channel, interaction) - } + client.createChannelSetup(choices[choice], channel, interaction); } - \ No newline at end of file +