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

175
Vistas
Discord.js - If i have an array where a random option is chosen, is there a way to send a gif matching this option?

So, i have the following code:

var jobs = [
    'lawyer',
    'hitman',
    'gardener',
    'cashier'
]
var thumbnails = [
    "https://c.tenor.com/DP615vqUzeAAAAAC/ace-attorney-phoenix-wright.gif",
    "https://i.ytimg.com/vi/6nzyIHz5bb0/hqdefault.jpg",
    "https://c.tenor.com/vzSw7IoYMdYAAAAM/lifehack-hose.gif",
    "https://c.tenor.com/eYUWlNN0Fw4AAAAM/thisisalecx-cashier.gif"
]
let job = jobs[Math.floor(Math.random() * jobs.length)]

This chooses a random option out of the "jobs" array. And i have the list with the embed thumbnails i want to use. Now if it sends a random job from the array, is there a way to send one of the gifs that is matching this job? Any help is appreciated!

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

0

Use this:

var jobs = [
    'lawyer',
    'hitman',
    'gardener',
    'cashier'
]
var thumbnails = [
    "https://c.tenor.com/DP615vqUzeAAAAAC/ace-attorney-phoenix-wright.gif",
    "https://i.ytimg.com/vi/6nzyIHz5bb0/hqdefault.jpg",
    "https://c.tenor.com/vzSw7IoYMdYAAAAM/lifehack-hose.gif",
    "https://c.tenor.com/eYUWlNN0Fw4AAAAM/thisisalecx-cashier.gif"
]
let index = Math.floor(Math.random() * jobs.length)
let job = jobs[index]
let image = thumbnails[index]
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