71 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!
- ✅
Marked as resolved by staffthere is no intent named
Interactions
, so GatewayIntentBits.Interactions
is undefined
So remove the interaction?
yes
Where did you event get that from
I will try that*
discord.js docs
Impossible
went to chatgpt for debug
and gave me this
😭
Yeah there is your issue
😭
Never ask ai
Because this is the result
Use the docs
Ahh
Okay
Thanks so much!
One last question
So i made a drop down right, and the rules wont show when I click on the drop down for the server rules
No errors:
a channel select menu?
ah
right
lemme get my source bin
sorry
https://srcb.in/ciMHUg6ZOI
and where do you handle the select menu interaction
oh I need to have a handler for it?
yes
Your code wont magically do something
hmmm, i am looking at the guide rn and dont see it. am i lost or smth...
well i was looking at the wrong one...
thanks
!
i will try this
Ok, im looking through and im not sure what to do.... Not sure which one to use for this, and where to put it
well that's entirely up to you
the above guide mentions some of the pros/cons of each method of receiving interactions, but if you have a more specific question, feel free to ask
yeah, honestly im really lost with it. im not sure where to put it, where to handle it or whatever.
in terms of where to put code, that also depends on you
you're free to listen to events anywhere you like
as mentioned in the
interactionCreate
event section of the guide, we also have an event handling guide if you'd like to organize your events into individual files
as for either type of collector, you'd probably want to utilize those immediately after sending the message with the componentsso I should put the code inside of my events folder?
have you set up an event handler to handle events in an events folder?
i belive so let me double check
yes
yeah im not listening to you....
ur my friend first off
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
second, you know less than me 😭
if you two are friends and crimson is just messing with you, please take this elsewhere
were friends, but I need actual help...
idk why he came in here
Well he won't be here anymore lol
Thanks!
anyway
does this workj?
work*
Unknown User•2d ago
Message Not Public
Sign In & Join Server To View
i did
but its still not sending
or the dropdown is still failing
then you'll probably want to log throughout to ensure the following:
- your event handler is properly listening to the event
- the listener is correctly identifying the component (or in general the logic I assume you have behaves as expected)
- the code for responding to the interaction actually executes
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 moreThis is the code, let me send in source bin
https://srcb.in/dsZdKBwoMC
wait, would I need to update my index file?
I don't see any code for responding to component interactions
please reread the interactionCreate event section in the guide
ok, let me reread
this?
the section is a little longer than just that, but yes that is the section
ik the section, but i meant the code itself
please actually read the guide instead of just looking at the code block
let me re read
i read through the select menu part, and still extremely lost
care to share your updated code?
well, i havent updated anything because im not sure what to do at all....
this has stumped me for like 2 days..
is it possible you still haven't read past the first code block from this section?
i read the information it said for the select menus
but you've opted not to add an if statement for select menus?
I'm just trying to confirm whether your code genuinely looks exactly the same as it does here or not
no i deleted that cause it wasnt working. that was before i read it, now that I read it im still confused
ok so then taking a step back, you will need some means of receiving the interaction
the issue with it previously is that on the first line of the
execute
function, the code returned if it was anything other than a slash command interaction (and message components aren't slash commands)
would you want a persistent interactionCreate
listener or a collector?probrably an interaction create listener
then you will want to add that
interactionCreate
listener back and make the changes described across the 3 code blocks from the aforementioned guidei will try that
https://srcb.in/MtSWBxuRwl
alright then you can respond to the select menu
interaction
in that if statement for select menus
the guide also briefly covers the different methods you can use for responding, but I imagine you'll specifically want to use interaction.reply()
which responds to the interaction by sending a new message
(it takes nearly the same options as any other message-sending method)
tbh I had assumed this article would mention checking custom ids, but just to quickly mention, you can check interaction.customId
to differentiate components:method: StringSelectMenuInteraction#reply()
[email protected]
Creates a reply to this interaction. Use the fetchReply option to get the bot's reply message.
:property: MessageComponentInteraction#customId [email protected]
The custom id of the component which was interacted withwhere exactly would I put this at in the code
?
and for the content, can I put the embed name?
where exactly would I put this at in the code?putting aside the fact that I mention where to put it in the first line of my previous message, the answer is "you'd put it where you want to reply to an interaction"
and for the content, can I put the embed name?embeds don't have names, so I'm not totally sure what you mean
i mean like for example its called "rulesEmbed1" can i put that, and alright
that sounds like you're asking whether you can use a variable you've defined?
if that's the part you're struggling with, I'd honestly suggest brushing up on your javascript fundamentals before continuing
oh if its a variable im assuming I can do that? but with the code block you send, i dont understand still. I am extremely sorry, im just not getting this...
oh if its a variable im assuming I can do that?it's your
rulesEmbed1
I haven't even seen any code that contains this name anywhere, so I'm really unsure what you're referring to
but with the code block you send, i dont understand stillI'm gonna shelve the "you should learn how to read docs" convo for 1 second and mention that if you click the link to actually go to the docs, there's a second example of how to use
interaction.reply()
that you may be interested inthe variable is in a different spot of code
ill look at it aswell
then once again, I'm gonna suggest brushing up on your javascript fundamentals before continuing
particularly scoping
alright
I was able to fix it