From 7ef3ebf1961e5f67e9706077e30865e1026315ed Mon Sep 17 00:00:00 2001 From: Dotwood Media <55753961+DotwoodMedia@users.noreply.github.com> Date: Tue, 17 Jan 2023 14:43:01 +0100 Subject: [PATCH] Code made more compact --- src/commands/setup/fun.js | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/src/commands/setup/fun.js b/src/commands/setup/fun.js index f009188..e1ca849 100644 --- a/src/commands/setup/fun.js +++ b/src/commands/setup/fun.js @@ -9,26 +9,16 @@ const StarBoard = require("../../database/models/starboardChannels"); module.exports = async (client, interaction, args) => { const choice = interaction.options.getString('setup'); const channel = interaction.options.getChannel('channel'); + + const choices = { + birthdays : Birthdays, + chatbot : Chatbot, + reviews : Review, + suggestions : Suggestion, + starboard : StarBoard + }; - if (choice == "birthdays") { - client.createChannelSetup(Birthdays, channel, interaction) - } - - if (choice == "chatbot") { - client.createChannelSetup(Chatbot, channel, interaction) - } - - if (choice == "reviews") { - client.createChannelSetup(Review, channel, interaction) - } - - if (choice == "suggestions") { - client.createChannelSetup(Suggestion, channel, interaction) - } - - if (choice == "starboard") { - client.createChannelSetup(StarBoard, channel, interaction) - } + client.createChannelSetup(choices[choice], channel, interaction); } - \ No newline at end of file +