Change onmessage to use new custom commands set instead of json file
This commit is contained in:
parent
570a8e49b7
commit
eae1e9130e
1 changed files with 4 additions and 10 deletions
|
@ -23,16 +23,10 @@ module.exports = function(client, owners, message, globalPrefix){
|
||||||
const commandName = args.shift().toLowerCase();
|
const commandName = args.shift().toLowerCase();
|
||||||
const command = client.commands.get(commandName);
|
const command = client.commands.get(commandName);
|
||||||
if (!command){
|
if (!command){
|
||||||
const customPath = './data/customCommands.json';
|
const command = client.customCommands.get(commandName);
|
||||||
if(fs.existsSync(customPath)){
|
if(command){
|
||||||
let json = fs.readFileSync(customPath, 'utf8');
|
let customMessage = customReplaceWithVariables(command, message, prefix, globalPrefix);
|
||||||
let customCommands = JSON.parse(json)
|
message.channel.send(customMessage);
|
||||||
customCommands.forEach(function (customCommand) {
|
|
||||||
if (customCommand.customName === commandName) {
|
|
||||||
let customMessage = customReplaceWithVariables(customCommand.customMessage, message, prefix, globalPrefix)
|
|
||||||
message.channel.send(customMessage)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue