So I have this code:
const Discord = require("discord.js");
const bot = new Discord.Client();
const rf = require("select-random-file");
const token = "{DATA REVOKED}";
const prefix = "bot:"
const dir = './RandomImage'
function ranIm(){
    rf(dir, (err, file) => {
        console.log(`The random file is: ${file}.`)
        return file;
    }) 
   
}
bot.on('ready', () =>{
    bot.user.setStatus("Online");
    bot.user.setActivity('with '+bot.guilds.cache.size+" servers!");
    console.log("{BOT INITIALISED} PREFIX IS "+prefix)
})
bot.on("message", msg=>{
    let contentDown =msg.content.toLowerCase();
    let args = contentDown.substring(prefix.length).split(" ");
    if(contentDown.substring(0,prefix.length)===prefix){
        switch(args[0]){
            case 'random':
                console.log(ranIm());
                msg.channel.send("Here is your image: <3", { files:["./RandomImage/"+ranIm()]}).then(() => {
                    msg.react("✅")}, err => {console.log("Error [random]"); msg.react("❌") });          
                break;
        }
    }
})
bot.login(token); 
    