Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 1 year ago. Improve this question I have a bot in discord in JavaScript and I need to start a timer in 24 hou…
Tag: node.js
comparing array.includes with database data by using If condition in javascript / node js
so my object somewhat look like this and i made a function which i want to check type by giving if condition so wrote a code like this so I am putting all my condition in IF condition if and the problem is if there are more type condition then i have to do it like this value.type== “some” so
fs.writeFileSync method writing wrong to a text file
I have a problem with my script related to writing to a text file. The logic flow works as follows: I read an entire unformatted text file with fs.readFileSync and pass all the read content to a variable of type string. After that I use the .split to break this text into several parts and keep each part of th…
Discord.js | Chatbot responds to command name
so I’m trying to make a chatbot that sends the message after the user types the prefix and the command name. The command works in general but it seems to also take in the command name. I use a command and event handler btw. This is what it looks like: So when people do a.chat without an arg after that,
Sending alert messages to multiple whatsapp users using Twilio?
I need to send whatsapp messages to multiple phone numbers using node.js.I am using the twilio Api to achieve this.I signed up in twilio,followed the steps and used my mobile number for the sandbox.I used the code in node.js application,it worked with my whatsapp number,but not with other phone numbers.Is the…
Unsafe use of expression of type ‘any’ for return statements in Typescript function
I keep getting a lint issue for this line .then((response): object => response.data) which states Unsafe use of expression of type ‘any’ Answer I suspect that it’s because response is a “generic object” and typescript can’t “identify” that it has a .data attr…
$(this) undefined via requirejs on bower and node
I am trying to develop an app with a modular approach using requirejs and include only as little jQuery code as possible as necessary. I have a basic SPA app o.html: app.js: main-built.js:483 Uncaught TypeError: Failed to set an indexed property on ‘Window’: Indexed property setter is not supporte…
Discord JS Client only has itself in guild members cache
So I was trying to access a member from a guild via but when the bot starts up the guild only contains itself until a user sends a message. Answer You need to enable member fetch When creating the client client = new Client({fetchAllMembers: true}} Do note that calling Fetch() on a guild Will Overwrite the in…
How to make a Confirm Dialog Appear before Form Post Request in EJS template
I’m trying to create a confirmation dialog using something like this: confirm(‘Are you sure?’) inside of my EJS form but I don’t know where and how to get it to work correctly. Here is the code I have so far for my EJS template: I’m aware that the checker() function isn’t c…
How can I use Bootstrap 5 with Next.js?
After installing bootstrap with npm install bootstrap I added the style to /pages/_app.js like so: However anything from it that uses javascript does not work at all, e.g. the Collapse example from their docs. If I add import ‘bootstrap/dist/js/bootstrap.js’ to /pages/_app.js then it starts “…