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