所以我试着做一个"hug“命令,其中gif和嵌入的颜色是随机的。gif不显示,颜色始终相同。你知道怎么修吗?
const erro = 'There was an error. Mention someone.'
const mentionee = msg.mentions.users.first()
if (msg.content.startsWith('+hug')) {
const hugs = [
'https://tenor.com/7Wko.gif',
'https://tenor.com/QWw1.gif',
'https://tenor.com/LUqw.gif',
'https://tenor.com/beqF0.gif',
'https://tenor.com/1jRF.gif',
'https://tenor.com/xNZi.gif',
'https://tenor.com/bpgad.gif',
'https://tenor.com/Vl7g.gif',
'https://tenor.com/u28I.gif',
'https://tenor.com/2SQu.gif',
'https://tenor.com/bbQCJ.gif',
'https://tenor.com/TqvK.gif',
'https://tenor.com/bfSJp.gif',
'https://tenor.com/5QsA.gif'
]
const gif = hugs[Math.floor(Math.random() * hugs.length)];
const colors = [
'#E27BFF',
'#6F008E',
'#AD00DD',
'#650082',
'#F6D7FF'
]
const ton = colors[Math.floor(Math.random() * colors.length)];
msg.channel.send(mentionee ? {
embed: new Discord.MessageEmbed()
.setDescription(`${msg.author} hugged ${mentionee}!`)
.setColor(ton)
.setImage(gif)
} : erro);
}
转载请注明出处:http://www.wlshunda.com/article/20230526/2602235.html