Why ChatInputCommandInteraction can return a null channel?
5 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPlooking at the source,
interaction.channel
is a getter that grabs the channel from the cache, and theoretically it might not be present https://github.com/discordjs/discord.js/blob/14.15.3/packages/discord.js/src/structures/BaseInteraction.js#L136oooh, i see
But a ChatInputCommandInteraction is a SlashCommand that was called in a chat, so in theory it should always return a channel, no?
Because a ChatInput always will be called in a TextChannel
I don't know if i'm wrong
Not if you do sketchy things with custom caches or missing intents
use the inCachedGuild() typeguard
i see, thanks guys
for the help
❤️