Missing Access Error

I get this error: pretty sure it's from this code:
client.channels.fetch(BANKLOGCHANNEL).then(channel => {
channel.send(text);
})
.catch(console.log('BANK LOG: ', text));
client.channels.fetch(BANKLOGCHANNEL).then(channel => {
channel.send(text);
})
.catch(console.log('BANK LOG: ', text));
but im not sure , because it doesnt print line numbers and i have no idea why it doesn't just catch it my code works fine, but then the whole app just crashes with this error
No description
4 Replies
d.js toolkit
d.js toolkit9mo 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!
skeddles
skeddles9mo ago
"discord.js": "^13.15.0", node -v v16.17.0 I can confirm commenting out that code makes the error never appear even wrapping it in trycatch does not stop the error:
try {
client.channels.fetch(BANKLOGCHANNEL).then(channel => {
channel.send(text);
})
.catch(console.log('BANK LOG: ', text));
} catch (e) {console.log('BANK LOG: ', text);}
try {
client.channels.fetch(BANKLOGCHANNEL).then(channel => {
channel.send(text);
})
.catch(console.log('BANK LOG: ', text));
} catch (e) {console.log('BANK LOG: ', text);}
duck
duck9mo ago
<Promise>.catch() takes a callback function currently you're just calling console.logand passing what it returns (undefined) furthermore try/catch only catches errors that are synchronously thrown within the try block you'd need to await the promise for try/catch to handle it as for the actual error, it means exactly what it says your bot doesn't have access to that channel
d.js docs
d.js docs9mo ago
guide Popular Topics: Permissions (extended) - Implicit permissions Causes for "Missing Access": read more
Want results from more Discord servers?
Add your server
More Posts