feat(Client): add ClientEmojiManager #4983
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please describe the changes this PR makes and why it should be merged:
Hey, my first Pull Request!
Having the Client#emojis getter which would cycle through every emoji, add it to a collection and all that, just to check for one emoji isn't really ideal. This ClientEmojiManager takes a different approach, and instead iterates through each guild and returns an emoji if the guild has it.
I've tested this a few times versus the previous getter, and it seems to be faster most of the time. It's definitely faster if say you want to get the first cached emoji in the bots first cached guild, because it only iterates through one emoji.
Previously, when I was using the old getter, I would often be getting memory leaks because my bot was very reaction focused and the MessageReaction#emoji getter loads every single emoji into a collection every time the getter is called, but after switching to this it seemed to all go away.
I do have to clarify that I have not been able to update the typings.
Status
Semantic versioning classification: