const { SlashCommandBuilder} = require("discord.js"); const Schema = require('../../Schema/qualitySchema'); module.exports = { data: new SlashCommandBuilder() .setName('qualitycontrol') .setDescription('Perform quality control check') .addStringOption(option => option.setName('image') .setDescription('Image URL') .setRequired(true) ) .addUserOption(option => option.setName('ping') .setDescription('User to ping') .setRequired(true) ), async execute(interaction) { const image = interaction.options.getString('image'); const pingUser = interaction.options.getUser('ping'); // Send the image to the channel with ping await interaction.reply({ content: `${pingUser}, please review this image: ${image}`, ephemeral: true }); // Wait for the user's response const filter = response => response.author.id === pingUser.id; const collector = interaction.channel.createMessageCollector({ filter, time: 60000 }); collector.on('collect', async response => { const content = response.content.toLowerCase(); if (content === 'accepted') { // Send the accepted image in DM await pingUser.send(`Your image has been accepted: ${image}`); } else if (content === 'denied') { // Send the denied image in DM await pingUser.send(`Your image has been denied: ${image}`); } else { // Invalid response, send error message await interaction.followUp('Invalid response. Please reply with "accepted" or "denied".'); } // Stop the collector collector.stop(); }); collector.on('end', collected => { if (collected.size === 0) { // No response received, send timeout message interaction.followUp('Quality control check timed out.'); } }); }, };