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

183
Vistas
Does fetching embeds through messages from msg.reference.messageID not work?

I am coding a discord bot, and I am trying to get the content of embeds through the command user replying to the message and using a prefix. When I try running the command, it says that fetchedMsg.embeds[0] isn't a thing. Is there anything wrong with my code?

if (msg.reference) {
    const fetchedMsg = await msg.channel.messages.fetch(msg.reference.messageID)
    console.log(fetchedMsg)
    console.log(fetchedMsg.embeds[0])
}

The error is on the line console.log(fetchedMsg.embeds[0]), and looking at the log from the code before it includes embeds: [ [MessageEmbed] ],.

The error reads TypeError: Cannot read properties of undefined (reading '0'), and when I remove the [0], it's undefined. This whole thing is in a module.exports.run, if that helps.

module.exports.run = async (client, msg, args) => {
    const { MessageActionRow, MessageButton, MessageEmbed } = require('discord.js');
        if (args.length === 5) {
        if (msg.reference) {
            const fetchedMsg = await msg.channel.messages.fetch(await msg.reference.messageID)
            console.log(fetchedMsg)
            console.log(fetchedMsg.embeds[0])
        } 
//do things with fetchedMsg
about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

You can get the MessageEmbed() same as normal Message using:

const messages = args[0]
        if(!messages) return message.reply("Provide an ID for message.")
        if(isNaN(messages)) return message.reply("Message ID should be 
number, not a letter")

        message.channel.messages.fetch(`${messages}`)
        .then(msg => {
            console.log(msg.content) || console.log(msg.embeds)
        })

You can find more here about fetching a message

about 4 years ago · Santiago Gelvez 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