Responding to interactions with an ephemeral message sometimes sets GuildChannel.guildId to undefined.
After updating to v14.16.1 I've noticed that sometimes when responding to an interaction with an ephemeral message, the guildId of the channel in the cache becomes set to undefined. I was able to create a minimum reproducible example below, but the behavior is still inconsistent. The issue can occur on the first interaction of a session or in subsequent ones.
Logging output 1:
Logging output 2:
From my testing it seems to require both the DirectMessages intent and the Channel partial. The application is installed in the guild and its bot user has view message permissions in the channel.
In a help thread I created, Syjalo identified the issue was in GuildChannel.js:68:
The issue is in GuildChannel.js:68
Sometimes the data have guild_id property, but with value of undefined.
I've put the issue as "medium" priority since it broke existing v14.15.3 code, but does have workarounds like using GuildChannel.guild.id instead.
Which package is this bug report for?
discord.js
Issue description
Responding to interactions with an ephemeral message sometimes sets GuildChannel.guildId to undefined.
After updating to v14.16.1 I've noticed that sometimes when responding to an interaction with an ephemeral message, the guildId of the channel in the cache becomes set to undefined. I was able to create a minimum reproducible example below, but the behavior is still inconsistent. The issue can occur on the first interaction of a session or in subsequent ones.
Logging output 1:
Logging output 2:
From my testing it seems to require both the DirectMessages intent and the Channel partial. The application is installed in the guild and its bot user has view message permissions in the channel.
In a help thread I created, Syjalo identified the issue was in GuildChannel.js:68:
I've put the issue as "medium" priority since it broke existing v14.15.3 code, but does have workarounds like using GuildChannel.guild.id instead.
TIA.
Code sample
Versions
discord.js v14.16.1 node v20.17.0 TypeScript N/A OS Windows 11 23H2
Issue priority
Medium (should be fixed soon)
Which partials do you have configured?
Channel
Which gateway intents are you subscribing to?
Guilds, DirectMessages
I have tested this issue on a development release
1725667851-8a74f144a