accept.js (1556B)
1 const { EmbedBuilder } = require("discord.js"); 2 module.exports = { 3 name: "accept", 4 category: "Owner", 5 usage: "(Message)", 6 description: "Accept a suggestion", 7 Owner: true, 8 options: [ 9 { 10 type: 3, 11 name: "messageid", 12 description: "The message ID to accept", 13 required: true, 14 }, 15 { 16 type: 3, 17 name: "query", 18 description: "The accept query", 19 required: false, 20 }, 21 ], 22 run: async (client, interaction, args) => { 23 const MessageID = args[0]; 24 const acceptQuery = 25 args.slice(1).join(" ") || `They didn't leave any message.`; 26 try { 27 const suggestionChannel = interaction.guild.channels.cache.get( 28 client.config.Report 29 ); 30 const suggestEmbed = await suggestionChannel.messages.fetch(MessageID); 31 const data = suggestEmbed.embeds[0]; 32 const acceptEmbed = new EmbedBuilder() 33 .setAuthor(data.author.name, data.author.iconURL) 34 .setDescription(data.description) 35 .setColor("Green") 36 .addField("**Status(ACCEPTED)**", acceptQuery); 37 suggestEmbed.edit({ embeds: [acceptEmbed] }); 38 const user = await client.users.cache.find( 39 u => u.tag === data.author.name 40 ); 41 interaction.followUp({ 42 content: "<a:nyx_checkmark:897240322411724841> Suggestion Accepted", 43 }); 44 user.send({ embeds: [acceptEmbed] }); 45 } catch (e) { 46 interaction.followUp({ content: "That suggestion doesn't exist" }); 47 console.log(e); 48 } 49 }, 50 };