Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Discord bot Client not defined

so I am trying to make a discord bot and I am running in to a problem

ReferenceError: Client is not defined
at Object.<anonymous> (C:\Users\Arya\Desktop\Arya\Discord\bot.js:3:16)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47

the code is

require("dotenv").config();
const { Cient, Intents } = require("discord.js");
const client = new Client({
intent: [
    Intents.FLAGS.GUILDS,
    Intents.FLAGS.GUILD_MESSAGES
 ]
});

bot.login(process.env.TOKEN);

please help me

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

simple syntax error, happy to help
this should work

require("dotenv").config();
const { Cient, Intents } = require("discord.js");
const client = new Client({
intents: [
    Intents.FLAGS.GUILDS,
    Intents.FLAGS.GUILD_MESSAGES
]
});

client.login(process.env.TOKEN);

Your login at the bottom confuses me where the bot variable is but if my code does not work you can change it back. Otherwise you just needed to add a s to intent. Happy Coding 🙂

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading