vendredi 5 mars 2021

How do I get my discord bot to send a random meme/picture

How do I get my bot to send a random picture/meme in discord. I'm using discord.js and this is as far as I got.

  if (msg.content === '-meme');
  var randommeme = ({files:["https://cdn.discordapp.com/attachments/757397429107556422/757524795452686426/GBoat_Watermark.png"]} , {files:["https://cdn.discordapp.com/attachments/815040456244985947/816225078969892864/A_good_fluffy_goat.png"]});
  var fact = Math.floor(Math.random() * randommeme.length); 
  msg.channel.send('goat meme', randommeme[fact]);
});

This should send a random picture but when I run the command it only says "goat meme". I tried this code before and it worked.

client.on('message', msg => {
  if (msg.content === '+meme') {
  msg.channel.send("This is a good fluffy goat", {files: ["https://cdn.discordapp.com/attachments/757397429107556422/816234172737126430/A_good_fluffy_goat.png","https://cdn.discordapp.com/attachments/757397429107556422/757524795452686426/GBoat_Watermark.png"]});
  }
});

I really don't know what Im doing wrong here?




Aucun commentaire:

Enregistrer un commentaire