Discord JS:通过斜杠命令关闭机器人
Discord JS: Shutdown bot via slash command
我有以下命令。
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
。
感谢您的帮助
尝试
process.exit()
或者
const { SlashCommandBuilder } = require("@discordjs/builders")
module.exports ={
data: new SlashCommandBuilder()
.setName("shutdown")
.setDescription("Shutdown the bot"),
async execute(interaction) {
interaction.reply("Shutting down").then(() => {
interaction.client.destroy();
})
}
}
我有以下命令。
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
。
感谢您的帮助
尝试
process.exit()
或者
const { SlashCommandBuilder } = require("@discordjs/builders")
module.exports ={
data: new SlashCommandBuilder()
.setName("shutdown")
.setDescription("Shutdown the bot"),
async execute(interaction) {
interaction.reply("Shutting down").then(() => {
interaction.client.destroy();
})
}
}