Handling modal submissions

What Is the correct way to handle modals? https://github.com/MRDGH2821/Perpetual-Mechanical-Array-Bot/blob/rewrite-sapphire/src/baseBot/commands/confess.ts#L207 I tried this way, but the logs throw Unknown Interaction error. So I definitely know this is incorrect way to do. I just want to know the proper way to do this. I don't want to create a separate interaction handler just for modal as all the required logic exists inside that same command file
  "dependencies": {
    "@sapphire/decorators""^6.0.0",
    "@sapphire/discord.js-utilities""^6.0.4",
    "@sapphire/framework""^4.2.2",
    "@sapphire/pieces""^3.6.1",
    "@sapphire/plugin-logger""^3.0.2",
    "@sapphire/plugin-subcommands""^4.0.0",
    "@sapphire/ratelimits""^2.4.6",
    "@sapphire/time-utilities""^1.7.9",
    "@sapphire/utilities""^3.11.0",
    "colorette""^2.0.19",
    "discord-api-types""^0.37.37",
    "discord.js""^14.9.0",
    "firebase-admin""^11.6.0",
    "yaspr""^1.0.2"
  "dependencies": {
    "@sapphire/decorators""^6.0.0",
    "@sapphire/discord.js-utilities""^6.0.4",
    "@sapphire/framework""^4.2.2",
    "@sapphire/pieces""^3.6.1",
    "@sapphire/plugin-logger""^3.0.2",
    "@sapphire/plugin-subcommands""^4.0.0",
    "@sapphire/ratelimits""^2.4.6",
    "@sapphire/time-utilities""^1.7.9",
    "@sapphire/utilities""^3.11.0",
    "colorette""^2.0.19",
    "discord-api-types""^0.37.37",
    "discord.js""^14.9.0",
    "firebase-admin""^11.6.0",
    "yaspr""^1.0.2"
GitHub
Perpetual-Mechanical-Array-Bot/confess.ts at rewrite-sapphire · MRD...
Discord Bot for Traveler Mains Server. Contribute to MRDGH2821/Perpetual-Mechanical-Array-Bot development by creating an account on GitHub.
3 Replies
MRDGH2821
MRDGH2821OP2y ago
This solution worked for me. I had to put filter & time to get things working
await interaction.showModal(modalObj)

await interaction.awaitModalSubmit({
time: 3*1000*60, // 3 minnutes,
filter(itx) {
return itx.customId === "modal_custom_id";
}
})
.then((modalCtx)=> {
// stuff
})
await interaction.showModal(modalObj)

await interaction.awaitModalSubmit({
time: 3*1000*60, // 3 minnutes,
filter(itx) {
return itx.customId === "modal_custom_id";
}
})
.then((modalCtx)=> {
// stuff
})
Sawako
Sawako2y ago
My face when 3*1000*60 > 180e3 Or
import { Time } from “@sapphire/duration”

Time.minute * 3
import { Time } from “@sapphire/duration”

Time.minute * 3
Want results from more Discord servers?
Add your server