我有以下命令。
const { SlashCommandBuilder } = require("@discordjs/builders")
module.exports ={
data: new SlashCommandBuilder()
.setName("shutdown")
.setDescription("Shutdown the bot"),
async execute(interaction) {
interaction.reply("Shutting down").then(() => {
client.destroy();
})
}
}
該命令應該關閉機器人。它目前唯一做的就是讓機器人崩潰,因為ReferenceError: client is not defined. 我很感激任何幫助
uj5u.com熱心網友回復:
嘗試
process.exit()
而是 或
const { SlashCommandBuilder } = require("@discordjs/builders")
module.exports ={
data: new SlashCommandBuilder()
.setName("shutdown")
.setDescription("Shutdown the bot"),
async execute(client, interaction) {
interaction.reply("Shutting down").then(() => {
client.destroy();
})
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/441665.html
標籤:javascript 不和谐 不和谐.js
