From 8012be779d92d116681ea6c016c3619675b0bab3 Mon Sep 17 00:00:00 2001 From: Taken Date: Wed, 29 Mar 2023 15:07:48 +0200 Subject: [PATCH] Updated reload --- commands/config.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/commands/config.js b/commands/config.js index b11afa8..06d7e8a 100644 --- a/commands/config.js +++ b/commands/config.js @@ -60,20 +60,17 @@ module.exports = { const { exec } = require('child_process'); - // exec a command and check if it has an error + const pm2 = exec('pm2 restart 0', ) - exec('pm2 restart 0', (error, stdout, stderr) => { + if (pm2.stderr) { + await interaction.editReply("An error occurred while reloading the bot.") + return + } - if (error) { - interaction.editReply({ content: 'There was an error while reloading the bot.', ephemeral: true }); - } else{ - interaction.editReply({ content: 'Bot reloaded.', ephemeral: true }); - } - - }); + await interaction.editReply("Bot reloaded.") } - + if (subcommand === 'sendguildapplication') { const channel = interaction.options.getChannel('channel');