I've just started on Javascript and Node.js, so I don't really know what to do. Please be patient with me. Thanks!
So I've hosted a node.js on my physical server. I wanted to create a Discord Bot that sends a daily message on specific timings on my server, for example, I want to send a message to a channel saying "Good Morning" every day at 8 am. How do I do it?
Currently, I only have this code to ping the bot (and the server)
/*
A ping pong bot, whenever you send "ping", it replies "pong".
*/
// Import the discord.js module
const Discord = require('discord.js');
// Create an instance of a Discord client
const client = new Discord.Client();
// The token of your bot - https://discordapp.com/developers/applications/me
const token = 'your bot token here';
// The ready event is vital, it means that your bot will only start reacting to information
// from Discord _after_ ready is emitted
client.on('ready', () => {
console.log('I am ready!');
});
// Create an event listener for messages
client.on('message', message => {
// If the message is "ping"
if (message.content === 'ping') {
// Send "pong" to the same channel
message.channel.send('pong');
}
});
// Log our bot in
client.login(token);
Also, how do I loop this code to ensure that it sends a message everyday? Thanks in advance.