interaction listeners make my brain hurt
Sending info under:
5 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 OPmy voice channel code and my welcome embed (and application code seem to be crossing streams in terms of event listeners.
the specifics are that when i click a button under that embed it opens a modal, and when it gets submitted its calling this function in my voiceChannel.js:
instead of the modal interaction handling in my welcomeSignUp.js,
for some ridiculous reason i figured they would be able to function simultaneously and i could keep the modular nature of the code.
will i need to create a single function for modal handling for both the files or is there some way to have it only handle relevant events? bit new to this sorry.


again i do apologize if this is a dumb question. we just be trying our best out here
neither discord nor djs has anything to determine what's considered a "relevant event"
it does not track where in your code the event listener was added
the only thing that would distinguish this code from another
interactionCreate
listener is the if statement if (customId === 'name_modal') {
which seems to be after the code you're expecting not to execute here
in general we suggest having one listener per event, then delegating work from there
this would avoid any confusion about what event listener handles what😭
time to de-pretty my code.
thanks 🫂