G’day, I really need some help with the “Auto-Moderation” feature that I want to include in my very first Discord Bot, which is coded in JavaScript. Also, I am really new to this programming language and the discord.js itself, so I don’t really know how to use all the arguments properly. Whatever, the point is, I want my bot to
Discord.js Bulk Delete command
I am trying to add a bulk delete command to my bot but when I type how many messages I want to delete, I get the following error: Here’s the code: Answer To use the parseInt(), you have to add the decimal base, so 10 -> parseInt(args[0], 10);. The snippet of code I have put above is working well.
Are tags subject to the same CORS restrictions as javascript/fetch calls?
It’s common practice to include scripts from other origins with script tags but when you use fetch calls on other origins then everything must be configured carefully other wise you will get a CORS error. Does the script tag somehow bypass CORS? How does that work? Answer The Same Origin Policy prevents JavaScript reading data from other origins without permission
Type Error : Cannot read property ‘name’ of null [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 2 years ago. Improve this question
How to use straight and smart quotes in auto-replace script for textarea?
I’m really stuck again on how to properly combine these lines to auto-replace straight quotes into smart ones in the text area. It was working earlier, however after I added a line to fix the cursor going at the end after replacing a character. Here’s what is currently looks like: Commas, semicolon, period, em dash, and double spaces is working
JavaScript: Diference in sorting behavior array of objects with keys by object property
I have two arrays with the same information but different keys. The keys of the first array are strings: The second array is indexed normally: If I try to sort them by age: In the end myOtherArray will be sorted but myArray will remain sorted by key. What am I missing here? Thanks! Answer Your first array does not actually
Form continues to submit despite custom validation logic
I have developed some logic to display relevant errors when the form is submitted, but it continues to allow me to submit the form without displaying the errors. I used a flag to determine whether the form should be submitted, but it seems to be ignored, it’s just not working. Here is a minimally reproducible example: https://codepen.io/ldco2017/pen/dyMMpjb?editors=0010 Answer I was
Updating Firestore Documents in Parallel Using Promise.all()
This question concerns the Firestore database, but, more generally, it concerns making async requests in parallel. Simply put, I wish to update multiple Firestore documents as quickly and efficiently as possible by mapping over an array of their document IDs. the .set() method is async (returning a promise) and so I understand that I can wrap the multiple requests –
Group results of multiple POST API calls
I use the below script to loop through the input (skipping first one) to post some data to my API. Result How can I capture the combined response of both calls into a variable I can use later on in my script? something like var allNum = res.result.number[0]? This is what I want -> Var allTens = “002, 003” Script
Show an element if date is before or after another date using Vue js
I’m using vue to dynamically show elements (called boxes) on the page, but I need to display an element based on if it’s start date is before or after today+1 week. So if the box.start_date is before one week from today, then show it, else hide it. I’m not sure how I can do this in vue ie. I tried