'Problem with random embed messages discord.js

I am trying to do a command with random embeds, but when I trigger the command. It always sends the same option, and if I reload the bot, it's gonna choose a new option, but it will stay the same till I reload.

The "vars" at the top of my code:

var facts = ["Item1", "Item2", "Item 3", "Item 4" ];
var fact = Math.floor(Math.random() * facts.length);

The command:

    if (message.content.startsWith (prefix + "random")){
      var embed = new Discord.MessageEmbed()
          .setTitle(":dvd: Sup stack overflow")
          .setDescription(facts[fact])
          .setColor("#f5980c")
          .addField(invisible, field)
          .setFooter(footer)
      message.channel.send(embed)
      console.log(`📀 ${message.author.tag} used saraiaiai`)
      
    }


Solution 1:[1]

You need to generate a new value for fact every time you receive the message:

if (message.content.startsWith (prefix + "random")){
    // notice this is here now
    var fact = Math.floor(Math.random() * facts.length);
    var embed = new Discord.MessageEmbed()
      .setTitle(":dvd: Sup stack overflow")
      .setDescription(facts[fact])
      .setColor("#f5980c")
      .addField(invisible, field)
      .setFooter(footer)
  message.channel.send(embed)
  console.log(`? ${message.author.tag} used saraiaiai`)   
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aplet123