71 Replies
d.js toolkit
d.js toolkitā€¢3mo 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 staff
rockersDevs
rockersDevsOPā€¢3mo ago
rockersDevs
rockersDevsOPā€¢3mo ago
No description
duck
duckā€¢3mo ago
there is no intent named Interactions, so GatewayIntentBits.Interactions is undefined
rockersDevs
rockersDevsOPā€¢3mo ago
So remove the interaction?
treble/luna
treble/lunaā€¢3mo ago
yes Where did you event get that from
rockersDevs
rockersDevsOPā€¢3mo ago
I will try that* discord.js docs
treble/luna
treble/lunaā€¢3mo ago
Impossible
rockersDevs
rockersDevsOPā€¢3mo ago
went to chatgpt for debug and gave me this šŸ˜­
treble/luna
treble/lunaā€¢3mo ago
Yeah there is your issue
rockersDevs
rockersDevsOPā€¢3mo ago
šŸ˜­
treble/luna
treble/lunaā€¢3mo ago
Never ask ai Because this is the result Use the docs
rockersDevs
rockersDevsOPā€¢3mo ago
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:
rockersDevs
rockersDevsOPā€¢3mo ago
treble/luna
treble/lunaā€¢3mo ago
a channel select menu?
d.js docs
d.js docsā€¢3mo ago
To share long code snippets, use a service like gist, sourcebin, pastebin, or similar instead of posting them as large code blocks or files.
rockersDevs
rockersDevsOPā€¢3mo ago
ah right lemme get my source bin sorry https://srcb.in/ciMHUg6ZOI
treble/luna
treble/lunaā€¢3mo ago
and where do you handle the select menu interaction
rockersDevs
rockersDevsOPā€¢3mo ago
oh I need to have a handler for it?
treble/luna
treble/lunaā€¢3mo ago
yes Your code wont magically do something
rockersDevs
rockersDevsOPā€¢3mo ago
hmmm, i am looking at the guide rn and dont see it. am i lost or smth...
d.js docs
d.js docsā€¢3mo ago
:guide: Message Components: Component interactions read more
rockersDevs
rockersDevsOPā€¢3mo ago
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
duck
duckā€¢3mo ago
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
rockersDevs
rockersDevsOPā€¢3mo ago
yeah, honestly im really lost with it. im not sure where to put it, where to handle it or whatever.
duck
duckā€¢3mo ago
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 components
rockersDevs
rockersDevsOPā€¢3mo ago
so I should put the code inside of my events folder?
duck
duckā€¢3mo ago
have you set up an event handler to handle events in an events folder?
rockersDevs
rockersDevsOPā€¢3mo ago
i belive so let me double check yes yeah im not listening to you.... ur my friend first off
Unknown User
Unknown Userā€¢3mo ago
Message Not Public
Sign In & Join Server To View
rockersDevs
rockersDevsOPā€¢3mo ago
second, you know less than me šŸ˜­
duck
duckā€¢3mo ago
if you two are friends and crimson is just messing with you, please take this elsewhere
rockersDevs
rockersDevsOPā€¢3mo ago
were friends, but I need actual help... idk why he came in here
monbrey
monbreyā€¢3mo ago
Well he won't be here anymore lol
rockersDevs
rockersDevsOPā€¢3mo ago
Thanks! anyway
rockersDevs
rockersDevsOPā€¢3mo ago
No description
rockersDevs
rockersDevsOPā€¢3mo ago
does this workj? work*
Unknown User
Unknown Userā€¢3mo ago
Message Not Public
Sign In & Join Server To View
rockersDevs
rockersDevsOPā€¢3mo ago
i did but its still not sending or the dropdown is still failing
duck
duckā€¢3mo ago
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
d.js docs
d.js docsā€¢3mo 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
rockersDevs
rockersDevsOPā€¢3mo ago
This is the code, let me send in source bin https://srcb.in/dsZdKBwoMC wait, would I need to update my index file?
duck
duckā€¢3mo ago
I don't see any code for responding to component interactions please reread the interactionCreate event section in the guide
rockersDevs
rockersDevsOPā€¢3mo ago
ok, let me reread
rockersDevs
rockersDevsOPā€¢3mo ago
this?
No description
duck
duckā€¢3mo ago
the section is a little longer than just that, but yes that is the section
rockersDevs
rockersDevsOPā€¢3mo ago
ik the section, but i meant the code itself
rockersDevs
rockersDevsOPā€¢3mo ago
No description
duck
duckā€¢3mo ago
please actually read the guide instead of just looking at the code block
rockersDevs
rockersDevsOPā€¢3mo ago
let me re read i read through the select menu part, and still extremely lost
duck
duckā€¢3mo ago
care to share your updated code?
rockersDevs
rockersDevsOPā€¢3mo ago
well, i havent updated anything because im not sure what to do at all.... this has stumped me for like 2 days..
duck
duckā€¢3mo ago
is it possible you still haven't read past the first code block from this section?
rockersDevs
rockersDevsOPā€¢3mo ago
i read the information it said for the select menus
duck
duckā€¢3mo ago
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
rockersDevs
rockersDevsOPā€¢3mo ago
no i deleted that cause it wasnt working. that was before i read it, now that I read it im still confused
duck
duckā€¢3mo ago
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?
rockersDevs
rockersDevsOPā€¢3mo ago
probrably an interaction create listener
duck
duckā€¢3mo ago
then you will want to add that interactionCreate listener back and make the changes described across the 3 code blocks from the aforementioned guide
rockersDevs
rockersDevsOPā€¢3mo ago
duck
duckā€¢3mo ago
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
d.js docs
d.js docsā€¢3mo ago
:method: StringSelectMenuInteraction#reply() [email protected] Creates a reply to this interaction. Use the fetchReply option to get the bot's reply message.
// Reply to the interaction and fetch the response
interaction.reply({ content: 'Pong!', fetchReply: true })
.then((message) => console.log(`Reply sent with content ${message.content}`))
.catch(console.error);
// Reply to the interaction and fetch the response
interaction.reply({ content: 'Pong!', fetchReply: true })
.then((message) => console.log(`Reply sent with content ${message.content}`))
.catch(console.error);
:property: MessageComponentInteraction#customId [email protected] The custom id of the component which was interacted with
rockersDevs
rockersDevsOPā€¢3mo ago
where exactly would I put this at in the code ? and for the content, can I put the embed name?
duck
duckā€¢3mo ago
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
rockersDevs
rockersDevsOPā€¢3mo ago
i mean like for example its called "rulesEmbed1" can i put that, and alright
duck
duckā€¢3mo ago
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
rockersDevs
rockersDevsOPā€¢3mo ago
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...
duck
duckā€¢3mo ago
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 still
I'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 in
rockersDevs
rockersDevsOPā€¢3mo ago
the variable is in a different spot of code ill look at it aswell
duck
duckā€¢3mo ago
then once again, I'm gonna suggest brushing up on your javascript fundamentals before continuing particularly scoping
rockersDevs
rockersDevsOPā€¢3mo ago
alright I was able to fix it

Did you find this page helpful?