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

166
Vistas
Can I save information in message requests with Discord API?

I tried to send messages like this

client.api.channels(msg.channel.id).messages.post({
  data: {
    content: 'content',
    test: 'test'
  }
})

I was hoping that since it’s an API post request, it would save the test property.

const msgs = await client.api.channels(msg.channel.id).messages.get();
msg.channel.send(msgs[1].test) //error: cannot send an empty message

Changing .test to .content does send the content of the message the bot sent originally, but .test outputs undefined. Maybe I need to use node-fetch or https so it posts and gets directly?

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

0

You are sending the test property to the Discord API via a post request, but that doesn't mean Discord API will store that property to its database. It only cares about the data it knows and the rest gets dropped. All properties Discord stores about a message are listed here.

Discord API doesn't allow you to store arbitrary data inside of a message object.

Of course you could search for workarounds, like storing the data inside of an embed's color (if they are short enough) or an image, etc. I don't think that is a good solution to this problem, but depends on what you want to accomplish.

What you could do is to store the custom data yourself. Create some kind of middleware, that will send a message to the Discord API, retrieve the message object of the newly created message. And associate its id with your custom data and store it somewhere (e.g. your database, JSON file, etc.)

Later you can use a message's id to access your custom data.

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