interaction.channel is null in slash commands

Hello. I'm sure this is an ID10T issue, but interaction.channel is null for me in my slash commands being used in DMs for my user bot. Am I missing something, like an intent? I'm literally only trying to check if the channel is DMs / DM group or if it's in an NSFW guild channel. Thanks.
Solution:
if you want to do a nsfw command, i recommend you to use nsfw property in builder https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
Discord Developer Portal
Discord Developer Portal — API Docs for Bots and Developers
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Jump to solution
12 Replies
Favna
Favna6mo ago
No that is correct. If this is in regards to the client permissions precondition, that will be fixed with https://discord.com/channels/737141877803057244/1302592456268714085
Solution
Chris 💙
Chris 💙6mo ago
if you want to do a nsfw command, i recommend you to use nsfw property in builder https://discord.com/developers/docs/interactions/application-commands#create-global-application-command
Discord Developer Portal
Discord Developer Portal — API Docs for Bots and Developers
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Fayne 🌈🐱 (fka Ruin 🌈🐲)
That doesn't work for my command.
Fayne 🌈🐱 (fka Ruin 🌈🐲)
Unless I should have a different (NSFW) command for no safe search?
Chris 💙
Chris 💙6mo ago
The nsfw tag ? Idk how in work with app install Maybe it check if you can use external app hete or not In else idk, never make nsfw commands lmao
Fayne 🌈🐱 (fka Ruin 🌈🐲)
This is what I'm trying to do btw.
No description
Chris 💙
Chris 💙6mo ago
Oh, make a internal check don't influence if the command is display or not
Fayne 🌈🐱 (fka Ruin 🌈🐲)
I probably should make a separate NSFW command TBH, since it apparently checks if the user is 18+ in DMs. Just... Not sure what I would name it. search-nosafe? Lol
Chris 💙
Chris 💙6mo ago
nsfw-search 🤷‍♂️ or unsafe-search
Fayne 🌈🐱 (fka Ruin 🌈🐲)
unsafe search totally works or nosafe-search Anyways, thanks.
Chris 💙
Chris 💙6mo ago
Np

Did you find this page helpful?