How to know if a slash command is executed in a thread|post or in a channel ?

Hi, I don't understand how to check if the ChatInputInteraction was executed on a channel or a thread since there is no "threadId" property. Does anyone could help me please ?
6 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
nullopt
nullopt3y ago
interaction.channel.isThread();
// or
interaction.channel.type === ChannelType.PublicThread
interaction.channel.isThread();
// or
interaction.channel.type === ChannelType.PublicThread
Apokalypt
ApokalyptOP3y ago
Thanks but the channel is typed as "optional" so if it's the case I will not be able to perform this check :/
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Apokalypt
ApokalyptOP3y ago
According to the type it's still mark as nullable 😅
Apokalypt
ApokalyptOP3y ago
I don't exactly know how djs handle the cache of channels 🤷‍♂️

Did you find this page helpful?