简体   繁体   中英

how to send gifs in a RichEmbed/MessageEmberd

in my code when I try to put gifs, it runs correctly and works ideally until the gif I select at random doesn't load

module.exports = {
  name: "slap",
  description: "da un golpe a un usuario",
  execute(message, args) {
    let userm = message.mentions.users.first();
    const user = message.author;
    const gif = [
      "https://tenor.com/view/mm-emu-emu-anime-slap-strong-gif-7958720",
      "https://tenor.com/view/slap-butts-anime-hit-gif-14179582",
      "https://tenor.com/view/ass-ass-slap-anime-put-that-ass-away-uzaki-chan-wants-to-hang-out-gif-17851886",
      "https://tenor.com/view/hit-hitting-slap-ow-ouch-gif-5497551",
      "https://tenor.com/view/anime-boy-bitch-slap-daily-lives-of-high-school-boys-gif-16649188",
      "https://tenor.com/view/powerful-head-slap-anime-death-tragic-gif-14358509",
      "https://tenor.com/view/oreimo-gif-10937039",
      "https://tenor.com/view/overlord-narberal-gamma-anime-slap-gif-18080646",
      "https://tenor.com/view/anime-slap-gif-10426943",
      "https://tenor.com/view/seiya-cautious-hero-funny-slap-anime-gif-15631717",
      "https://tenor.com/view/bunny-girl-slap-angry-girlfriend-anime-gif-15144612",
      "https://tenor.com/view/anime-manga-japanese-anime-japanese-manga-toradora-gif-5373994",
      "https://tenor.com/view/slap-bakaramon-confused-gif-14866419",
      "https://tenor.com/view/konosuba-megumin-yunyun-anime-slap-gif-17555205",
      "https://tenor.com/view/asobi-asobase-slap-anime-gif-17190309",
      "https://tenor.com/view/slap-anime-gif-9955713",
    ];
    message.replytext = Math.floor(Math.random() * gif.length + 0);
    if (!userm) {
      const accion2 = [", te dare esto para cumplir tus deseos, masoquista"];
      message.unaper = Math.floor(Math.random() * accion2.length + 0);

      const embed = new Discord.MessageEmbed()
        .addField(user.username + accion2[message.unaper])

        .setImage(gif[message.replytext])
        .setColor("RANDOM");
      message.channel.send({ embed });
    }
    const accion = [
      " le dio una abofeteada a ",
      " abofeteo a ",
      " dio una dolorosa abofeteada a ",
      " abofeteo fuertemente a ",
      " sintio la necesidad de abofetear a ",
    ];
    message.dosper = Math.floor(Math.random() * accion.length + 0);

    const embed = new Discord.MessageEmbed()
      .setAuthor(
        user.username + accion[message.dosper] + userm.username,
        user.avatarURL({ size: 32 })
      )
      .setImage(gif[message.replytext])
      .setColor("RANDOM");
    message.channel.send({ embed });
  },
};

The links you are using are not image or gif links but tenor webstite viewing an image. For Each link you'll have to replace it with the actual image.v 链接地址图片 )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM