#Why embed doesn't work

9 messages · Page 1 of 1 (latest)

teal smeltBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
prime egret
#


    try {
      const messages = await interaction.channel.messages.fetch({ limit: amount });
      const deletedMessages = await interaction.channel.bulkDelete(messages, true);

      const logChannel = interaction.guild.channels.cache.find(channel => channel.id === '1193939287188701205');
      if (logChannel) {
        const logEmbed = new EmbedBuilder()
          .setColor('#0099FF')
          .setTitle('Произошла очистка чата 🧹')
          .setDescription(`Администратор 👮‍♂️: ${interaction.user.tag}`)
          .addField('Дата', new Date().toLocaleString(), true)
          .addField('Удалено сообщений', deletedMessages.size, true);

        await logChannel.send({ embeds: [logEmbed] });
      }
#
Error clearing messages: TypeError: (intermediate value).setColor(...).setTitle(...).setDescription(...).addField is not a function
    at Object.execute (D:\discordmdr\moderator\clear.js:42:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Client.<anonymous> (D:\discordmdr\index.js:92:5)```
versed gorge
#

addFields, and this is not a /voice issue. Also what djs version are you on? And use cache.get(id) instead of find

prime egret
#

What's wrong with them?

#

oh

prime egret
versed gorge
#

Then you need to pass fields as {name:.., value:…, inline:…} objects, not three parameters