Node.js: كود فورم



        const {
            MessageEmbed,
            permissionOverwrites,
            MessageSelectMenu,
            TextInputComponent,
            MessageButton,
            MessageActionRow,
            Modal,
            Permissions
          } = require("discord.js");

          
        const prefix = `+`


        client.on("messageCreate" , async message => {
            if (message.content.startsWith(prefix + "form")) {
          

           
                const but= new MessageButton()
                .setCustomId('form')
                  
                .setLabel('اضغط لاضافة التوكن والبريفكس')
                .setStyle('SUCCESS')
                .setEmoji('🚁')
                const rowwqd = new MessageActionRow()
                 .addComponents(but)
          
          
          await message.channel.send({content :`please click on button to open form `  , components : [rowwqd]})
          
          
            }
          })

          client.on('interactionCreate', async interaction => {
            if (!interaction.isButton()) return
            if (interaction.customId === 'form') {
                try{
              const modal = new Modal()
                .setCustomId('myModal')
                .setTitle('My Modal');
              const op1 = new TextInputComponent()
                .setCustomId('section1')
                // The label is the prompt the user sees for this input
                .setLabel("change it")
                // Short means only a single line of text
                .setStyle('SHORT');
              const op2 = new TextInputComponent()
                .setCustomId('section2')
                .setLabel("change it")
                // Paragraph means multiple lines of text.
                .setStyle('SHORT');
              // An action row only holds one text input,
              // so you need one action row per text input.
              const firstActionRow = new MessageActionRow().addComponents(op1);
              const secondActionRow = new MessageActionRow().addComponents(op2);
              // Add inputs to the modal
              modalau.addComponents(firstActionRow, secondActionRow);
              // Show the modal to the user
              await interaction.showModal(modal);
                }catch (error) {
                console.error(error);
                interaction.reply('There was an error');
              }
            }
          })
          
          client.on('interactionCreate', async (interaction) => {
            if (!interaction.isModalSubmit()) return;
          
            if (interaction.customId === 'myModal') {
            
            
              // Get the data entered by the user
              const op1 = interaction.fields.getTextInputValue('section1');
              const op2 = interaction.fields.getTextInputValue('section2');
          
            
              await interaction.reply({content : `first section : ${op1}  and second section : ${op2}`})
             
            }
        })          
        
    
Code copied! 🎉