I want to send a message to a specific channel at 2:00 AM in Discord. I can't get it to work. Am I doing something wrong?
Here's my code:
const Discord = require("discord.js")
const cron = require("cron")
const client = new Discord.Client()
let channel = "ID#"
let job = new cron.CronJob('0 00 2 * * *', () => {
client.channels.cache.get(channel).send("Hello!!")
})
job.start()
client.login("Server#")
This is okay now. Apparently, there's just 5 values in cron time string, and I put 6
Here's the code now:
let job = new cron.CronJob('00 2 * * *', () => {
client.channels.cache.get(channel).send("Hello!!")
})