Skip to content

Tag: node.js

discord bot replies 1 to 2 times

i am currently working on this discord bot but when i call a command it responds twice. would anyone know how to fix this? Answer Have you tried shutting down all other processes of your bot (Google Cloud, AWS …)? The bot could login twice and act like 2 bots, replying twice to the command Happened to m…

Set checkbox label’s text in modal

I have a modal for creating new post. I want to allow the user to select departments for sharing so I’m using checkboxes for choosing the audience. HTML: Different users have different departments to be shown and they are saved in mongoDB user document. I need to set the labels of the checkboxes on load…

Why I got Illegal arguments error with simple hash function?

This is my code I run I expected hashed password. Why does terminal point to illegal arguments? Answer In an object literal, password : bcrypt.hash(this.password, salt) calls bcrypt.hash and assigns its return value to the password property. In the code you’ve shown, this doesn’t refer to the obje…

Webpack 5 and ESM

I think I’ve read every thread on SO and every related page on the internet on this, everything has some variation of a problem I want: To use webpack to bundle my web app up To use ES Modules within my source js and have them transpiled down for wider browser support To use ES Modules within my webpack…

Discord: Get User by Id

I’m trying to create a web application to manage the users of my Discord server. In my database, I have stored only the users’ ids. I tried to use the discord.js API, but from what I’ve understood it requires a discord bot to do that. That’s not what I want. I would like to retrieve th…