I'm making a kind of custom calendar for my play server role, I managed to make it using Date JS, but now I need to make the bot send a message with a new month every 6 hours and not every second.
Code:
client.once(Events.ClientReady, () => {
console.log('Ready!');
const channel = client.channels.cache.find(channel => channel.id === '1067802071476215818');
let date = new Date(2000, 60, 1);
const options = { year: 'numeric', month: 'long', day: 'numeric' };
for (i = 0; i < 10000; i++) {
const exampleEmbed = new EmbedBuilder()
.setColor(0x0099FF)
.setTitle('Календарь на сервере HoG World')
.setDescription(date.toLocaleDateString('ru-RU', options));
channel.send({ embeds: [exampleEmbed] });
date.setMonth(date.getMonth() + 1);
}
});
To send a message with a new month every 6 hours, you can use the setInterval method. Here is the updated code that should work:
I hope that helps! Let me know if you have any questions or need further assistance.