I don't know how Events works
So, i was trying to make events out of index and i don't know how to make them perfectlly, i tried using the info on docs, but it doesnt leave any error, just don't do anything.
32 Replies
• What's your exact discord.js
npm list discord.js
and node node -v
version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.Index: https://sourceb.in/K2UJkR8SgR
the eventHandler: https://sourceb.in/PUsMjpZMtn
the messageUpdate: https://sourceb.in/7psL0aXXFc
messageUpdate should not be a "once" event i believe. try logging before the if statement to see if its running. if its not go back to your event handler and log all your variables to see where a potential issue may be.
^this and why do you have all the intents? Its not needed. Theres a number of reasons why your update event might not work, the most common ones being
* The message might be a partial
* The roles might not be cached
* You might not have the Guilds intent (which i cannot see because you enabled all intents and srcbin wont let me scroll
only enable the intents you need. They decrease resource usage
at index i have all the intents because at the tutorial put them all, however its reasonable that im not using the most part of these
delete the ones you are not using
yeah, im doing it, thanks
so, its better to make the messageUpdate on index.js?
im going to use console.log() for searching if its detected
No, you should keep it how it is but set “once” to false
and then debug the handler
ok
Basically you know how when you start your bot and ready only runs one time.. when the bot starts?
That’s when you’d use once
but if it’s gonna trigger a bunch, set once to false
srry if im a bit naive
it’s okay we all start somewhere
Ok, i made a few changes like what you said , but still i cannot log information on the module.export.
New Index: https://sourceb.in/ScKpg0wvVW
Old & New eventHandler: https://sourceb.in/PUsMjpZMtn
New messageUpdate: https://sourceb.in/rNTLsjJvFD
your console.log will error because you do not pass in a string
omg
i literally miss the ''
fixed
restarting
i also dont really get why you use
switch (folder) { case "client":
i apologize if that's not the best way to do it, i used a tutorial and do that like showing at my code
if this helps, the directories are like this.
index.js \functions | - \handlers | | -eventHandler \events | - \modlog | | -messageUpdate
why do you have 2 functions folders
im not focusing
bruh
im going to dinner, srry if i make more difficult the thing than it should be
no worries. You appear to switch between folders and search for the client folder, only you dont have a client folder
uhm, i think i have a client folder, if we mean to the same folder
wow, i passed to client folder and there is an error now. It's an advance
im fixing the code with the errors thar are appearing
however, im using the folder /home/container/events/client, how i can edit the handler for making for each folder? or why doesn't work?
Code works perfectly on new folder ✅
you should just put all your events in an event folder and then read them.with fs
now i see
i think i can change the code with the example on docs, i don't wanna to limit the folders or making anything different
also this default seems the thing that should apply for a default folder not specified
default is just what your switch would do if none of your cases match
that is what i mean
But you shouldn't blindly follownthe docs
yes
the code im using is from a tutorial at the actual bot, not the docs, just wanna see it for knowing how discordjs web examples did it
i delete the switch, now it's working
thnx!