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
d.js docs
d.js docs2y ago
• 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.
Rodry
Rodry2y ago
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
Almeida
Almeida2y ago
show the code you're using you most likely unbound the this context from the method
Rodry
Rodry2y ago
Rodry
Rodry2y ago
could that ternary be causing this issue?
Almeida
Almeida2y ago
yes
Rodry
Rodry2y ago
how would I fix this then?
Almeida
Almeida2y ago
(a ? b : c).bind(msgOrInteraction)({ content: '', ... }) or .call(msgOrInteraction, { content: 'abc', ... })
Rodry
Rodry2y ago
alright I didn't know that would happen and that does indeed fix it, thank you!