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

289
Vistas
How to set random colour in a discord.js embed

I have a discord bot and it works perfectly. My objective is that when I send the >help message, the bot chooses a random colour for the embed and sends it.

This is the configuration file for my bot called config.json

{
  "token": "Token Here",
  "prefix": ">",
  "genChannel": "channel id",
  "genCooldown": "1000",
  "color": {
      "green": "0x57F287",
      "yellow": "0xFEE75C",
      "red": "0xED4245",
      "default": "0x5865F2"
  },
  "command": {
      "notfound_message": true,
      "error_message": true
  }
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

In discord.js, you can pass a colour argument as a string. More on that in: discord.js docs on embed colour. To use a random colour, you may use the following:

{
//...
    "color": {
        "green": "0x57F287",
        "yellow": "0xFEE75C",
        "red": "0xED4245",
        "default": "0x5865F2",
        "random": "RANDOM"
    },
//...
}

You parse it into the embed just like any other embed colour hex or RGB array. It's a good idea to check out on the docs and guide.

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