#Anybody an idea how you can create custom Event Files which automatically load the correct callback
1 messages · Page 1 of 1 (latest)
you mean importing the client and then just call client.on(....)
Something like
export let name = "interactionCreate";
export let run = ...
Thats no problem hahaah
You could import the client indeed, so you don't need to pass it at every run
But i want the correct type to be loaded
Overall your solution is really bad, a lot of problems can be caused through that kind of implementation
The correct type will still be loaded for client
You have to define run somehow, else its just guessing or always looking in the docs
then its even better to just export the client and call client.on("event",()=>{})
If you're talking about parameters for run, then you're right
thats what i am saying giving the correct callback
export default () => {client.on(...)}```
You can do it like that but its just not a good implementation
Managing events as own objects and loading them to client seems to be the best implementation (especially when you have multiple bots in a project)
I know its possible and its a clean solution but i would like to manage them as objects
Explain..
Having an event object which i can just load as an object to my Client
eventfiles.map(e=>{
client.on(e.event,e.run)
}```
You want to map to event loader?
I don't see what you're trying to achieve in the end.. Reloading events?