jeudi 21 avril 2022

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!




Aucun commentaire:

Enregistrer un commentaire