Using the new inbuilt slash commands (like /play)? Check this article instead.
Bots are a very cool tool to spice up your Discord server. Sometimes though, you don't want chats to get flooded with commands. For those cases, it makes sense to limit the command usage to designated channels.
Below you can find a guide on how to achieve this with Groovy. Since this guide uses Discord's inbuilt permission system, this will work for any other bot as well and is the recommended way to do so.
1. Make sure that none of Groovy's roles have the Administrator permission enabled.
2. In every channel that you want Groovy to not respond in, deny Groovy's View Channel permission.
3. Disable the 'Use Slash Commands' permission for @everyone.