i have a toggle system for commands but in the message event file, once i try to disable a command, the command is disabled but when i try the command again it comes up with the error:
TypeError: commandFetch.includes is not a function
at module.exports (D:\D_Bots\D3V1L\events\guild\message.js:71:29)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
This is the code:
let args = message.content.slice(prefix.length).trim().split(/ +/g);
const cmd = args.shift().toLowerCase();
let commandfile = client.commands.get(cmd) || client.commands.get(client.aliases.get(cmd))
if (commandfile) {
let commandFetch = db.fetch(`commandToggle_${message.guild.id}`)
if(commandFetch == null) commandFetch = []
if(commandFetch.includes(commandfile.name)) return message.channel.send("This command is disabled")
commandfile.run(client, message, args)
}
Help would be appriciated, thanks