Search
Get Started
d-I❄
discord.js - Imagine ❄
•
2y ago
orion☕
Why ChatInputCommandInteraction can return a null channel?
discord.js - Imagine ❄
Join
Support server for discord.js, a Node.js module to interact with Discord's apps API.
58,353
Members
View on Discord
Was this page helpful?
Yes
No
D
d.js toolkit
•
7/12/24, 12:37 PM
What
's your exact discord
.js
npm list discord.js
npm list discord.js
and node
node -v
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 OP
S
Svitkona
•
7/12/24, 12:46 PM
looking at the source
,
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#L136
O
orion☕
OP
•
7/12/24, 12:50 PM
oooh
, i see
O
orion☕
OP
•
7/12/24, 12:53 PM
But a ChatInputCommandInteraction is a SlashCommand that was called in a chat
, so in theory it should always return a channel
, no
?
O
orion☕
OP
•
7/12/24, 12:54 PM
Because a ChatInput always will be called in a TextChannel
O
orion☕
OP
•
7/12/24, 12:54 PM
I don
't know if i
'm wrong
C
chewie
•
7/12/24, 1:01 PM
Not if you do sketchy things with custom caches or missing intents
C
chewie
•
7/12/24, 1:01 PM
use the inCachedGuild
(
) typeguard
O
orion☕
OP
•
7/12/24, 8:27 PM
i see
, thanks guys
O
orion☕
OP
•
7/12/24, 8:27 PM
for the help
O
orion☕
OP
•
7/12/24, 8:27 PM
interaction.channel
interaction.channel