Ad

Checking Time Using A Discord Bot (Javascript)

- 1 answer

I want to check the time difference between when a command is executed and when the parameter specified in the command states it should end. I have an idea of how to do this, but if i merely stick a loop in my index.js which is the main file that I have the command group names stored will the loop continue to run without it stopping the bot from receiving input from people typing a command in a discord channel (like !flip)? How would I go about making it so it won't stop the other input if it does?

Ad

Answer

For this you will need to make use of async as otherwise node will wait for the loop to finish. Try putting

<client>.on('message', async message => { /*code*/})
Ad
source: stackoverflow.com
Ad