【问题标题】:Discordjs bot embed gifsDiscordjs 机器人嵌入 gif
【发布时间】:2020-08-30 03:25:12
【问题描述】:

我的机器人发送随机 gif,但不嵌入。我想发送带有嵌入的随机 GIF。我怎么能这样?

代码:

  if (msg.author.bot) return;
  if (msg.content.toLowerCase() === prefix + 'xgif' ) {
      number = 100;
      imageNumber = Math.floor (Math.random() * (number -1 + 1)) + 1;
      client.channels.cache.get(`channelID`).send( {files: ["./images/" + imageNumber + ".gif"]})
  }

【问题讨论】:

    标签: javascript node.js discord discord.js


    【解决方案1】:

    你需要先做

      const { RichEmbed } = require('discord.js')
    

    这将为您获取 RichEmbed。然后,做

    const embed = new RichEmbed()
    

    您可以做很多事情来更改嵌入。有

    1. .setColor(hexidecimal)
    2. .setThumbnail(normally user.displayAvatarURL)
    3. .setFooter(whatever you want)
    4. .setTimestamp()
    5. .setDescription(whatever you want)
    6. .setAuthor(whatever you want)
    7. .addField(stuff)

    【讨论】:

      猜你喜欢
      • 2022-01-11
      • 2018-09-18
      • 2022-01-22
      • 2021-07-20
      • 2021-11-27
      • 2017-11-02
      • 2021-07-24
      • 2021-04-09
      • 2020-12-09
      相关资源
      最近更新 更多