From 67f674c92b6fc6ca8e352c49e591497ae94e43d3 Mon Sep 17 00:00:00 2001 From: SileNce5k Date: Sat, 3 Jul 2021 19:38:34 +0200 Subject: [PATCH] Move checking if customCommands exists to main cmd --- commands/custom.js | 4 ++++ util/addCustomCommand.js | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/commands/custom.js b/commands/custom.js index adcf54b..56881aa 100644 --- a/commands/custom.js +++ b/commands/custom.js @@ -13,6 +13,10 @@ module.exports = { "custom list - list all custom commands" ], execute({message, args, client}) { + const customPath = './data/customCommands.json'; + if(!fs.existsSync(customPath)){ + fs.writeFileSync(customPath,"[]") + } let sendText; if (args){ let customName = args[1]; diff --git a/util/addCustomCommand.js b/util/addCustomCommand.js index 17fefe7..c25bd7c 100644 --- a/util/addCustomCommand.js +++ b/util/addCustomCommand.js @@ -2,9 +2,6 @@ const fs = require('fs'); module.exports = function(customName, customMessage, author){ let sendText; const customPath = './data/customCommands.json'; - if(!fs.existsSync(customPath)){ - fs.writeFileSync(customPath,"[]") - } let json = fs.readFileSync(customPath, 'utf8'); let customCommands = JSON.parse(json)