Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

213
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!