Taking an instance of exporting these two functions in JS module.js new.js Help, if I was to count how many functions am I importing on new.js file. Answer It would be interesting to know what you are trying to achieve as it is somewhat unusual, but it should be somewhat easy to get what you are after. You ca…
Tag: node.js
Message collector responds to other people’s messages
I’m trying to make a collector which will collect the mentioned user’s message. But even with filter my bot respond to it’s own message and other peoples messages! Here is my test.js file code: I was changing my filter many times, but I still can’t fix this problem, so what am I doing …
Extract the desired numbers from the array in the object
I have an object with array values , and I want to extract my desired numbers from that with this condition : First , I should check that if numbers in array are ascending or descending, so if they were one of them, return them , but if they were not check this: If the numbers in the array are
TypeError: client.voice.createBroadcast is not a function
This is my code: Output comes out with an error: I am using Node:17.0.0 and Discord.js:13.1.0 I am not sure why I am getting this error. Answer Discord.js v13 no longer supports voice. The new way to join a VC and play audio is with the @discordjs/voice library. Unfortunately, discord-tts might be deprecated.…
Node.js – How do I upload an image to Backblaze b2?
I am getting connect Request failed with status code 400 from b2.uploadFIle() Here’s what I tried to do: Step 1: Download backblaze-b2 node.js library and multer(to get image file in req.body) Step 2: Set up how I’m going to call my route in POSTMAN. I have attached an IronMan.png in my request. S…
Error: ENOENT: no such file or directory, open When trying to access a directory with fs
I am not knowledgeable in nodejs or express, I have an API running on http://localhost:3000 and one of the endpoints call a function that uses file system to read file synchronously. When I make a post request on postman, it says in the console that it can’t read a path that doesn’t exist (which d…
(node:31873) UnhandledPromiseRejectionWarning: TypeError: Item is not a constructor
Whenever I want to make a POST request using Postman I get this error: TypeError: Item is not a constructor. Any idea why? I have my code here: And item.js: Answer You’re importing the full exports object, not just part of it. That object is not a constructor function (it’s not a function at all).…
Need to extract name value from json array of the output
I am unable to extract the name variable from the graph output of the following react code. trying to store the name value from the json output received from the api in my state variable in React. How do i do it? Answer Maybe because your checking the second console.log outside the callback. In javascript the…
Axios in a firebase function returning pending promise even inside two async/await blocks
I have an async/await problems (I know, I know) that makes no sense to me. I’m declaring both functions (child and HOF) as async, and awaiting the returned results before trying to console log them. Surprise surprise, I get pending. The function hangs for 60s and times out (so it seems even my runWith t…
Refused to apply style from ‘http://localhost:2000/cssFile/style.css’ because its MIME type (‘text/html’)
I am currently trying to add my style.css file to home.ejs file render by express.js But I keep receiving the following error My file structure is like This is my express code My home.ejs: I have been trying for another solution, but I just can’t solve mine. Answer My file structure is like This is my e…