【发布时间】:2019-03-11 13:28:21
【问题描述】:
我想从 url 中获取随机图像,但是当我不和谐地调用命令时,它会一遍又一遍地提供相同的图像。但是当我重新启动机器人并再次运行它时,图像发生了变化,但仍然一遍又一遍地播放不同的图像,没有任何变化?我将非常感谢任何帮助
else if (message.content.startsWith(prefix + "randimg") && message.author != client.user) {
message.channel.send({embed: {
color: 0x0000FF,
author: {
name: client.user.username,
icon_url: client.user.avatarURL
},
title: "Random Image Test",
image: {
url: "https://source.unsplash.com/random",
},
description: "Random Image Generation"
},
currentTimestamp: new Date(),
footer: {
icon_url: client.user.avatarURL,
text: "2018 @ Canarado"
}
})
我想也许是因为它一遍又一遍地从同一个随机 img url 中抓取它们,但我不知道如何去改变它。谢谢你,我希望有人能提供帮助。
【问题讨论】:
-
您的语法没有问题。也许有一种不同的方式来使用 unsplash url。
-
是的,我只是不知道。是否有一些 javascript 方法可以每隔 x 秒将 url 更改为新的随机 unsplash url? @弗罗斯特
-
如果您之前在变量中声明了该 message.channel.send 调用的所有内容,这可能会有所帮助(并在调用中传递变量)吗?
-
不幸的是,这没用@chackerian
-
也许这种类型的东西可能会帮助你,不确定。它找到链接的重定向 url。 redirectdetective.com 这是代码:redirectdetective.com/ajax.js
标签: javascript node.js discord discord.js