0

I’m getting a “ReferenceError: Cannot access ‘Client’ before initialization, so I was wondering How I would stop that from happening I’m getting it on this code.

const Discord = require("discord.js");
const Client = new Client({ intents: [GatewayIntentBits.GUILDS, GatewayIntentBits.GUILDMESSAGES, GatewayIntentBits.MessageContent] });

let number = 1958;

Client.on("ready", () => {
    console.log("Bot is up and running!");
    
    setInterval(function(){
        number += 2;
        const channel = client.channels.cache.get("<DISCORD CHANNEL ID>");
        channel.send(`The product is: ${number}`);
    }, 24000)
});

Client.login(process.env.TOKEN);

My friend tried to help me fix it but to no effect and I am just wondering what am I doing wrong

Christian Fritz
  • 20,641
  • 3
  • 42
  • 71
Twitter
  • 11

0 Answers0