Code Monkey home page Code Monkey logo

discord-modals's Introduction

Mateo-tem

Mateo-tem

GitHub Badge Twitter Badge Discord Badge PayPal Badge

👋 Hi, my name is Mateo, I'm from Peru and I'm a Discord Bots developer in JavaScript with Node.js. At the moment, I am learning TypeScript. I am looking forward to continuing programming and publishing many projects that I have in mind.

  • Pronouns: He/Him

I started programming on December, 2020. With some experience, I started projects. Some failed, others are still in progress. I hope one day to fulfill these projects. Thanks to these "Little Projects", I learned (still learning) a little bit of other languages, such as TypeScript, HTML and CSS.

📝 Future Goals:

  • Learn other languages like Python, HTML, CSS, R, Java, etc.
  • Create a Professional Discord Bot.
  • Create Discord Bots templates on GitHub.

📊 Stats:

Profile Views

Discord Status

discord-modals's People

Contributors

ascynx avatar beuluis avatar bitomic avatar jonbarrow avatar mateo-tem avatar turtlepaw avatar usebazz avatar wolffparkinson avatar zsoltime avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

discord-modals's Issues

discord modals error

hello, i have this error with your module

Package subpath './v10' is not defined by "exports" in D:\discord\bot\node_modules\discord-api-types\package.json
'ERR_PACKAGE_PATH_NOT_EXPORTED'

No se puede poner el evento modalSubmit en un event handler

No se si esto es un error como tal pero he probado muchas veces y no se puede meter el evento modalSubmit en el event handler con lo cual solo se puede meter en el index. Sería un buen punto para esta npm que se pudiese meter ahí ya que ayuda mucho más a la organización de todos los códigos

modal.interaction

No sé si esto es un error o no está añadido o si no se puede añadir pero hay alguna forma de sacar los datos de la interaction de los modals? Hago un console log de modal.interaction y me da undefined no sé si eso no está añadido pero si es así puedes añadirlo si se puede?

Modals for messageCreate event

Hello o/
Is it possible to open a modal on a command with messageCreate event (for example: !help)? If it's possible, how can I do it? And if it isn't possible, do you think it will be added?

By the way, great package!

[discord-modals] SHOW_MODAL_ERROR

Hello There :)

First of all, I love this work, great job!

I have the modal working and I am able to use the information submitted from the form and process it perfectly.

However, this does only work error log free on the first run, on any other runs, I see this, the interesting thing is, the functionality
still works, the form still pops up the information is still sent to my api as coded but this error is reported in my bots log:

