New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cacheType change or implementation. #4365
Comments
when implementing managers i specifically looked for an interface which easily allowed for dependency injection down the line, and its the whole reason why: these arguments to basemanager are included cacheType = Collection, ...cacheOptions this is not hardcoded as collection this.cache = new cacheType(...cacheOptions); this is a thing this.cacheType = cacheType; However, with that being said, v12 was released before any thought of implementation for custom cache was done. The implementation should be relatively simple, just do something similar to structures.extend, managers grab the class which should be used, and feed that, plus additional optional arguments to BaseManager. However there were disagreements, some maintainers feel structures is already bad enough, and this would be even worse of an interface. it could probably be done in a way that is not breaking, but i personally feel this is more of a v13 thing, and this will benefit a lot from typescript. |
I don't think changing the cacheType will reliably work, because instances of it are created before I'm able to change the cacheType, but I'll need to take a further look. And something like this would be lovely in v13 but v12 would be nice aswell. |
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Eg. I'm always frustrated when [...]
discord.js/src/managers/BaseManager.js
Line 11 in 1c275af
cacheType = Collection
I don't see an easy way for changing the implementation used for Collections, as I'd like to implement my own way, this is a problem, and after asking on the Discord, I didn't find any existing methods or solutions aside from just directly overriding the methods.
Describe the ideal solution
A clear and concise description of what you want to happen.
Perhaps some form of way to declare the reference to a file or something, like in the options, that extends BaseCollection.
discord.js/src/util/Collection.js
Line 6 in 1c275af
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
I've taken a look at directly forking Discord.js, but that'd be quickly unmaintainable, I've tried just going like
client.users.cache.set = () => {}
for example, but that's not friendly.Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: