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ā€¢3w 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
FGā€¢3w ago
One monent , let me show the code over here
treble/luna
treble/lunaā€¢3w 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
FGā€¢3w ago
I see, then no worry for the collectors
FG
FGā€¢3w 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ā€¢3w ago
First of all, there is no such thing as interaction.mentions
FG
FGā€¢3w ago
oh i see, what shall i replace?
treble/luna
treble/lunaā€¢3w ago
wait Your 'interaction' is a Message isnt kt
FG
FGā€¢3w ago
kinda, -ticket <mention #Channel>
treble/luna
treble/lunaā€¢3w ago
Rename it as message, or at the least not interaction. And tell the line that errors
FG
FGā€¢3w ago
it seems like not message... its an action.. or user interaction
treble/luna
treble/lunaā€¢3w ago
If it is that should error There's no interaction.mentions
FG
FGā€¢3w ago
what shall i replace the mentions
treble/luna
treble/lunaā€¢3w ago
replace your var name with message for example
FG
FGā€¢3w ago
using arg[0]?
treble/luna
treble/lunaā€¢3w ago
And tell which line exactly errors
FG
FGā€¢3w ago
const ticketChannel = interaction.messages.channels.first();?
treble/luna
treble/lunaā€¢3w ago
...no interaction is a Message, not an interaction Name your variables properly.
FG
FGā€¢3w ago
What I know is from collector there is error; Line 188 works, but Line 268 does not work Okay
treble/luna
treble/lunaā€¢3w ago
There is no .setLocked on a TextChannel
FG
FGā€¢3w ago
its a Thread private thread
treble/luna
treble/lunaā€¢3w ago
ah then log to see what executes
FG
FGā€¢3w ago
Log shows nothing :monkaStop: šŸ˜„
FG
FGā€¢3w ago
Only have this
No description
treble/luna
treble/lunaā€¢3w ago
then log to see where execution stops
d.js docs
d.js docsā€¢3w 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
FGā€¢3w ago
Hmm.. cant find any.. Any other document i can refer to console.log using VS 2022?
treble/luna
treble/lunaā€¢3w ago
using console.log is the most basic js there is
FG
FGā€¢3w ago
still cant find any
treble/luna
treble/lunaā€¢3w ago
then learn js first #resources
FG
FGā€¢3w 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ā€¢3w 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
FGā€¢2w 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ā€¢2w ago
What about using <channel>.createMessageComponentCollector(). These wont end after restart right? Oh oke thx