Client Error

SrcShare
Easily share your source code with other developers.
5 Replies
d.js docs
d.js docs3y ago
• What's your exact discord.js npm list discord.js and node node -v version? • Post the full error stack trace, not just the top part! • Show your code! • Explain what exactly your issue is. • Not a discord.js issue? Check out #useful-servers.
PAdventures
PAdventuresOP3y ago
Emitted 'error' event on Client
Emitted 'error' event on Client
//Event Handler
const eventsPath = path.join(__dirname, 'Events');
const eventFiles = fs.readdirSync(eventsPath).filter(file => file.endsWith('.js'));

for (const file of eventFiles) {
const event_filePath = path.join(eventsPath, file);
const event = require(event_filePath);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
} else {
client.on(event.name, (...args) => event.execute(...args));
}
}
//Event Handler
const eventsPath = path.join(__dirname, 'Events');
const eventFiles = fs.readdirSync(eventsPath).filter(file => file.endsWith('.js'));

for (const file of eventFiles) {
const event_filePath = path.join(eventsPath, file);
const event = require(event_filePath);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args));
} else {
client.on(event.name, (...args) => event.execute(...args));
}
}
d.js docs
d.js docs3y ago
ReferenceError: "x" is not defined: learn moreTypeError: Cannot read properties of undefined/null (reading "x"): learn more
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
PAdventures
PAdventuresOP3y ago
node:events:498
throw er; // Unhandled 'error' event
^

TypeError: Cannot read properties of undefined (reading 'content')
at Object.execute (D:\PA_Admin Backup\Events\messageCreate.js:153:21)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:381:10)
at processTicksAndRejections (node:internal/process/task_queues:85:21)
node:events:498
throw er; // Unhandled 'error' event
^

TypeError: Cannot read properties of undefined (reading 'content')
at Object.execute (D:\PA_Admin Backup\Events\messageCreate.js:153:21)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Emitted 'error' event on Client instance at:
at emitUnhandledRejectionOrErr (node:events:381:10)
at processTicksAndRejections (node:internal/process/task_queues:85:21)
nvm fixed the issue by using message.author
Want results from more Discord servers?
Add your server