【发布时间】:2022-01-13 20:07:24
【问题描述】:
我正在用 Discord.js 制作一个机器人,这是我的代码:
const { CommandInteraction, Interaction } = require("discord.js");
module.exports = {
name: "test",
description: "Tests the bot.",
ephemeral: "false",
permission: "SEND_MESSAGES",
/**
*
* @param {CommandInteraction} interaction
*/
execute(interaction) {
interaction.reply({content: "Testing..."})
.then(interaction => {
setTimeout(function(){
interaction.editReply("Test Successful ✔")
}, 3000)
})
}
}
但是当我尝试启动机器人时,我在终端中遇到了错误。这是我得到的错误:
C:\Users\Manuel\Desktop\Manuel\Programs\Programming\Visual Studio Code\Helix32 (Discord)\Commands\Developer\test.js:16
interaction.editReply("Test Successful ✔")
^
TypeError: Cannot read properties of undefined (reading 'editReply')
at Timeout._onTimeout (C:\Users\Manuel\Desktop\Manuel\Programs\Programming\Visual Studio Code\Helix32 (Discord)\Commands\Developer\test.js:16:29)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7)
Node.js v17.2.0
[nodemon] app crashed - waiting for file changes before starting...
【问题讨论】:
标签: javascript discord discord.js