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 toolkit9mo 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
CometOP9mo ago
ping in reply pls!
duck
duck9mo ago
@Comet is the button in the thread like this one?
Comet
CometOP9mo ago
yes, it's the first message in the thread as well
duck
duck9mo ago
then <ButtonInteraction>.channel is the ThreadChannel
Comet
CometOP9mo ago
it's taking this as undefined what would <ButtonInteraction> mean here? just making sure i understood you correctly
duck
duck9mo ago
well <Interaction>.channel should never be undefined even if not present (it'd be null instead)
d.js docs
d.js docs9mo ago
Explaining <Class> and Class#method notation: learn more
duck
duck9mo ago
care to share your code?
Comet
CometOP9mo 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
CometOP9mo ago
just console logged it and it says undefined to double check
duck
duck9mo ago
I didn't mean ButtonInteraction.channel interaction is your ButtonInteraction instance in this case
Comet
CometOP9mo 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
duck9mo ago
that definitely sounds like you're paraphrasing, but it sounds like you're looking at a ThreadChannel
Comet
CometOP9mo 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
duck9mo ago
the method is setArchived
d.js docs
d.js docs9mo ago
:method: ThreadChannel#setArchived() Sets whether the thread is archived.
Comet
CometOP9mo ago
im sorry for bothering you with this lmao all good now, thank you
Want results from more Discord servers?
Add your server