Answer the question
In order to leave comments, you need to log in
How to fix "Client is not defined" error?
const Discord = require('discord.js');
const robot = new Client({intents: [Intents.FLAGS.GUILDS]});
const comms = require("./comms.js");
const fs = require('fs');
let config = require('./config.json');
let token = config.token;
let prefix = config.prefix;
robot.on("ready", function() {
console.log(robot.user.username + " запустился!");
});
robot.on('message', (msg) =>{
if (msg.author.username != robot.user.username && msg.author.discriminator != robot.user.discriminator) {
var comm = msg.content.trim() + " ";
var comm_name = comm.slice(0, comm.indexOf(" "));
var messArr = comm.split(" ");
for (comm_count in comms.comms) {
var comm2 = prefix + comms.comms[comm_count].name;
if (comm2 == comm_name) {
comms.comms[comm_count].out(robot, msg, messArr);
}
}
}
});
robot.login(token);
Answer the question
In order to leave comments, you need to log in
const { Client } = require('discord.js');
Or
const robot = new Discord.Client({intents: [Intents.FLAGS.GUILDS]});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question