Creating first bot and ran into problem

Ive already done nmp i and installed discord.js in the terminal (using VSC) and when i try to run my code it says cannot run import statement outside a module
import {Discord} from 'discord.js';
const client = new Discord.Client();

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

client.on('message', message => {
  // Here is where you need to code
  if(message.content == "Node.js is cool") {
    message.channel.send("Yea!");
  }
});

client.login("TOKEN");

i did replace token with the actual token
Was this page helpful?