button interaction failed (collector/interaction create?)

Hello, I am trying to setup a ticket bot by using collector, my ticket_create button works very well, however my interaction seems couldn't work for 'ticket_close'. aside from that, notice collector might have time limits, is there any way to make it without a time limit? I try not to add button into my interactionCreate, just afraid its messy for me.
No description
34 Replies
d.js toolkit
d.js toolkitā€¢5mo 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!
FG
FGOPā€¢5mo ago
One monent , let me show the code over here
treble/luna
treble/lunaā€¢5mo ago
Collectors dont require time limits, apart from modal ones, but they end if your bot restarts If you want it to be permanent, its better to use the interactionCreate event
FG
FGOPā€¢5mo ago
I see, then no worry for the collectors
FG
FGOPā€¢5mo ago
https://pastebin.com/484ASHX2 apologies if the codes quite messy
Pastebin
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle,...
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.
treble/luna
treble/lunaā€¢5mo ago
First of all, there is no such thing as interaction.mentions
FG
FGOPā€¢5mo ago
oh i see, what shall i replace?
treble/luna
treble/lunaā€¢5mo ago
wait Your 'interaction' is a Message isnt kt
FG
FGOPā€¢5mo ago
kinda, -ticket <mention #Channel>
treble/luna
treble/lunaā€¢5mo ago
Rename it as message, or at the least not interaction. And tell the line that errors
FG
FGOPā€¢5mo ago
it seems like not message... its an action.. or user interaction
treble/luna
treble/lunaā€¢5mo ago
If it is that should error There's no interaction.mentions
FG
FGOPā€¢5mo ago
what shall i replace the mentions
treble/luna
treble/lunaā€¢5mo ago
replace your var name with message for example
FG
FGOPā€¢5mo ago
using arg[0]?
treble/luna
treble/lunaā€¢5mo ago
And tell which line exactly errors
FG
FGOPā€¢5mo ago
const ticketChannel = interaction.messages.channels.first();?
treble/luna
treble/lunaā€¢5mo ago
...no interaction is a Message, not an interaction Name your variables properly.
FG
FGOPā€¢5mo ago
What I know is from collector there is error; Line 188 works, but Line 268 does not work Okay
treble/luna
treble/lunaā€¢5mo ago
There is no .setLocked on a TextChannel
FG
FGOPā€¢5mo ago
its a Thread private thread
treble/luna
treble/lunaā€¢5mo ago
ah then log to see what executes
FG
FGOPā€¢5mo ago
Log shows nothing :monkaStop: šŸ˜„
FG
FGOPā€¢5mo ago
Only have this
No description
treble/luna
treble/lunaā€¢5mo ago
then log to see where execution stops
d.js docs
d.js docsā€¢5mo ago
If you aren't getting any errors, try to place console.log checkpoints throughout your code to find out where execution stops. - Once you do, log relevant values and if-conditions - More sophisticated debugging methods are breakpoints and runtime inspections: learn more
FG
FGOPā€¢5mo ago
Hmm.. cant find any.. Any other document i can refer to console.log using VS 2022?
treble/luna
treble/lunaā€¢5mo ago
using console.log is the most basic js there is
FG
FGOPā€¢5mo ago
still cant find any
treble/luna
treble/lunaā€¢5mo ago
then learn js first #resources
FG
FGOPā€¢5mo ago
I mean my console doesn't shows which Line stops.. okay, let me have a look Hi there, I have tried one by one, the execution stop at line 268 I tried to log my clicked button's customId, it shows nothings, and for sure that the Id is matched. Could it because the interaction only collect from my panel channel?
d.js docs
d.js docsā€¢5mo ago
If you are waiting for button or select menu input from a specific message, don't create the collector on the channel. - Channel collectors return component interactions for any component within that channel.
- <Channel>.createMessageComponentCollector(ā€¦)
+ <Message>.createMessageComponentCollector(ā€¦)
- <Channel>.createMessageComponentCollector(ā€¦)
+ <Message>.createMessageComponentCollector(ā€¦)
FG
FGOPā€¢5mo ago
Okay, let me try, seems like it's the collector doesn't setup properly thanks hello, if follow using message.createMessageComponentCollector, meaning that I would have to create 2 collector in ticket.js? Nope they are in diff message I see, Actually i had 3 buttons 1st button is in the panel, to create ticket then it will create a new thread after filled up the modal 2nd button is inside the thread, to close the ticket and new message with the 3rd button ask to confirm delete ticket 3rd button to delete the thread
Tenebrae
Tenebraeā€¢5mo ago
What about using <channel>.createMessageComponentCollector(). These wont end after restart right? Oh oke thx
Want results from more Discord servers?
Add your server