【发布时间】:2021-01-17 22:27:37
【问题描述】:
试图让机器人发送消息,然后在 30 秒后删除它自己的消息。 自从我收到此错误以来,任何人都可以帮忙
TypeError:无法读取未定义的属性“删除”
代码
message.channel.send('<@' + message.author.id + '>, the email you provided is not valid, sorry.')
.then(function (message) {
message.react("????")
message.react("????")
})
.then(message => {
message.delete({ timeout: 10000 /*time unitl delete in milliseconds*/});
})
.catch(console.error);
【问题讨论】:
-
我不确定,但是当您首先调用
.then时,消息对象已经被使用,因此当您使用.then时,什么都没有了。您可以尝试在第一个.then方法中使用message.delete吗? -
太棒了,这很简单!谢谢 - 修复了它:-) 我没有意识到是这样的。你想作为答案发布,以便我接受:)
标签: javascript discord.js