Using JSON is a simple and easy way to pretty much link an item to another. This snippet is triggered with !json and it ill pick a random number then put an image of that number in the embed.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
/*
JSON can be really useful, this snippet is an example of how you can use JSON to:
Pick a random number them get an image to go with that number
*/
//Gets a number from 1-3
let number = Math.floor(Math.random() * 3) + 1;
//The JSON part
let json = {
//It pretty much puts 2 items together linked
1 : 'https://cdn.discordapp.com/attachments/931429162659495987/941572364632719410/UfgDbG8zF85LRN4AAAAASUVORK5CYII.png',
2 : 'https://cdn.discordapp.com/attachments/931429162659495987/941572448434941972/VXzaffBLV4s0UQRBqxX81Rlb0LUyoaQAAAABJRU5ErkJggg.png',
3 : 'https://cdn.discordapp.com/attachments/931429162659495987/941572546455801866/nCR9N40ROjj4D9TfZshOaHJ9AAAAAElFTkSuQmCC.png',
};
//Simply put, it says if the number variable matches one of the items inside of the JSON variable then it will get the image linked to the number
let final = json[number];
await lib.discord.channels['@0.3.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: ``,
embeds: [
{
title: `Number is ${number}`,
image: {url: `${final}`},
},
],
});