最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - ReferenceError: Client is not defined Discord JS error - Stack Overflow

programmeradmin0浏览0评论

I've just started working on a discord bot, but whenever I try to start it using node . in the cmd prompt, I get this error;

ReferenceError: Client is not defined
    at Object.<anonymous> (C:\Users\imkav\Desktop\DiscordBot\index.js:2:16)
    at Module._pile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3

I've looked around and cant find anything specific enough to fix my issue. Here is my code;

const Discord = require("discord.js");
const Client = new Client();

Client.login("TheToken");

As I said I just started today, so There isn't much here

I've just started working on a discord bot, but whenever I try to start it using node . in the cmd prompt, I get this error;

ReferenceError: Client is not defined
    at Object.<anonymous> (C:\Users\imkav\Desktop\DiscordBot\index.js:2:16)
    at Module._pile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3

I've looked around and cant find anything specific enough to fix my issue. Here is my code;

const Discord = require("discord.js");
const Client = new Client();

Client.login("TheToken");

As I said I just started today, so There isn't much here

Share Improve this question asked Aug 23, 2018 at 18:39 KaveenKaveen 31 gold badge1 silver badge2 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 2

I think the Discord documentation says you should use Discord.Client();

const Discord = require('discord.js');
const client = new Discord.Client();
发布评论

评论列表(0)

  1. 暂无评论