Exit the Client Ready event
Good evening, I have a js script which is used for a cron task, so I would like it to stop by itself after execution, but I use the ready event, and the script continues to run even after the commands have finished.
Is it possible to stop the script after the end of the code in the event ready?
Thank you in avance !
6 Replies
ā¢ What's your exact discord.js
npm list discord.js
and node node -v
version?
ā¢ Post the full error stack trace, not just the top part!
ā¢ Show your code!
ā¢ Explain what exactly your issue is.
ā¢ Not a discord.js issue? Check out #useful-servers.Are you trying to stop execution of the complete program right after starting your bot and executing a few commands?
If so you can use process.exit()
What are you doing in your task? Probably you don't need the Gateway and you should use
@discordjs/rest
or @discordjs/core
Hmm, using process.exit() cancels the actions in my case
Several tasks to get content from sqlite and a message sent with
client.channels.cache.get(<id>).send("test")
Yeah, you don't need the gateway, caching and other stuff discord.js provides.
Okay, thank you !