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:Jump to 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.
12 Replies
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
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.
That doesn't work for my command.
Unless I should have a different (NSFW) command for no safe search?
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
This is what I'm trying to do btw.
Oh, make a internal check don't influence if the command is display or not
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
nsfw-search 🤷♂️ or unsafe-search
unsafe search totally works
or nosafe-search
Anyways, thanks.
Np