Discord offers a built-in way to enable/disable commands or restrict them to a few roles or users. More information here: Slash Command Permissions