Skip to content

Tag: node.js

Passing parameters to Express middleware not working

I’m trying to create an input validation middleware using Express. My goal is to be able to pass 2 parameters to the middleware that validates client input. The problem is, after following multiple resources (including Express docs), my middleware seems to not be working. After calling the middleware, I…

Typescript development environment

I am starting with typescript. I started with an empty folder and ran these commands to set up my typescript development. then i made a tsconfig file I tried changing my output dir in tsconfig.json like “outDir”: “./dist”, But that doesn’t seem to work. the transpiled file is sti…

Mongoose update Sub-Document

How to updating sub-document in mongoose: this is my JSON DATA This is the post Schema. this is the NodeJs part ** I got this response in Postman: post.comments.update is not a function it accept post.update but it’s not what i want because the property message is in the sub-doc of each post object, any…

How can I delete a message after sending it?

I have a code that sends a message when a member joins the guild and I want to shortly delete it afterwards. My code: I tried embed.delete or just the classic msg.delete but it doesn’t work as I can/don’t know how to define “msg” as the last msg the bot has sent. Answer kanal.send(embe…

Slowmode command

When I type ;sm, my bot responds with: “You need to specify a time in seconds” <– Thats okay. But when I type ;sm [time], it still responds with: “You need to specify a time in seconds.”, but it should set the rate limit and tell me that “Slowmode is now [time]s”. …