Search code examples
javascriptdiscord.js

Cant use .send when its not used in client.on(ready) discord.js v14


im trying to make a bot that sends a message every 24 hours at a specific channel, but the

client.channels.cache.get('ID').send('Test Mode');

only works in

client.on("ready", () => {
    console.log(`Logged in as ${client.user.tag}`)

Im using crontab for the loop


Solution

  • Maybe you are trying to send the message when the bot is not ready?
    Try to start the loop in the client.on("ready", () => {}); 😉
    If it doesn't work, please send the full code (without the token)
    Have a nice day!