My discord bot simply wont turn on

So, my bot doesnt turn on it also doesnt send a message in the terminal that he is online i cant see any bugs in the terminal either he worked just fine and suddenly stopped working. also when made a new project the bot also wouldnt start

const Discord = require(‘discord.js’);

const bot = new Discord.Client();

const token = ‘My discord token’;

var version = ‘1.0.1’;

const PREFIX = ‘$’;

bot.on(‘ready’, () =>{

console.log('i am ready!');

})

bot.on(‘message’, message =>{

let args  = message.content.substring(PREFIX.length).split(" ");

switch(args[0]){

    case 'ping' :

        message.channel.send('pong');

        break;

        case 'developer,Developer' :

            message.channel.send('Revenge#6897 add me')

            break;

            case 'info' :

                if(args[1] === 'version'){

                    message.channel.send('Version'+ version);

                }else{

                        message.channel.send('invalid args')

                    }

                        break;

                    

                }



}

)

Assuming it must be a problem with the discord.js, have you tried running npm i discord js in the console of your project?

Also, I believe I had a similar issue to this sometime last month with one of my bots in the past, which seems to work fine again the next day.

Ive just tried this and it also doesnt seem to work
other bots that i made stopped working too
i dont know if this makes any difference but im making the bot in visual studio code and when i type ‘’ node . ‘’ to start it it doesnt become yellow like it did before, once again i dont know if that changes anything since this is my first discord bot that im making (overall first thing that im trying to code)

It seems that you don’t have bot.login() also use .env for storeing TOKEN safely!

Thats bot.login() was the solution i have no idea why it let me start the bot earlier without it, also mind telling me how .env works?

You should have a file called .env

You want to add a field called TOKEN and put your token as the value (no “”)

Then, your bot.login line needs to be this: bot.login(process.env.TOKEN)

Thanks i will do some research on that matter, for now i will just try to make some simple commands, i want the bot to be able to do like everything that you need, reaction roles, role management with custom commands and all that good stuff