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

577
Vistas
How to get the content of a pinned message discord.js

I am making a Discord bot in discord.js and I want to get the content of a pinned message.

I know I can use interaction.channel.messages.fetchPinned().then(pinnedMessages => /* do stuf */ ); to fetch the messages. But if you try to print out the value of pinnedMessages.content it will return undefined.

The type of pinnedMessages is an object, but I do not know how I can get the contents of it.

So, how do I do this?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

fetchPinned returns a collection of messages. There are a couple of methods you can use, depending on your needs.

To get the content of the first pinned message, you can use:

let messages = await interaction.channel.messages.fetchPinned()
let firstMessage = messages.first()

console.log(firstMessage.content)

To get a pinned message by its ID:

let messages = await interaction.channel.messages.fetchPinned()
let messageById = messages.get('MESSAGE ID HERE')

console.log(messageById.content)

If you want to log all pinned messages' content:

let messages = await interaction.channel.messages.fetchPinned()

messages.forEach(msg => {
  console.log(msg.content)
})
about 4 years ago · Juan Pablo Isaza 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