Best way to stay in the same context with awaitModalSubmit?
When I use
<CommandInteraction>.awaitModalSubmit()
, does the filter automatically make sure that it's a modal that was opened in the same context as the command, in any way? If not, my idea was to filter on user and customId to make sure I stay in the same context, as seen below.
Is there a better way of achieving this?10 Replies
• What's your exact discord.js
npm list discord.js
and node node -v
version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.None of the examples I've seen filter on
member
, only on customId
, that's why I'm curious if there's something I'm missing
Isn't there a risk that another user could "hijack" the command if they submit a modal with the same customId
without the member
filter?if the member is null, the filter won't work as it will return false so it'd be better to directly access the user instead of going through the member
Good point, thank you 👍
But in general you have to filter on userId?
member id and user id are both the same but since the user id always exists, its more common that users get filtered from the user id
Yea I just meant either
In general you have to filter on user/member*?
(the person that invoked the command)
are u asking if filtering the user is required? if so, its not a requirement, however, if multiple people run the command at the same time, submitting could (i don't know for sure) conflict with other users responses
Yeah that was my question, and that's the answer I expected too
Thank you again 👍
my apologies for misunderstanding ur previous messages
nah it's my fault for using ambiguous wording and weird grammar haha
I'll archive this post