Change onmessage to use new custom commands set instead of json file
All checks were successful
CI / CI (push) Successful in 20s
Lint Codebase / eslint (push) Successful in 16s

This commit is contained in:
SileNce5k 2024-12-19 18:19:20 +01:00
parent 570a8e49b7
commit eae1e9130e
Signed by: SileNce
GPG key ID: B0A142BB4291B204

View file

@ -23,16 +23,10 @@ module.exports = function(client, owners, message, globalPrefix){
const commandName = args.shift().toLowerCase();
const command = client.commands.get(commandName);
if (!command){
const customPath = './data/customCommands.json';
if(fs.existsSync(customPath)){
let json = fs.readFileSync(customPath, 'utf8');
let customCommands = JSON.parse(json)
customCommands.forEach(function (customCommand) {
if (customCommand.customName === commandName) {
let customMessage = customReplaceWithVariables(customCommand.customMessage, message, prefix, globalPrefix)
message.channel.send(customMessage)
}
});
const command = client.customCommands.get(commandName);
if(command){
let customMessage = customReplaceWithVariables(command, message, prefix, globalPrefix);
message.channel.send(customMessage);
}
return;
}