interaction.channel.guildId undefined after ephemeral reply
Hello, I've been having an issue since updating my script to v14.16.1. The issue seems to be that responding to interactions with ephemeral messages can sometimes cause the guildId of the channel in the cache to become undefined. It does not happen every time, but usually occurs within 1-3 interactions.
I have not been able to reproduce the error without the DirectMessages intent and Channel partial, even though the interaction is from a guild channel. The bot is installed in the guild and can view the channel.
I'm thinking this is a bug, but if not, can someone explain why the behavior seems inconsistent? Thanks in advance.
Minimum reproducible example:
Node v20.17.0 and [email protected]
6 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!npm ls
`-- [email protected]
node -v
v20.17.0
First picture in the OP showed it happening in the second interaction, but it can happen immediately as well
messageCreate
event is being fired for the ephemeral response with only DirectMessages
intent event though command was used in a guild. This may indirectly be causing the guildId to be undefined. Idk someone more knowledgeable can shed some more light on this. I haven't looked at the source code. I'm not sure messageCreate for ephemeral is supposed to be fired with only DirectMessages intent. Will have to check with dapi serverThe issue is in GuildChannel.js:68
Sometimes the data have
guild_id
property, but with value of undefined
. Can you create an issue?Yes I can create an issue for it
https://github.com/discordjs/discord.js/issues/10495
Not sure if I'm supposed to mark this post as resolved now, but the issue is created. Thanks for the help!