How to fix discord.js

ReferenceError: nope is not defined
at Object. (C:\Users\nope\OneDrive\nope\discord bot\index.js:36:28)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions…js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47

install discord.js from the “Add package” part of the package.json, and then change your “node” to 16.x (this is what worked for me, might not work for you)
i’ll need your project’s code to help you further

1 Like

i install it BRO

i use VS code

uhhh the (nope) is my token or user

const { Client, GatewayIntentBits } = require(‘discord.js’);
const autoMod = require(‘./AutoMod’);
const commands = require(‘./Commands’);
const config = require(‘./Config.json’);

const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
],
});

client.once(‘ready’, () => {
console.log(‘Bot is online!’);
});

client.on(‘messageCreate’, (message) => {
// it command
if (!message.content.startsWith(config.prefix) || message.author.bot) return;

//  auto mod
autoMod.autoMod(message);

// 
const args = message.content.slice(config.prefix.length).trim().split(/ +/);
const command = args.shift().toLowerCase();

// เรียกใช้งานคำสั่ง
if (command === 'ping') {
	commands.pingCommand(message, args);
}

});

client.login(config.token); (it index)
{
“token”: “”,
“prefix”: “/”
}
it config

cant help ya, i dont use vs code for my bots on glitch, sorry

ok you cant help but thx

what happens with the syntax here? is the aforementioned line 36 around here?

{
“token”: “”,
“prefix”: “/”
}
it config IT CONFIG.JS

oh that makes sense.

so where’s line 36? it’s not numbered in your post so it’s hard to tell

oh
i del it sorry

that’s some next level debugging. can’t have an error on line 36 if your code doesn’t go up to line 36

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.