'How to make the Discord bot send a message every 24 hours (weekends X)
I am a Discord bot developer. I tried a code that sends a message to a specific channel every 24 hours (weekends X). but it doesn't work :( help me!
const client = new Discord.Client();
client.on("ready", () => {
console.log("Online!");
});
var now = new Date();
var hour = now.getUTCHours();
var minute = now.getUTCMinutes();
client.on("message", (message) => {
if (hour === 10 && minute === 30) {
client.channels.get("ChannelID").send("자가진단 하세용!");
}
});```
Solution 1:[1]
You can use different types of timers in js
like setTimeout or setInterval like this:
setInterval(() => {
// your sending message code
}, 24*60*60*1000);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Raymond Shafiee |
