It doesn't fetch the channel

const { EmbedBuilder } = require("discord.js");

module.exports = async (client) => {
console.log("Loaded: Message Logger");

try {
const channel = await client.channels.fetch(1159494066673815562);

} catch(e) {
console.log("Error:");
console.log(String(e.stack).yellow);
}
};
const { EmbedBuilder } = require("discord.js");

module.exports = async (client) => {
console.log("Loaded: Message Logger");

try {
const channel = await client.channels.fetch(1159494066673815562);

} catch(e) {
console.log("Error:");
console.log(String(e.stack).yellow);
}
};
the fetch channel part causes the catch block to print the error undefined
3 Replies
d.js toolkit
d.js toolkit4mo 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
Squid
Squid4mo ago
Why not just do console.log(error)? Your error handlers are meant to make errors more readable, not less
Tissemyren
Tissemyren4mo ago
idk, but it's fixed anyway