I'm trying to build a bot with Commando, but I can't figure out a way to make the bot ignore commands (or better, delete and ignore) commands that are not sent in a defined channel. For example, if you don't send the command in #botchat the message gets deleted.
I know that I could deny the read permission to the bot in the other channels, but I have other modules running, and they require reading channels.
I could add a check at the beginning of every run function, but this won't affect the default commands.
Is there a way to write a check function that is run for every command before the actual run function begins? (Maybe using the Command class?)
I found out: you can use Inhibitors. Thanks to Gawdl3y#4269 in the Discord.js guild
//in main file
client.dispatcher.addInhibitor(msg => {
return (msg.channel.name == "blockme"); //you return whether the command should be blocked
})