我是 JavaScript 新手,我是在尝试剖析嵌入的消息.这是我的代码,它可以正常运行几分钟,相应地工作,但我知道出了什么问题.
I am new to JavaScript, am I was trying to dissect an embedded message. Here's my code, it runs fine for a few mins, works accordingly but idk what goes wrong.
bot.on('message', (message) => {
for (var i = 0; i < message.embeds.length; i++) {
if (message.embeds[i].title.includes("text!")) {
message.channel.send('reply')
}
}
})
我认为这段代码可以解决这个问题.
I think this code can fix this problem.
bot.on('message', (message) => {
for (var i = 0; i < message.embeds.length; i++) {
if (message.embeds[i] && message.embeds[i].title.includes("text!")) {
message.channel.send('reply')
}
}
})
这篇关于无法读取未定义的属性“包含"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!