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

184
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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