How to get title of the modal in Modals.ts (handler file)
I'm trying to get the title of the modal to figure out the type. There are 5 types:
* Games
* Apps
* Movies
* Series
* Subtitles
Is there a way to get the title of the modal inside a handler?
8 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!In the command file (SlashCommandBuilder) I set the title of the modal by getting the type string option (added to the SlashCommand), like this:
After I .setTitle (in the commands file), I go to the Modal Handler and want to get the title of the modal (because everytime might be different and I want to get the type (like shown in the picture))
You can and should set the type in the custom id of the modal
Then I'd need 5 different modals right?
No, you can dynamically assign and read the custom id
That got me really confused, can you please give me an example or something? Btw this is my Modals.ts (modal handler) code: https://gist.github.com/LightAndy1/efc6d37402c81953dcc8c55f672089cc