const { SlashCommandBuilder, EmbedBuilder, ActionRowBuilder, Events, ModalBuilder, TextInputBuilder, TextInputStyle } = require('discord.js'); const client = require('../Constants/Client.js'); module.exports = { data: new SlashCommandBuilder() .setName('modal') .setDescription('modal'), async execute(interaction) { const filter = (interaction) => interaction.customId === 'PatrolLog'; const PatrolModal = new ModalBuilder() .setCustomId('PatrolLog') .setTitle('Patrol Log'); const StartTime = new TextInputBuilder() .setCustomId('StartTime') .setLabel("Start Time") .setStyle(TextInputStyle.Short) .setPlaceholder('HH:MM') .setRequired(true); const EndTime = new TextInputBuilder() .setCustomId('EndTime') .setLabel("End Time") .setStyle(TextInputStyle.Short) .setPlaceholder('HH:MM') .setRequired(true); const StartProof = new TextInputBuilder() .setCustomId('StartProof') .setLabel("Start Proof") .setStyle(TextInputStyle.Short) .setPlaceholder('Must be a link') .setRequired(true); const EndProof = new TextInputBuilder() .setCustomId('EndProof') .setLabel("End Proof") .setStyle(TextInputStyle.Short) .setPlaceholder('Must be a link') .setRequired(true); const TotalTime = new TextInputBuilder() .setCustomId('TotalTime') .setLabel("Totoal Time of Patrol") .setStyle(TextInputStyle.Short) .setPlaceholder('Ex: 1 hour 5 minutes') .setRequired(true); const StartTimeMsg = new ActionRowBuilder().addComponents(StartTime); const EndTimeMsg = new ActionRowBuilder().addComponents(EndTime); const StartProofMsg = new ActionRowBuilder().addComponents(StartProof); const EndProofMsg = new ActionRowBuilder().addComponents(EndProof); const TotalTimeMsg = new ActionRowBuilder().addComponents(TotalTime); const ApproveChl = client.channels.cache.get('1034095095261184040'); PatrolModal.addComponents(StartTimeMsg, StartProofMsg, EndTimeMsg, EndProofMsg, TotalTimeMsg); await interaction.showModal(PatrolModal); const PendingEmbed = new EmbedBuilder() .setColor(0x0099FF) .setTitle('Patrol Log Submission') .setDescription(`${StartTimeInput}`) .setThumbnail('https://cdn.discordapp.com/attachments/925850735697068042/1039891607568273428/USAF.png') .setTimestamp() .setFooter({ text: 'Bot made by AmNobCop' }); interaction.awaitModalSubmit({ filter, time: 8.64e+7 }) .then(async interaction => { const StartTimeInput = interaction.fields.getTextInputValue(StartTime); const EndTimeInput = interaction.fields.getTextInputValue(EndTime); const StartProofInput = interaction.fields.getTextInputValue(StartProof); const EndProofInput = interaction.fields.getTextInputValue(EndProof); const TotalTimeInput = interaction.fields.getTextInputValue(TotalTime); await interaction.FollowUp(`${interaction.user.tag}, your patrol log has been submitted. You will get a notice in your Direct Messages on the status of your log.`), await ApproveChl.send({ embeds: [PendingEmbed] }) }) .catch(console.error); }};