Hello.
I coded a simple MessageEmbed function (with Discord.JS) and every time that I call it, the new embed that is sent in the channel has his field who adds up with the precedent (e.g.: if the embed should have 2 fields, the next time that the command will be called it will have 2*2 the required fields. If you call it again, 3*2, 4*2, etc.).
When I restart the bot it reset. I tried to reset the embed value but it didn't affect the problem. Could you help me please ?
Here is my JS command :
module.exports = {
name: 'drive',
execute(client, message, args, embed) {
message.channel.send(embed
.setColor('#0099ff')
.setTitle('abcdedfg')
.setDescription('abcdedfg \n\u200B')
.setThumbnail('abcdedfg')
.addFields(
{ name: 'abcdedfg :', value: 'link' },
{ name: 'abcdedfg :', value: 'link \n\u200B' },
)
.setFooter('abcdedfg'))
.catch(console.error);
}
}
And here is my main if needed :
const fs = require('fs');
const { Client, Collection, MessageEmbed } = require('discord.js');
const { TOKEN, PREFIX } = require('./config/config');
const client = new Client();
client.commands = new Collection();
const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));
const embed = new MessageEmbed();
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
}
client.on('message', message => {
if (!message.content.startsWith(PREFIX) || message.author.bot) return;
const args = message.content.slice(PREFIX.length).split(/ +/);
const command = args.shift().toLowerCase();
if (!client.commands.has(command)) return;
client.commands.get(command).execute(client, message, args, embed);
});
client.login(TOKEN);