如何在 Discord bot 消息嵌入中显示 gif 附件? [英] How do I show a gif attachment in Discord bot message embed?

查看:57
本文介绍了如何在 Discord bot 消息嵌入中显示 gif 附件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我的机器人设置为每次使用命令时发送嵌入消息,但由于某种原因,gif 未显示.这是我的代码的样子:

Currently, my bot is set to send an embed message each time a command is used, but for some reason, the gif is not showing. This is what my code looks like:

let ballembed = new Discord.MessageEmbed()
  .setColor(0x000000)
  .setDescription(`**${mention}** was just harshly bonked!`)
  .attachFiles("https://media.giphy.com/media/JrkbVRQA5adwle1ykt/giphy.gif")
message.channel.send(ballembed);

如果是 png,则代码可以正常工作,但如果我使用 gif,则不会显示.

The code works fine if it's a png, but will not show if I use a gif.

发生的情况是嵌入消息自己发送但没有 gif,并且终端中没有错误.

What happens is that the embed message sends itself but without the gif, and there are no errors in the terminal.

我尝试过使用 .attachFiles,但结果是 gif 将 发送到嵌入消息之外.

I've tried using .attachFiles however, what happens is that the gif sends outside of the embed message.

我希望能够发送带有 gif 的嵌入消息.

I would like to be able to send the embed message with the gif inside.

推荐答案

你可以像 Lily 建议的那样使用 .setImage 或者像预期的那样使用数组来代替

You can use .setImage like Lily suggested or use an array instead like intended

.attachFiles(["https://media.giphy.com/media/JrkbVRQA5adwle1ykt/giphy.gif"]);

这篇关于如何在 Discord bot 消息嵌入中显示 gif 附件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