Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.3K
Visualizações
TypeError [INVALID_TYPE]: Supplied data.type is not a valid MessageComponentType - Discord.js

hey im trying to make a slashCommand that generate random pics with button..

so when a user use the command it will sent an embed with button and then the button when a user clicked that, the embed will edited and load another picture

but It seems i was doing it wrong..

Node: v17.7.2

Discord.js: 13.2.0

here is my code

const { MessageEmbed, MessageActionRow, MessageButton } = require('discord.js');
const superagent = require('superagent');
const ee = require("../../config.json");

module.exports = {
        name: 'waifu',
        description: 'Give you a random anime waifus pics',
    run: async (client, interaction, args) => {
      let { body } = await superagent.get(`https://api.waifu.pics/sfw/waifu`);
      const msg = await interaction.followUp({
        embeds: [
          new MessageEmbed()
          .setColor(ee.color)
          .setTitle("Waifu 😳")
          .setImage(body.url)
          .setTimestamp()
        ],
        components: [
          new MessageActionRow()
          .addComponents(
            new MessageButton()
            .setCustomId('nextWaifu')
            .setLabel('More Waifu')
            .setStyle('SUCCESS')
          )
        ],
        fetchReply: true
      });
      let embed = msg.embeds
      embed.color = ee.color;
      embed.image = body.url;

      let components = msg.components
      
       return msg.edit({ embeds: [embed], components: [components], fetchReply: true });
    }
}
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda