So im trying to make a discord bot but i have one problem i keep on getting this
var bot = new Discord.Client();
^
ReferenceError: Discord is not defined
at Object.<anonymous> (C:\SSC_Bot\bot.js:2:12)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
I am very confused as to why this is happening. Please help.
From the screenshot above, you have initialised bot variable twice
var bot = require(‘discord.js’);
var bot = new Discord.Client();
Change that to
var Discord = require(‘discord.js’);
var bot = new Discord.Client();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.