Discordjs bot嵌入gif文件

编程入门 行业动态 更新时间:2024-10-08 22:17:42

Discordjs bot嵌入gif<a href=https://www.elefans.com/category/jswz/34/1771438.html style=文件"/>

Discordjs bot嵌入gif文件

我的机器人是随机发送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"]})
  }
回答如下:

您需要先做

  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)

更多推荐

Discordjs bot嵌入gif文件

本文发布于:2024-05-07 13:41:25,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1756504.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   Discordjs   bot   gif

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!