[英]Make a restart command in discord.js
I'm creating a discord bot in Discord.js and I'd like to create a restart command but I don't know how can I do... Could you help me?我正在 Discord.js 中创建一个不和谐的机器人,我想创建一个重启命令,但我不知道我该怎么做...你能帮我吗?
I have tried that but it doesn't work:我试过了,但它不起作用:
client.destroy()
client.login("Token")
This looks correct, only thing I noticed is that both are async functions and you don't await them or similiar.这看起来是正确的,我唯一注意到的是两者都是异步函数,您不需要等待它们或类似的函数。 You got two options to do this:您有两种选择来执行此操作:
Asnyc:阿斯尼卡:
await client.destroy();
client.login("Token");
Or Sync using .then
on the Promise:或者在 Promise 上使用.then
同步:
client.destroy().then(() => client.login("Token"));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.