Memory leak in discord bot project

Hey, I have a tiny bot running as an express app that has a few basic commands to assist me in my discord server, it’s having issues though, I get memory warnings from it, and every 15 seconds it sleeps because of it, it exceeds the 512 MB limit for some reason even though it’s just 40 lines of basic code that only has 3 libraries, discord.js, http and fs. Is this an problem with discord.js or a glitch issue?

Hey @AquaticFish, from this information it’s hard to say where the actual memory problem is, but aside from the technical restrictions, it’s less likely that the problem is with Glitch than with how your bot is implementing discord.js. If you share your project name, someone might be able to give more specific feedback.

Hey, here’s my code, https://pastebin.com/raw/YH26Z5Vf

I don’t see anything obvious in there. I’m moving this topic to another category where other Discord bot authors might be able to help, but I’m not sure just seeing the code you’ve shared will be sufficient detail.

Your code looks very different from other d.js codes i seen. I’m mostly confused at
if (message.author.id === “//”){
Try following the example they have on their npm page.

It’s a line for checking if the message’s owner is me before proceeding, I removed my ID and replaced it with “//” for safety and privacy reasons.

Instead of if (message.author,id === “//”) {,
Put:
if(!message.author.id === “//”) return;
this basically makes the bot not proceed when their id doesnt match yours.

I know but that shouldn’t cause any of the issues I’m experiencing right now

Still no solutions to this problem…

Hello @AquaticFish, Can you verify that you are indeed using a bot, and not a user account token, as this sometimes can also be the problem, I have seen other people try self bots, and they would not work, if the account is not a bot account, also, try getting a new bot token, and try with that, and tell me the end result!

If it was invalid, d.js would throw an error ‘invalid login credentials’

I am not using a selfbot, also the issue disappeared randomly, weird.