Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

219
Vistas
How to make `CommandInteraction.reply()` return a `Message` using the discord API

I have the following (typescript) code snippet that generates an embed in response to an interaction, and sends it:

const embed = await this.generateEmbed(...);
await interaction.reply({embeds: [embed]});
const sentMessage: Message = <Message<boolean>> await interaction.fetchReply();
await sentMessage.react('⬅');

However, this fails at runtime because TypeError: sentMessage.react is not a function.

This is somewhat explained in the discord.js docs:

Returns the raw message data if the webhook was instantiated as a WebhookClient or if the channel is uncached, otherwise a Message will be returned

However, this happens even if I cache everything:

const bot = new Client({
    makeCache: Options.cacheEverything(),
    ...
});

Also note that I'm not using a WebhookClient here.

Why is CommandInteraction.reply() returning a raw message here, and how can I make it return a full Message object, so that I can use the .react() method?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I've done quite a bit of testing and I've come to the conclusion that this is happening because you're not requesting the GUILDS intent. I'm assuming that without the GUILDS intent, the GuildChannel cannot be cached, nor the Message, so it returns the raw data from the API.

const { Client, Intents } = require('discord.js');

const bot = new Client({
    intents: [Intents.FLAGS.GUILDS],
    ...
})
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda