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

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

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 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!