How are Discord.Collection()s handled with v14?

This is my index.js: https://srcb.in/Vl8vb6Crkg
taco-cat-bot/index.js:11
client.commands = new Discord.Collection();
^

TypeError: Cannot read properties of undefined (reading 'Collection')
at Object.<anonymous> (/root/taco-cat-bot/index.js:11:31)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
taco-cat-bot/index.js:11
client.commands = new Discord.Collection();
^

TypeError: Cannot read properties of undefined (reading 'Collection')
at Object.<anonymous> (/root/taco-cat-bot/index.js:11:31)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
It is erroring on client.commands = new Discord.Collection(); so, how do I do collections now?
7 Replies
Jaworek
Jaworek3y ago
how did u import Discord
Erin
ErinOP3y ago
const { Discord, Client, GatewayIntentBits, Partials } = require('discord.js');
Jaworek
Jaworek3y ago
i think its deconstructed yeah i am dogeHaHa doesnt export Discord
Erin
ErinOP3y ago
Ah, ok
Jaworek
Jaworek3y ago
do it like const Discord = require("discord.js") of just deconstruct collection from it
Erin
ErinOP3y ago
Now my bot comes online with no errors and the prefix is defined BUT nothing logs via messageCreate.js No errors, it is like it doesn't listen.
chewie
chewie3y ago
You are most likely missing the MessageContent intent.
Want results from more Discord servers?
Add your server