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 docs3y 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
RodryOP3y 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
Almeida3y ago
show the code you're using you most likely unbound the this context from the method
Rodry
RodryOP3y ago
Rodry
RodryOP3y ago
could that ternary be causing this issue?
Almeida
Almeida3y ago
yes
Rodry
RodryOP3y ago
how would I fix this then?
Almeida
Almeida3y ago
(a ? b : c).bind(msgOrInteraction)({ content: '', ... }) or .call(msgOrInteraction, { content: 'abc', ... })
Rodry
RodryOP3y ago
alright I didn't know that would happen and that does indeed fix it, thank you!
Want results from more Discord servers?
Add your server