Move checking if customCommands exists to main cmd

This commit is contained in:
SileNce5k 2021-07-03 19:38:34 +02:00
parent 8211d67326
commit 67f674c92b
No known key found for this signature in database
GPG key ID: C507260E7F2583AD
2 changed files with 4 additions and 3 deletions

View file

@ -13,6 +13,10 @@ module.exports = {
"<prefix>custom list - list all custom commands" "<prefix>custom list - list all custom commands"
], ],
execute({message, args, client}) { execute({message, args, client}) {
const customPath = './data/customCommands.json';
if(!fs.existsSync(customPath)){
fs.writeFileSync(customPath,"[]")
}
let sendText; let sendText;
if (args){ if (args){
let customName = args[1]; let customName = args[1];

View file

@ -2,9 +2,6 @@ const fs = require('fs');
module.exports = function(customName, customMessage, author){ module.exports = function(customName, customMessage, author){
let sendText; let sendText;
const customPath = './data/customCommands.json'; const customPath = './data/customCommands.json';
if(!fs.existsSync(customPath)){
fs.writeFileSync(customPath,"[]")
}
let json = fs.readFileSync(customPath, 'utf8'); let json = fs.readFileSync(customPath, 'utf8');
let customCommands = JSON.parse(json) let customCommands = JSON.parse(json)