client.on(Events.InteractionCreate, async interaction => { if (!interaction.isModalSubmit()) return; // Get the data entered by the user const Name = interaction.fields.getTextInputValue('YourName'); const Age = interaction.fields.getTextInputValue('YourAge'); const InteractionHours = interaction.fields.getTextInputValue('interactionHours'); const ServiceProvided = interaction.fields.getTextInputValue('ServiceProvided'); const AcceptedOption = interaction.fields.getTextInputValue('AcceptedOption'); console.log({ Name, Age, InteractionHours, ServiceProvided, AcceptedOption }); interaction.reply({ content: 'تم التسليم!', ephemeral: true }) const manager_data = ` الاسم: ${Name} العمر: ${Age} مدة التفاعل بالساعات: ${InteractionHours} الخدمات التي يقدمها: ${ServiceProvided} هل يتوقع قبوله: ${AcceptedOption} `; const ManageEmbed = await new EmbedBuilder() .setColor(0x0099FF) .setTitle(Name) .setURL('https://discord.js.org/') .setAuthor({ name: interaction.user.tag, iconURL: interaction.user.avatarURL({ dynamic:true }), url: 'https://discord.js.org' }) .setDescription(ServiceProvided) .setThumbnail(interaction.user.avatarURL({ dynamic:true })) .addFields( { name: 'الاسم', value: Name }, { name: '\u200B', value: '\u200B' }, { name: 'العمر', value: Age, inline: true }, { name: "ساعات الخدمة/التفاعل", value: InteractionHours, inline: true }, { name: "توقعه عن قبوله", value: AcceptedOption, inline: true }, ) //.addFields({ name: 'Inline field title', value: 'Some value here', inline: true }) .setImage('https://cdn.discordapp.com/icons/1060487682557497414/f724a92a92b19bcf6d833bc32b087f92.webp?size=240') .setTimestamp() .setFooter({ text: 'Developer: Logic_Tubes', iconURL: 'https://i.imgur.com/AfFp7pu.png' }); //channel.send({ embeds: [exampleEmbed] }); create_post_as_ticket("1180033323704258590", manager_data, interaction.user, ManageEmbed) }); client.on(Events.InteractionCreate, async interaction => { if(!interaction.isCommand()) return; if(interaction.commandName === 'accept') { //console.log(interaction.channel) //console.log(interaction.channel.name.slice(35)) //const role = interaction.options.getRole('Trail'); const guild = client.guilds.cache.get('1060487682557497414'); //const role = guild.roles.find("name", "Trail"); const role = interaction.guild.roles.cache.find(r => r.name === "Trail") console.log(interaction.channel.name.slice(35)) console.log(role) const userId = interaction.channel.name.slice(8,-1); guild.members.addRole({userId, role}); const user = guild.members.cache.get(interaction.channel.name.slice(8,-1)); console.log("klkl", user.roles) const member = interaction.options.getMember(interaction.channel.name.slice(35)); // logictubes_boss member.roles.add(role); } else if(interaction.commandName === 'decline') { const role = interaction.options.getRole('Trail'); const user = interaction.options.getMember(interaction.channel.name.slice(35)) user.roles.remove(role); } }); function create_post_as_ticket(channel_id, manager_data, user, embed) { const channel = client.channels.cache.get(channel_id); channel.threads.create({ name: `User: ${user}, Tag: ${user.id}`, message: { /*content: manager_data,*/ embeds: [embed] } }); }