【问题标题】:Discord Embed Image ResponseDiscord 嵌入图像响应
【发布时间】:2021-02-02 03:01:01
【问题描述】:

我在使用 Discord 机器人的随机响应命令时遇到问题。

目前,该命令会按预期发回除图像链接之外的所有内容。

我在一个数组中有许多随机响应,主要是文本响应和一个图像响应。

当嵌入回复时,图像响应仅显示为图像链接,任何人都可以在它响应图像出现时提供帮助吗?

这是数组中的代码,然后是主文件:

const jokeResponses = [
"joke1",
"joke2",
"joke3",
"https://i.imgur.com/HXLENiv.png"
]

module.exports = {jokeResponses} 
const { jokeResponses } = require('./jokeResponses.js');

      case "joke":
            var response = jokeResponses [Math.floor(Math.random()*jokeResponses .length)];
            
            embed.setColor('#f299cd')
            embed.setTitle(message.author.username + '`s joke')
            embed.setDescription(response);         
            
            message.channel.send(embed);
        
        break;

我不明白为什么当图片链接返回时它只是显示为链接而不是实际图片。

感谢任何帮助。

【问题讨论】:

    标签: node.js discord discord.js


    【解决方案1】:

    .setDescription() 仅用于文本,您必须使用 .setImage() 来显示 gif

    .setImage(response)

    【讨论】:

      猜你喜欢
      • 2021-08-13
      • 1970-01-01
      • 1970-01-01
      • 2020-02-27
      • 2020-12-30
      • 2021-12-21
      • 2021-11-26
      • 2021-08-02
      • 1970-01-01
      相关资源
      最近更新 更多