Working with TypeScript and the ubiquitous client-passing #204
Nicholaiii
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Nice Idea, definitely better than the alternatives. However, I think i'll probably end up allowing people to set a client into the creator so commands can access it easily. This solution also will have the problem of not being able to use it in slash-up. Although slash-create is mainly focused on HTTP only bots, this won't be much of a hassle to do. The only thing that might be annoying is TypeScript devs having to declare the type for every command. Not to mention, I was thinking of replacing require-all since it's not more useful than providing a path. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In the FAQ you clearly state you don't support passing the client through, but I think you missed a great feature of require-all; the
resolve
option, that parses the contents of the module before handing it back to your library. Using this option, we can export functions that takes the parameters we need to inject, and return a class that has this in its closure.Functional example:
I think this approach is worth adopting and using in the guide, and not just for TypeScript.
Beta Was this translation helpful? Give feedback.
All reactions