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 toolkit2y 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📸OP2y ago
[email protected] and v20.5.0
LightAndy📸
LightAndy📸OP2y 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📸OP2y 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
Syjalo2y ago
You can and should set the type in the custom id of the modal
LightAndy📸
LightAndy📸OP2y ago
Then I'd need 5 different modals right?
Syjalo
Syjalo2y ago
No, you can dynamically assign and read the custom id
LightAndy📸
LightAndy📸OP2y 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