getting a thread from an interaction

i have a button that locks a thread once it's clicked only issue is i cant seem to figure out how to save the thread into a variable. Im not sure how, as previously you'd just say "interaction.<thing>" to get something from the interaction but here it doesnt work.
18 Replies
d.js toolkit
d.js toolkit2mo ago
- 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! - Marked as resolved by OP
Comet
Comet2mo ago
ping in reply pls!
duck
duck2mo ago
@Comet is the button in the thread like this one?
Comet
Comet2mo ago
yes, it's the first message in the thread as well
duck
duck2mo ago
then <ButtonInteraction>.channel is the ThreadChannel
Comet
Comet2mo ago
it's taking this as undefined what would <ButtonInteraction> mean here? just making sure i understood you correctly
duck
duck2mo ago
well <Interaction>.channel should never be undefined even if not present (it'd be null instead)
d.js docs
d.js docs2mo ago
Explaining <Class> and Class#method notation: learn more
duck
duck2mo ago
care to share your code?
Comet
Comet2mo ago
Pastebin
if ( interaction.isButton() && interaction.customId =...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Comet
Comet2mo ago
just console logged it and it says undefined to double check
duck
duck2mo ago
I didn't mean ButtonInteraction.channel interaction is your ButtonInteraction instance in this case
Comet
Comet2mo ago
ah, even when i tried that it returned the same thing ill try again to make sure big message appeared <ref *1 thread channel{ it then displays info about the server
duck
duck2mo ago
that definitely sounds like you're paraphrasing, but it sounds like you're looking at a ThreadChannel
Comet
Comet2mo ago
it seems like yes, it's a big wall of text so i didnt wanna clutter the post but after it, i just saw that it mentioned Error closing ticket: TypeError: thread.setArchive is not a function
duck
duck2mo ago
the method is setArchived
d.js docs
d.js docs2mo ago
:method: ThreadChannel#setArchived() Sets whether the thread is archived.
Comet
Comet2mo ago
im sorry for bothering you with this lmao all good now, thank you