Shifts logs
Hello,
I've been thinking of adding a command to my bot that logs people's shifts.
The concept is that when someone runs the command, it makes an id and logs it in a database, and then the person running the command would be timed.
The database thing is not the problem, the problem is that I don't know where to get started. At the end it would also log that shift in a database with how many minutes that person has patrolled on that shift.
Can someone point me in the right direction, then the rest I will most likely figure out on my own.
10 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPyou could make a command that starts one, i guess
Yes, I know that.
I'm saying how would the command be structured? How does the bot time the user
probably a timer in the database which is checked every x seconds to see if they're finished
like a startTime and an endTime, if Date.now() >= endTime timer goes off
I was planning on having a command which ends the patrol altogether
then do that 🤷
Oh yeah, how does the Date.now() work, i know it prints out some numbers but what do they mean and how are they determined
how many milliseconds it's been since 1970 jan 1
:mdn: Date.now()
The Date.now() static method returns the number of milliseconds elapsed since the epoch, which is defined as the midnight at the beginning of January 1, 1970, UTC.
hmm okay
Game