[discord-modals] SHOW_MODAL_ERROR: An error occurred when showing a modal. DiscordAPIError: Interaction has already been acknowledged.
    at RequestHandler.execute (/home/CodeBoard/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (/home/CodeBoard/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
    at async showModal (/home/CodeBoard/node_modules/discord-modals/src/structures/ShowModal.js:18:9) {
  method: 'post',
  path: '/interactions/THESTINRG/callback',
  code: 40060,
  httpStatus: 400,
  requestData: { json: { type: 9, data: [Object] }, files: [] }
}
            const discordModals = require('discord-modals') // Define the discord-modals package!
            const { Modal, TextInputComponent, showModal } = require('discord-modals') // Now we extract the showModal method
            discordModals(client); // Provide the client to the discord-modals package


            let titleCompontent = new TextInputComponent() // We create an Text Input Component
              .setCustomId('title') // We set the customId to title
              .setLabel('Title Name Here')
              .setStyle('SHORT') //IMPORTANT: Text Input Component Style can be 'SHORT' or 'LONG'
              .setMinLength(4)
              .setMaxLength(15)
              .setPlaceholder('Write a text here')
              .setRequired(true) // If it's required or not
              .setValue('value')

            let descCompontent = new TextInputComponent() // We create an Text Input Component
              .setCustomId('desc') // We set the customId to title
              .setLabel('Description')
              .setStyle('LONG') //IMPORTANT: Text Input Component Style can be 'SHORT' or 'LONG'
              .setMinLength(4)
              .setMaxLength(250)
              .setPlaceholder('Write a text here')
              .setRequired(true) // If it's required or not
              .setValue('value')

            let components = [titleCompontent, descCompontent]
            console.log(components)

            const modal = new Modal() // We create a Modal
              .setCustomId('title')
              .setTitle('Task Information')
              .addComponents(components);

            showModal(modal, {
              client: client, // The showModal() method needs the client to send the modal through the API.
              interaction: interaction // The showModal() method needs the interaction to send the modal with the Interaction ID & Token.
            })


            client.on('modalSubmit', (modal) => {
              if (modal.customId === 'title') {
                (async () => {

                  const title = modal.getTextInputValue('title')
                  const desc = modal.getTextInputValue('desc')
                  var Request = http.post('https://' + process.env.ROOT_DOMAIN + '/jsonrpc.php').headers({ Accept: 'application/json', 'Content-Type': 'application/json' }).send({
                    "jsonrpc": "2.0",
                    "method": "createTask",
                    "id": 1176509098,
                    "params": {
                      "owner_id": userID,
                      "creator_id": userID,
                      "date_due": "",
                      "description": desc,
                      "category_id": 0,
                      "score": 0,
                      "title": title,
                      "project_id": projectID,
                      "color_id": "yellow",
                      "column_id": 0,
                      "recurrence_status": 0,
                      "recurrence_trigger": 0,
                      "recurrence_factor": 0,
                      "recurrence_timeframe": 0,
                      "recurrence_basedate": 0
                    }
                  });

                  // Begin the request and send authenication using the jsonrpc2.0 protocol.
                  Request.auth({
                    user: 'jsonrpc',
                    pass: process.env.API_KEY,
                    sendImmediately: false
                  }).then(function (response) {
                    console.log(response.body)
                  })

                  await modal.reply({ content: 'Task Created!', components: [] });

                })()
                ```
                
                I am not sure if I am doing something wrong in the this or the rest of my code or if the library may be having an issue.

injected prefill value into textfield

before i start the discussion, i would like to show my gratitude - thank you Mateo-tem.

i was struggling to inject custom values into the modal text fields when it opens up and i found out the final method of TextInputComponent .js module - toJSON() has value missing out. after adding "value: this.value" into the object, the builder starts accepting variables and prefills the form.

not sure if it is by design or just missing out.

Error [INVALID_CLIENT]: The provided Client is invalid in this context.

So I did everything as the docs said but I don't know why I'm getting this error:

  if (!(client instanceof Client)) throw new Error('INVALID_CLIENT');
                                   ^

Error [INVALID_CLIENT]: The provided Client is invalid in this context.
    at module.exports (/home/runner/Waiter/node_modules/discord-modals/index.js:14:42)
    at Object.<anonymous> (/home/runner/Waiter/index.js:12:1)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  [Symbol(code)]: 'INVALID_CLIENT'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node .`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2022-03-01T13_16_40_246Z-debug.log
exit status 1

Why is this happening? This is my main (index.js) file:

const express = require('express')
const app = express()
app.listen(8080)
app.get('/', (req, res) => {
  res.send('Waiter is online!')
})


const { Client, Collection } = require("discord.js")
const client = new Client({ intents: 32767 })
const discordModals = require('discord-modals')
discordModals(client);

client.commands = new Collection();
client.filters = new Collection();
client.filtersLog = new Collection();
client.voiceGenerator = new Collection();
client.cooldowns = new Collection();

require("./Systems/GiveawaySys")(client);
require("./Handlers/Events")(client);
require("./Handlers/Commands")(client);

client.login(process.env.token);

I run it in replit so I have the express function above.

modalSubmit won't work on DMs

Hey o/

If I execute a command in a DM and make it open a modal, the modal will show up correctly but if I have a modalSubmit method, it will give an error when submiting the modal: DiscordAPIError: Cannot execute action on a DM channel

Is this a Discord limitation or can it be fixed?
Thanks

modal.guild undefined

Al intentar hacer un comando de banear a través de la id da undefined modal.guild.

Event not being fired?

Hi, after showing the modal like this:

const modal = new Modal() // We create a Modal
.setCustomId('reminderModal')
.setTitle('What should I remind you about?')
.addComponents([
    new TextInputComponent() // We create a Text Input Component
        .setCustomId('reminderText')
        .setLabel('What to remind you about')
        .setStyle('LONG')
        .setMinLength(1)
        .setMaxLength(4000)
        .setPlaceholder('Call bob and talk about planning the event')
        .setRequired(true)
]);

showModal(modal, {
  client: client,
  interaction: interaction
})

The event doesn't seem to fire when the submit button is clicked, I have tried both in my event handler and in my index file, the event doesn't fire. Any ideas?

v14 support ?

Doesnt work in v14
I know modals are meant for v14 to implement but they are being slow. Could you try to make this work on v14 discord.js@dev

Modals do not have author property

Requesting a more informational class for

not sure how I would code this, but someone will have to do it someday, for this package or for discord.js

Problem showed in modal when submit modal

Got error when sending, but the codes are executing normally in background, no error log in console

In my code, if pressing add, will show a modal.
After user input, will add 30 songs into queue, send a embed if playlist is too long ,connect to voice chat etc...
(I tried to add 898 songs in the "modalSubmit" event ,got same error
so I send a embed to handle this, still don't work)

The project:
https://github.com/DanielBUBU/PD_maid

/config.json needs"clientId","guildId","globalPrefix","token" if you want to run this project

The playlist I test:
https://www.youtube.com/watch?v=K6k63SJQquo&list=PLnLMh6e929yc2qtV_qVYvX6_3Zg3251GV&index=2

image

image

No poner repuesta al modal

Si no pones nada que responda el bot en el modal submit se quedará un mensaje de "pensando" infinitamente en ephemeral, eso podría ponerse como en los Slash que despues de un tiempo da interacción fallida o algo Screenshot_2022-02-17-15-41-48-130_com.discord.jpg

Add a FAQ in the readme

It will be good to add a FAQ (frequent asked questions) apart on the readme because a lot of users have the same issues like "Interaction aknowledge", "Event modalSubmit on the command", "The client is not valid on this context", "The interaction is replied or defered". This will be fine because almost the half of the issues are that and It Will help the users reaching an answer faster than open an issue.

Why is not a deferUpdate method?

If we view de discord.js documentation there is a deferUpdate method to modal on the modalSubmit event why is not on discord modals package

showModal Error

    if (!(options.client instanceof Client)) throw new Error('INVALID_CLIENT');
                                                   ^

I got error

Error bash SHOW_MODAL_ERROR: An error occurred when showing a modal. DiscordAPIError: Interaction has already been acknowledged. at RequestHandler.execute (C:\Users\david\desktop\Cating\node_modules\discord.js\src\rest\RequestHandler.js:350:13) at runMicrotasks (<anonymous>) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async RequestHandler.push (C:\Users\david\desktop\Cating\node_modules\discord.js\src\rest\RequestHandler.js:51:14) at async showModal (C:\Users\david\desktop\Cating\node_modules\discord-modals\src\structures\ShowModal.js:31:9) { method: 'post', path: '/interactions/955051216927346748/aW50ZXJhY3Rpb246OTU1MDUxMjE2OTI3MzQ2NzQ4OmJuQU9mdlRscHMzRFpsN0VaS1NSM0lheUJObU5XN3pzeXVXZGtaRTkxUUZVVWdPcHF4TDlKMXVkSm8zakIyNGJjZ1ptSVZ3V3M5azVNMTRTZGlGVEI5N1FTZHl0SlN2MWd2VDFEN1hpQWtZajRYNWxDbk5WTlRPUFFVV1JBSFhT/callback', code: 40060, httpStatus: 400, requestData: { json: { type: 9, data: [Object] }, files: [] } }
and Code https://cdn.discordapp.com/attachments/900008888441667596/955058633417322577/unknown.png

Añadir evento cuando el modal se cancela

No sé si esto se podría añadir o si por otro lado no sé puede y tendríamos que esperar a que actualicen esto en la API pero si no es así podrías añadir un evento para cuando el modal se cancele llamado tipo modalCancel o algo por el estilo

Message cloning

I made a modal that after submitting, puts input text value into embedded message in specific channel. First submit is good, but when another comes out, it puts the old embed and the new embed (2 embeds) and every submit it just goes up by 1 one

`.setValue is not a function`

.setValue is not a function
Issue resolves when removing
image
this line (.setValue("value")), but you can't retrieve the data anymore.

Typescript compile error

Hey, I wanted to add modals to my Discord bot. My bot is written in Typescript and I get the following error when compiling.

Application still works fine though.

node_modules/discord-modals/index.d.ts:119:3 - error TS2416: 
Property 'type' in type 'ModalSubmitField'  is not assignable to the same property in base type 'BaseMessageComponent'.
  Type 'string' is not assignable to type '"ACTION_ROW" | "BUTTON" | "SELECT_MENU"'.

119   type: string;

[Collector Interaction] Interaction has already been acknowledged.

So I've tried to use the collector interaction like:

const msg = await interaction.followUp({ components: [row5], content: `Weird button just showed up!`, ephemeral: false })
const collector = msg.createMessageComponentCollector({ time: 90000 })

collector.on('collect', async (i) => {
    if(i.customId === 'trywordbtn') {
        showModal(modal, {
            client: client,
            interaction: i
        }) 
     }
})

The first time the command works fine, but the second time I use the command I get Discord API error with "interaction has been already acknowledged. Here's the modalSubmit event:

 client.on('modalSubmit', async (modal) => {
            if(modal.customId === 'wordleinput') {
                await modal.deferReply({ ephemeral: true }) // Error from here belongs...
                const firstResponse = modal.getTextInputValue('wordinput')

                if(firstResponse === randomWordg) {
                    await modal.followUp({ content: `Congrats 🥳 You guessed the word right, and it was \`${randomWordg}\``, ephemeral: true })
                    
                    await interaction.editReply({ content: `Good job! \`⍟Soon\` tokens has been added to your wallet.`, components: [deadraw] })

                } else if(trys === 4) {
                    await modal.followUp({ content: `You've 4 attempts to guess the word.`, ephemeral: true })

                    await interaction.editReply({ content: `Hmm... You should think more about it!`, components: [row5] })
                    trys = trys - 1

                } else if(trys === 3) {
                    await modal.followUp({ content: `\`3 of 4\` Attempts left.`, ephemeral: true })

                    await interaction.editReply({ content: `2 more attempts left, it's really easy!`, components: [row5] })

                } else if(trys === 2) {
                    await modal.followUp({ content: `\`2 of 4\` Attempts left.`, ephemeral: true })

                    await interaction.editReply({ content: `Really it's that much hard?!`, components: [row5] })
                } else if(trys === 1) {
                    await modal.followUp({ content: `\`1 of 4\` Attempts left.`, ephemeral: true })

                    await interaction.editReply({ content: `Common, think think!`, components: [row5] })
                } 
                
                if(trys === 0) {
                    await modal.followUp({ content: `Game end! You lost...`, ephemeral: true })

                    await interaction.editReply({ content: `You've ran out of attempts.. the word was \`${randomWordg}\``, components: [deadraw] })
                }
            }  
});

I am suffering this issue ages ago, idk what to do to solve it.. any solution??

More than 5 Components

It says I need 1 - 5 components, is there a way I can get more? I need about 7 or more.

Error:

SHOW_MODAL_ERROR: An error occurred when showing a modal. DiscordAPIError: Invalid Form Body
data.components: Must be between 1 and 5 in length.
    at RequestHandler.execute (/var/lib/pufferpanel/servers/1d8d04a2/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async RequestHandler.push (/var/lib/pufferpanel/servers/1d8d04a2/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
    at async showModal (/var/lib/pufferpanel/servers/1d8d04a2/node_modules/discord-modals/src/structures/ShowModal.js:49:9) {
  method: 'post',
  path: '/sorry/but/no',
  code: 50035,
  httpStatus: 400,
  requestData: { json: { type: 9, data: [Object] }, files: [] }
}

Code:

const { MessageEmbed, Formatters } = require('discord.js');

const { Modal, TextInputComponent, showModal } = require('discord-modals');

const fetch = require('node-fetch');
const db = require('quick.db');

module.exports = {
    category: 'Discord',
    description: 'Apply for The Damned Guild!',
    
    slash: true,
    testOnly: true,
    
    callback: async ({ client, interaction, args }) => {
        const modal = new Modal()
        .setCustomId('modal-apply')
        .setTitle('Guild Application')
        
          .addComponents([
           new TextInputComponent()
           .setCustomId('textinput-ign')
           .setLabel("➩ What's you Minecraft IGN?")
           .setStyle('SHORT')
           .setMinLength(4)
           .setMaxLength(10)
           .setRequired(true)
           .setPlaceholder('Example: Lvnnaa')
          ])
        
          .addComponents([
            new TextInputComponent()
            .setCustomId('textinput-age')
            .setLabel("➩ What's your age? (Requirement: 13+)")
            .setStyle('SHORT')
            .setMinLength(4)
            .setMaxLength(10)
            .setRequired(true)
            .setPlaceholder('You must be 13+')
          ])

          .addComponents([
            new TextInputComponent()
            .setCustomId('textinput-joindamned')
            .setLabel("➩ Why do you want to join The Damned?")
            .setStyle('SHORT')
            .setMinLength(4)
            .setMaxLength(10)
            .setRequired(true)
            .setPlaceholder('Example: I want join because _______.')
          ])

          .addComponents([
            new TextInputComponent()
            .setCustomId('textinput-guilds')
            .setLabel("➩ What guilds were you previously in?")
            .setStyle('SHORT')
            .setMinLength(4)
            .setMaxLength(10)
            .setRequired(true)
            .setPlaceholder("If you haven't just say no")
          ])

         .addComponents([
            new TextInputComponent()
            .setCustomId('textinput-callyou')
            .setLabel("➩ What would you like us to call you?")
            .setStyle('SHORT')
            .setMinLength(4)
            .setMaxLength(10)
            .setRequired(true)
            .setPlaceholder("Example: Luna")
         ])
          
        .addComponents([
             new TextInputComponent()
            .setCustomId('textinput-pronouns')
            .setLabel("➩ What are your pronouns?")
            .setStyle('SHORT')
            .setMinLength(4)
            .setMaxLength(10)
            .setRequired(true)
            .setPlaceholder("Example: they/them, he/him, she/her")
        ])
        
        .addComponents([
            new TextInputComponent()
            .setCustomId('textinput-main')
            .setLabel("➩ What do you mostly main on Hypixel?")
            .setStyle('SHORT')
            .setMinLength(4)
            .setMaxLength(10)
            .setRequired(true)
            .setPlaceholder("Example: Bedwars, Skyblock, Skywars")
        ])
        
          showModal(modal, {
            client: client,
            interaction: interaction
          });
      },
}

modalSubmit interaction member sometimes returns null

TypeError: Cannot read properties of null (reading 'user') -> at C:\Users\dddd\Desktop\ddd\index.ts:54:55

Line 54 is highlighted, only tries to print the member.user, returning null
image

Is there any fix to this? I need the member to not to be null on some modal submits, as it creates an embed after it with the user info.

Error when using modal

Hello!

I've been testing some commands using modals and every time I use the same command twice (and therefore the same modal opens) I get an error.

For example, if I run /modal and fill the modal, everything goes great but if after that I run /modal again and I fill the modal with the same text, the bot will crash with the error 'Interaction has already been acknowledged.'

Code: https://pastebin.com/APQftuwn
Error: https://pastebin.com/sc8FKJU1

discord-modals crashes on load, Package subpath ./v9 not defined

Im trying to use discord-modals for my big community bot but onto using it, it crashes the bot because it cannot find the "Package subpath './v9'" in the export

Full Error:

node:internal/modules/cjs/loader:488
      throw e;
      ^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './v9' is not defined by "exports" in /home/container/node_modules/discord-api-types/package.json
    at new NodeError (node:internal/errors:371:5)
    at throwExportsNotFound (node:internal/modules/esm/resolve:453:9)
    at packageExportsResolve (node:internal/modules/esm/resolve:731:3)
    at resolveExports (node:internal/modules/cjs/loader:482:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/container/node_modules/discord-modals/src/structures/Interaction.js:3:29) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Notices:
Bot runs on a DOCKER Container.
Discord.js Version: 13.6.0
discord-modals Verison: 1.3.5

Im ready to share more infomations if needed.

Defer a modal

Como puedo "defer" a modal más bien porque lo preguntaron. Hay alguna forma de poner modal.deferUpdate() en el modalSubmit

On modal submit interaction reply ephemeral

It's not possible to send an ephemeral on a modal reply when modalSubmit event is ran.

Code:

Client.on('modalSubmit', modal => {
   modal.reply({
      content: "Message sent, anonymously.",
      ephemeral: true,
   });
}

Is that a bug, or is it supposed to be like that?

How can i post the modal in the specific channel and close the modal ?

Hi! I want to post my modal in a special channel. Currently I'm doing this: modal.guild.channels.cache.get(config.modal).send({ embeds: [embed] }) but, my modal won't close and write "an error occurred . Try again." except that the modal sends well in my channel. Would you help me?

Support for json

Hey i know you created this like embeds with the way you build the modal.

But could support for json be added? so we can post a json array with all the options, think that would make it easyer to create dynamic forms.

So ex

const exampleModal = {
			type: 9,
			data: {
				title: 'LosKros Register',
				custom_id: 'register',
				components: [
					{
						type: 1,
						components: [
							{
								type: 4,
								custom_id: 'register',
								label: 'Some random label',
								style: 1,
								min_length: 2,
								max_length: 400,
								required : true,
							},
						],
					},
				],
			},
		},

showModalJSON(exampleModal , {
client: client,
interaction: interaction
})

Just an example the last part might be a better way to do it.

But would make life a lot easyer, creating modals, just using the json format as well.

Problem with slash-commands

Hey, I have a problem with a interaction between slash commands and this package,

I have the modalSubmit event inside my slash command and I make the modal outside of the command.
When someone uses the slash command, it opens the modal normally and all that but if they fill it out and cancel it, it "saves" itself somehow and when they use the slash command again and submit it this time, it will send the modal output twice (in my case an embed with the values). I'm not sure if I'm doing something wrong or if this is a problem inside the package? Any help is appreciated

Managed to fix it; apparently it was my own dumbness all the time, never have the modalSubmit inside a command...

Feature Request: implement modal.update

You can use interaction.update({content: "helo", components: []}) with discord.js's buttons to edit the original message, but this function does not seem to exist for the modal argument in client.on('modalSubmit',...). Will it be implemented one day?

modalSubmit event doesn't work

Hello, i have a problem with the Modal Event...

When i submit some modal like that :

image

but in my event manager, i have this code :

const { Client, Intents } = require("discord.js")
const { readdirSync } = require("fs");
const discordModals = require('discord-modals')

global["client"] = new Client({
  intents: 32767,
  partials: ["CHANNEL"],
  fetchAllMembers: true,
  allowedMentions: { repliedUser: false },
  retryLimit: 5,
  invalidRequestWarningInterval: 10
});
discordModals(client);
client.prefix = ".";

client.on('modalSubmit', (modal) => {
  if(modal.customId === 'modal-customid'){
    const firstResponse = modal.getTextInputValue('textinput-customid')
    modal.reply('Congrats! Powered by discord-modals.' + `\`\`\`${firstResponse}\`\`\``)
  }  
})

Can someone know why the event didn't response ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.