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

176
Views
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 answers
Answer question

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 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!