简体   繁体   中英

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?

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:

client.destroy().then(() => client.login("Token"));

You can read more on Promises here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM