I am trying to shard my discord bot in v13, and when I run just the main file (bot.js) on my beta bot without sharding, it works fine, but when I try running it with sharding, It gives this error. Here is the index.js code where I shard When I try running just bot.js without sharding, it gives the error
Tag: node.js
Is new keyword is necessary with ObjectID in MongoDB Query
I was working on a Typescript web project that used MongoDB and ExpressJS. I used a MongoDB query to find and delete a document from MongoDB using the HTTP DELETE method. During the MongoDB query, I got mixed up with a term named new and ObjectID. Here are the code snippets: Both are working fine as I expecte…
Clear command is not deleting messages correctly discord.js v13
I want to make a bulk-clear command for my bot. I tried this code: But it doesn’t work correctly. when I run !clear 3, It deletes 2 messages. Notes: I am using discord.js v13 and node.js v16 Answer Your bot also counts your command as a message, and removes it. That’s why it only removes 2 other m…
How do I re-run a Javascript-file when the content of a folder changes?
I am having trouble getting this to work. I am developing a Discord-bot and just started using slash-commands, which require the commands to be “pushed” every time I change something. The files are pushed by simply running a Javascript-file. Then there is also the main bot-file, which needs to be …
Node js Engine not upgrading for firebase function node compatibility
First failed Here is the package.json Error: package.json in functions directory has an engines field which is unsupported. Valid choices are: {“node”: 10|12|14|16} Deploys to runtimes below Node.js 10 are now disabled in the Firebase CLI. Existing Node.js 8 functions will stop executing at a futu…
how to return in connection.query
I have a problem… I wanted to return “A” but The result was “B” I don’t know what to do Please help me my code: My results Answer You are mixing here callback with promises. To reach what you want, wrap your function in a promise:
JWT returned invalid signature on axios request reactjs
So im trying to create refreshtoken hook in react. and nodejs with express as my backend. my backend code looks like this the problem is when i try this endpoint with Postwoman (chrome extension) its WORK but when i try with React + axios the server return is here is my react code Answer I’m sending the…
Converting PHP AES-256-CBC encryption into node.js
I have little to no knowledge in encryption and I’ve been facing issues trying to figure out how to convert these PHP functions to work with node.js and the crypto module. Any help would be much appreciated. Answer Actually, porting issues without target code are routinely closed on SO. But in this case…
Cannot read properties of undefined (reading ‘0’) – ( empty error JSON response with postman)
so i’m working with Joi for validation, and i’ve encountered this error when trying to post with postman. i’m follwing a tutorial, i tried to write it differently, but still have the same issue. i’m trying to access the error message. ( first selecting the error, then the details, then…
How to fix “TypeError: props.scoreboard.map is not a function”, only after refresh
I’m having an odd issue when I’m trying to loop over my response from my backend. I’ve seen similar questions and they seem to point to the response not being an array, but logging my response does indeed result in an array. I’m passing the scoreboard prop to the scoreBoardItem which w…