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
d.js toolkit
d.js toolkit16mo 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!
LightAndy📸
LightAndy📸OP16mo ago
[email protected] and v20.5.0
LightAndy📸
LightAndy📸OP16mo ago
In the command file (SlashCommandBuilder) I set the title of the modal by getting the type string option (added to the SlashCommand), like this:
LightAndy📸
LightAndy📸OP16mo ago
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))
Syjalo
Syjalo16mo ago
You can and should set the type in the custom id of the modal
LightAndy📸
LightAndy📸OP16mo ago
Then I'd need 5 different modals right?
Syjalo
Syjalo16mo ago
No, you can dynamically assign and read the custom id
LightAndy📸
LightAndy📸OP16mo ago
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
Want results from more Discord servers?
Add your server