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

192
Views
¿No funciona la obtención de incrustaciones a través de mensajes de msg.reference.messageID?

Estoy codificando un bot de discordia y estoy tratando de obtener el contenido de las incrustaciones a través del comando que el usuario responde al mensaje y usa un prefijo. Cuando intento ejecutar el comando, dice que fetchedMsg.embeds[0] no existe. ¿Hay algo mal con mi código?

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

El error está en la línea console.log(fetchedMsg.embeds[0]) , y mirando el registro del código antes de que incluya embeds: [ [MessageEmbed] ], .

El error dice TypeError: Cannot read properties of undefined (reading '0') , y cuando elimino el [0] , no está definido. Todo esto está en un module.exports.run , si eso ayuda.

 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

Puede obtener MessageEmbed() igual que el Message normal usando:

 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) })

Puede encontrar más información aquí sobre cómo obtener un mensaje

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!