i have a problem with discord bot. I just triing to get it working, but i cannot figure out where this error is.
const {discord, Intents} = require('discord.js');
const client = new discord.client();
client.on('ready', () => {
console.log(client.user.tag);
});
client.login("token");
This is my entire code without package.json
Error message looks like this: Cannot read properties of undefined (reading 'client')
Thanks for help.
CodePudding user response:
Methods you are using seem to be deprecated on Discord.js v13 and posterior.
You could instead use:
const { Client } = require('discord.js');
const client = new Client({ intents: 32767 });
client.on('ready', () => {
console.log('We are up!');
});
client.login(process.env.SUPER_SECRET_TOKEN);
If you need help moving your entire codebase to Discord.js v13 or v14, you can always check the docs and the official guide.