From 6fc4e18bec5810f0042c7d8e27e49901d6664010 Mon Sep 17 00:00:00 2001 From: Dotwood Media <55753961+DotwoodMedia@users.noreply.github.com> Date: Tue, 17 Jan 2023 14:38:55 +0100 Subject: [PATCH] Code made more compact --- src/commands/setup/logs.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/commands/setup/logs.js b/src/commands/setup/logs.js index 7e06f78..fdbbf42 100644 --- a/src/commands/setup/logs.js +++ b/src/commands/setup/logs.js @@ -7,18 +7,14 @@ const levelLogs = require("../../database/models/levelChannels"); module.exports = async (client, interaction, args) => { const choice = interaction.options.getString('setup'); const channel = interaction.options.getChannel('channel'); + + const choices = { + 'serverLogs' : logs, + 'levelLogs' : levelLogs, + 'boostLogs' : boostLogs + }; - if (choice == "serverLogs") { - client.createChannelSetup(logs, channel, interaction) - } - - if (choice == "levelLogs") { - client.createChannelSetup(levelLogs, channel, interaction) - } - - if (choice == "boostLogs") { - client.createChannelSetup(boostLogs, channel, interaction) - } + client.createChannelSetup(choices[choice], channel, interaction); } - \ No newline at end of file +