Allan ZUPCIC
Allan ZUPCIC

Reputation: 1

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")

Upvotes: 0

Views: 1694

Answers (1)

Zer0
Zer0

Reputation: 1690

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

Upvotes: 1

Related Questions