Command Not Reloading
Hey, I'm having an issue where, after using the reload command the bot is still referencing the old message. although when I log the event I'm seeing the updated code with the changes I made.
I'm using typescript & CommonJS while transpilng
16 Replies
- 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!
- ✅
Marked as resolved by OPare you editing the typescript or javascript file?
Javascript file
can you show your event manager
as in, how client.events works
alright, lemme send it
https://pastebin.com/hWydj147 - The Event Handler Function
https://pastebin.com/3EsCcrTR - GetFiles Function
https://pastebin.com/nTABXLFw - My client constructor for event collection reference
and where do you call HandleEvents?
In my index.ts file
you don't seem to actually do something with client.events
I have noted it for a plan, but currently yeah
all your event logic is here, which is loaded on that HandleEvents function
the client event emitter will still have the old event
since you're only updating client.events
you could rework your event logic so it actually uses the client.events collection
and that way you only need to update that
I was just saving the collection for a help command, so what should i do currently?. can you provide me an reference
well you could either just make a function that clears the emitter and iterates through the collection
something like "ReloadEvents"
or one that only reloads a specific event
it'd pretty much be only to (un)listen to old/new events
since your event handler on client.on would get the event from the collection and run it
so it'll always get the most "up to date version"
Alright Got It, Thank you 🫶