I’m not sure how I can use .toLowerCase() to make my discord command case insensitive this should be simple but I’m really new to this Answer In your handler where you check for the message content in the message event Have this done Eg: if(message.content.toLowerCase() === cmdName) return;
Tag: node.js
Batch write with Firebase Cloud Functions
I’m using Firebase as backend to my iOS app and can’t figure out how to construct a batch write through their Cloud Functions. I have two collections in my Firestore, drinks and customers. Each new drink and each new customer is assigned a userId property that corresponds to the uid of the current…
How to add dynamic Where queries in objection.js?
I have a table which has a global search bar that needs to trigger search for all fields like firstName, lastName, email and role. Also have a dynamic filter which can have single or multiple filter like “firstName” or/And “lastName” Obviously they need to be paginated. For pagination …
Property ‘connect’ does not exist on type ‘typeof import
I have problem when I try to use mongodb.connect() func.. Then error appears ” Property ‘connect’ does not exist on type ‘typeof import(..) Answer The connect functions exits inside mongoose package. Look into this link for more info [https://www.npmjs.com/package/mongoose]
If statement considers FALSE promise as TRUE
I’m making authentication in my app. And have such code changedPasswordAfter retuns promise (true or false) So I run request and get this into console. As you see ttt is FALSE but IF statement decided that it is TRUE . How can I fix that ? Answer Because ttt (which is a very bad name for a variable) is …
How can I return all data from different scope and receive them?
I tried to scrape a website using Node.JS + Cheerio + Axios, I’ve get all the things I need, but the problem is I don’t know how to return the data from different scopes to receive it (I can only receive the url, not the data inside another scope). The only data I can receive is the url, but all
Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (93)
Getting below error after installed latest node.js (v16.13.1) Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (93) For more information on which environments are supported please see: https://github.com/sass/node-sass/releases/tag/v4.14.1 I have created …
How do I get the same parent result regardless of the order of children being queried? (One to Many)
I’m building a chat with private rooms. What I’m trying to do is find a room that two users belong too. If there isn’t one create one. Chat Schema Query Controller The problem I’m having The order of the auth and receiver changes depending who is logged in and produces a different quer…
Reference errors appearing when importing discord bot modules
Ok so I am writing a music bot due to the more populars getting shutdown and the remaining being pretty useless. I split up the code in separate files for better readability and all that and so am using modules to import and export function & variables and when I run the program using node index.js it tel…
How to set Node Environment as Env Variable in the middle of the app?
I know that I can do process.env.NODE_ENV = TEST but it is not working for me. Relevant code below: test.js src/index.js user.js So the issue here is that when I run test.js, I am importing, and therefore running user.js before I set my NODE_ENV. Since imports are hoisted I can’t bring the env setting e…