Move checking if customCommands exists to main cmd
This commit is contained in:
parent
8211d67326
commit
67f674c92b
2 changed files with 4 additions and 3 deletions
|
@ -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];
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Add table
Reference in a new issue