如技巧所建议,您可以使用process.exit()
,也可以使用destroy中的方法Client。
示例:
client.on("message", message => {
if (message.content.toLowerCase() == "shutdown") { // Note that this is an example and anyone can use this command.
message.channel.send("Shutting down...").then(() => {
client.destroy();
})
}
})