Interaction is undefined when calling editReply
I'm calling editReply on a ButtonInteraction that has been replied to and I'm getting this error. Is there a bug on discord.js or am I doing something wrong?
9 Replies
• What's your exact discord.js
npm list discord.js
and node node -v
version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.Node.js v18.7.0 discord.js v14.2.0
Also I logged the interaction right before the editReply call and it's not undefined
show the code you're using
you most likely unbound the
this
context from the methodcould that ternary be causing this issue?
yes
how would I fix this then?
(a ? b : c).bind(msgOrInteraction)({ content: '', ... })
or .call(msgOrInteraction, { content: 'abc', ... })
alright I didn't know that would happen and that does indeed fix it, thank you!