So I'm making a discord bot in node.js and I'm using discord.js library for this. I want when someone types [p]catgif it sends a random image from a local folder. I'm trying to make it so it picks a random number from 1 to 100 or something like that and then it looks in a folder and selects that image with that number like if the number was 1 it would look for 1.png in that folder. How do i get the number it has picked to be the image i have learned how to generate numbers but not how to combine it with sending an image/attachments i know both but now how to combine the two
I've looked on discord.js docs but mainly only found how to attach one image or website. I've tried the code below to see if that work but it had little success only lots of errors. I've look on here but only found one that was similar the only problem with that one is its in python and i'm using node.
const {token, prefix} = require('./setting.json');
client.on('message', message => {
if (message.content === prefix + 'catgid') {
const attachment = new Attachment(f'./${random 1-10}.png');
message.channel.send(`${message.author},`, attachment);
}
});