I made a Discord bot that has two slash commands. One command rolls dice and another displays random card pictures. I want these commands to only work in voice chat channels, not everywhere on the server.
I tested this on a brand new server with just the bot and default settings. In the integration menu, I turned off all channels for the bot commands. But users can still use the commands in any channel they want.
I also tried blocking the bot role from using commands in specific channel categories. Even after doing this, the slash commands still work in those restricted areas.
Discord’s slash command permissions are a pain. What you’re seeing happens because slash commands skip normal channel permission checks. The integration menu restrictions should work, but there’s usually a delay or caching problem that stops them from kicking in right away.
Kick the bot from your server completely and re-add it with just the permissions you actually need. Permission changes don’t always stick until you do a fresh auth. Also test this as a regular user, not the server owner - owners bypass most restrictions anyway.
If it’s still broken, add a channel type check in your code. Make it verify the interaction’s in a voice channel before running the command.
Yeah, this is super common with Discord bots. Slash command permissions are pretty unreliable, especially when you’re testing as admin. Your admin privileges basically override channel restrictions, so the bot looks like it works everywhere even when it shouldn’t. I’ve built similar bots and found the best fix is just handling channel validation in your code. Check if the user’s in a voice channel before running the command - something like verifying interaction.user.voice exists and has a channel property works great. Honestly, don’t rely on Discord’s permission system for slash commands. It’s inconsistent and the integration menu settings are buggy with weird sync delays. Just validate everything in your code and you’ll have way more control over where commands actually work.