I wanna send the suggestion to a channel with two reaction then if the admin reacted ✅ send it to another channel and if ❌ delete it.
I tried this but first it can't send embed it says Cannot read properties of undefined (reading 'discord') and I tried without embed and I used reactions but doesn't work
Code:
module.exports = {
name: "suggest",
category: "Suggestion",
description: "suggest something",
usage: "suggest [text]",
owner: false,
execute(message, args, client) {
message.reply({ content: "..." }).then(async(msg) => {
const sug = args[0];
const suggestion = args.join(" ");
if (!sug) {
message.delete();
msg.edit({
content: `[ You did not provide a suggestion ]`,
})
} else {
const acceptch = message.guild.channels.cache.get('980126282719313970');
if (err) {
message.delete();
msg.edit({
content: `[ ${err} ]`,
})
} else {
const embed = new client.discord.MessageEmbed()
.setColor('0b9494')
.setAuthor(message.author.tag, message.author.displayAvatarURL())
.setDescription(suggestion)
acceptch.send(embed)
.then(msg => {
msg.react('✅').then(() => msg.react('❌'));
msg.awaitReactions((reaction, user) => user.id == '746917945065865376' && (reaction.emoji.name == '✅' || reaction.emoji.name == '❌'), { max: 1, time: 60000, errors: ['time'] })
.then(collected => {
const reaction = collected.first();
if (reaction.emoji.name === '❌') {
return message.author.send('**no**')
}
if (reaction.emoji.name === '✅') {
message.channel.send(`suggestion: ${suggestion}`)
}
});
}).catch(console.error);
}
}
})
}
}
If you check the discord.js documentation for "Client" class, there is no such thing as client.discord.
Which is why this line const embed = new client.discord.MessageEmbed() from your code throws error, because your are trying to access property "MessageEmbed" of object that is undefined.
You can add const { MessageEmbed } = require('discord.js') at the beginning of that file and then just use const embed = new MessageEmbed().