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?
![](https://utfs.io/f/a98e9daa-8036-402c-bdce-8c55335ba012-4pl4mu.png)
![](https://utfs.io/f/1cc4616e-b98a-4ab7-9342-0140c0355ae3-4pl4mu.png)
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 method![](https://utfs.io/f/2585ef16-110f-4c7b-98d2-6baf58ec49ad-4pl4mu.png)
could 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!