我很难弄清楚如何将我的嵌入缩略图设置为数组,我该怎么做



在设置缩略图时,如何将其转换为数组?我试过多个不同的网站不和服务器和人,但没有一个能帮助我。

module.exports ={
name : 'rd',
aliases : ['rd'],
run : async(client, message) => {
const { MessageEmbed } = require('discord.js')
const embed = new MessageEmbed()
.setTitle(`LOVER OF ALL THAT IS FOOD`)
.setDescription('BROTHERS OF THE ANCIENTS SISTERS OF THE DESTRUCTORS')
.setColor('f5ad42')
.setThumbnail('https://i.imgur.com/gZlXGsc.png')
// message.channel.send()
// message.reply()
message.channel.send(embed)
}
}

好吧,你的问题真的没有意义,但我明白了。

我假设您希望缩略图的值在一个数组中。

执行以下操作:

module.exports = {
name: 'rd',
aliases: ['rd'],
run: async (client, message) => {
const thumbnails = ["https://i.imgur.com/gZlXGsc.png","","","",] // add more links
const random = thumbnails[Math.floor(Math.random() * thumbnails.length)] // randomises the amount of links inside the thumbnails array.
const embed = new Discord.MessageEmbed()
.setTitle(`LOVER OF ALL THAT IS FOOD`)
.setDescription('BROTHERS OF THE ANCIENTS`enter code here` SISTERS OF THE DESTRUCTORS')
.setColor('f5ad42')
.setThumbnail(`${random}`)
message.channel.send(embed)
}
}

最新更新