【发布时间】:2021-11-19 05:00:10
【问题描述】:
我在我的机器人的 "interactionCreate" 事件中收到此错误,此错误导致我的机器人每次发生时都会关闭。
TypeError: Cannot read properties of undefined (reading 'delete')
at Timeout._onTimeout (/root/Teyrox/GamesMadeInPolaDiscordBot/events/servidores/interactionCreate.js:12:403)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7)
在这行代码出现错误,经过一段时间的研究和检查,我没有发现这行代码有任何错误
if (aBoolean) return interaction.reply({ content: `<:x_:677580192641843222>`, ephemeral: true }).then(m => setTimeout(() => m.delete().catch(() => { }), 15000));
【问题讨论】:
-
这可能不一定是您的问题的原因,但您的代码背后的整个概念是有缺陷的。此代码永远不会起作用,因为无法删除临时消息。它们被设计为仅由用户自己“删除”或隐藏。
标签: javascript node.js discord.js