Send to specific channel

I used the docs To get "const channel = client.channels.cache.get('1153350608082964592');" but I get this error. Any help? Looked around and to no avail.
const client = new Discord.Client();
^

ReferenceError: Discord is not defined
at Object.<anonymous> (C:\Users\honeu\Desktop\NodeJSBot\commands\serverstuff\suggestion.js:3:16)
at Module._compile (node:internal/modules/cjs/loader:1275:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
at Module.load (node:internal/modules/cjs/loader:1133:32)
at Module._load (node:internal/modules/cjs/loader:972:12)
at Module.require (node:internal/modules/cjs/loader:1157:19)
at require (node:internal/modules/helpers:119:18)
at Object.<anonymous> (C:\Users\honeu\Desktop\NodeJSBot\index.js:20:19)
at Module._compile (node:internal/modules/cjs/loader:1275:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)

Node.js v19.7.0
Process exited with code 1
const client = new Discord.Client();
^

ReferenceError: Discord is not defined
at Object.<anonymous> (C:\Users\honeu\Desktop\NodeJSBot\commands\serverstuff\suggestion.js:3:16)
at Module._compile (node:internal/modules/cjs/loader:1275:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
at Module.load (node:internal/modules/cjs/loader:1133:32)
at Module._load (node:internal/modules/cjs/loader:972:12)
at Module.require (node:internal/modules/cjs/loader:1157:19)
at require (node:internal/modules/helpers:119:18)
at Object.<anonymous> (C:\Users\honeu\Desktop\NodeJSBot\index.js:20:19)
at Module._compile (node:internal/modules/cjs/loader:1275:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)

Node.js v19.7.0
Process exited with code 1
5 Replies
d.js toolkit
d.js toolkit15mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Daro
Daro15mo ago
looks like you didn't require discord.js properly to define Discord. With code like that I'd expect the first line of your code to be smth like const Discord = require('discord.js') I would recommend going through a formal guide to understand things properly, https://discordjs.guide/
Saint
SaintOP15mo ago
Did have that That's the thing on why I was confused. It was in a commands file - suggestion.js
Daro
Daro15mo ago
if you did it wouldn't say that Discord is not defined so I would recommend you double check you do have that in the file you are working in or that you pass it or what not also if this is in a command file you 100% should not be redefining a client variable you would want to pass along the existing (logged in) client value through whatever command handler system you are using
Saint
SaintOP15mo ago
Got it thanks
Want results from more Discord servers?
Add your server