In my TypeScript code snippet, I am generating an embed in response to user interaction and sending it. Here is the code:
const embed = await this.generateEmbed(...);
await interaction.reply({embeds: [embed]});
const sentMessage: Message = <Message<boolean>> await interaction.fetchReply();
await sentMessage.react('⬅');
However, when running this code, I encounter a runtime error stating that
TypeError: sentMessage.react is not a function
.
The discord.js documentation provides some insight into this issue, which can be found here:
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
Even though I have cached everything as shown here:
const bot = new Client({
makeCache: Options.cacheEverything(),
...
});
I am still facing the issue mentioned above. Additionally, it's important to note that I am not using a WebhookClient
.
I would like to understand why CommandInteraction.reply()
is returning a raw message instead of a complete Message
object, and how I can modify it so that I can utilize the .react()
method effectively.