General Question

I had a conversation a conversation with a bout that saying and trying to convince me that using 1 event for each one thing is not bad. I mean like 1 messageCreate event for features like 1 MessageCreate event for level system 1 MessageCreate event for anti-link system and it goes like this for everything. Based on my knowledge something like that cause issues like performance issues. Tell me your opinion on that please.
7 Replies
d.js toolkit
d.js toolkit5mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
Kinect3000
Kinect30005mo ago
It’s ultimately dependent on the number of listeners you need. More listeners require more memory to store them
!Delta!
!Delta!OP5mo ago
One event for each feature as he said
Kinect3000
Kinect30005mo ago
How you classify a "feature" is subjective Are mod commands a feature? Is the ban command a feature? Even then, I don’t know how many "features" you intend to have Ultimately, more listeners = more memory usage While it doesn’t take up much memory, you’ll notice when you create too many
!Delta!
!Delta!OP5mo ago
Like every command,every interaction has a different event
Kinect3000
Kinect30005mo ago
You can take a heap dump and see what’s taking up memory I personally use a command handler as opposed to 1 listener per cmd "Command handling" is how I’d classify the feature Whether it actually impacts ur app depends on how much listeners you actually end up creating Oh, and node.js has the default max listeners set to 10 (per event)
!Delta!
!Delta!OP5mo ago
Yeah i use command handler too thats why im just curious because in the past some guys ask me to help them cause they code a bot with the same idea with this guy and they have issues Yeah this i what im saying and i share with him the official guide and he start saying this is bullshit that wont work with many commands and that im flexing my skills and im saying bullshits and things like that Yeah bro this is what im saying. I even share with him the d.js guide and still call this system bullshit😅 And i was like ohh reallyyy He just spamming that my method take more resources to call function instead of his calling 30+ events the same time
Want results from more Discord servers?
Add your server