The bot crashes after sending one or two direct messages to the newly joined members

I am using discord.js v14. The code works. However, I don't think it is a rate limit because I checked there were only one or two members joining my discord, so it won't be rate limit. Anyway, I tried logging the error message, but nothing showed up in same directory where the index.js with the code resides. Please see attached images for the code. Thanks if any of you could help pinpoint the error. And why is that?
No description
No description
9 Replies
d.js toolkit
d.js toolkit2mo 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!
treble/luna
treble/luna2mo ago
catch and log your errors properly instead of writing them to a file also whats the point of that code? just do it direclty in the event, why overcomplicate it
Kenryuakuma
KenryuakumaOP2mo ago
Is there a way to log it to the file in synology nas as I am hosting my bot on synolgoy nas. The reason not doing that in the event is because of rate limit just in case if there are several members joining the server at the same time.
treble/luna
treble/luna2mo ago
you should find hosting that allows you to view a console, instead of doing it via this weird way if your bot crashes you wont ever know why because it cant write to the file
Kenryuakuma
KenryuakumaOP2mo ago
Well. It is weird that hosting it seems to mitigate the problem a bit. Why is that do you know based on your experience?
Pulse
Pulse2mo ago
how are you running the bot? there must be some way you can see the console output without relying on the file
treble/luna
treble/luna2mo ago
because i've never seen one host a bot on a nas your crash could have many causes, but thats why you need a console
Kenryuakuma
KenryuakumaOP2mo ago
I don't see any errors after hosting it on some sort of a node.js server. Yup one bot I host it on nas and is working fine.
treble/luna
treble/luna2mo ago
a nas isnt meant to host bots, so id recommend to switch that one over too

Did you find this page helpful?