channel.send() sending duplicates

Im still having problems with channel.send() sending duplicate messages even though it is inside of a for loop and it should break after the first message has been sent. In the .txt file I included console output from the time when this code sent 3x duplicate messages at the same time. This code runs every 5 minutes. If you have any idea why this might happen/ how to make it stop, please let me know. Thank you for your time ❤️
4 Replies
d.js toolkit
d.js toolkit17mo 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!
d.js docs
d.js docs17mo ago
To share long code snippets use a service like gist, sourcebin, starbin, or similar instead of posting them as large code blocks.
Robbe
RobbeOP17mo ago
SourceBin
getNewsPosts
Instantly share your code with the world.
Robbe
RobbeOP17mo ago
It is from same code, thats my bad. I edited it to hide some private stuff and messed up. I am now pretty sure that the dupe happens in the api that I am fetching. If I remove the postid from the .json and wait for it to post again, I cant get it to post duplicates. It only posts duplicates when the post is brand new at the url that I am fetching I dont believe so, I only see one output in console. And the code runs every 5 minutes, and takes max 5 seconds to run. But anyways thanks alot for your input, I took the easy way out and edited the code to only fetch 1 item (the newest) and will now only check 1 item every 5min. That way I hope the api wont do any weird tricks while publishing new posts
Want results from more Discord servers?
Add your server