-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
feat(Typing): cache member object #10786
base: main
Are you sure you want to change the base?
feat(Typing): cache member object #10786
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Skipped Deployments
|
if ('member' in data) { | ||
/** | ||
* The member that this guild typing instance represents | ||
* @type {?GuildMember} | ||
*/ | ||
this.member = this.channel.guild.members._add(data.member, true); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR makes the member only set when its provided, otherwise it will be undefined (not null). Either we keep the getter and add the caching logic in too, or we define a fallback that is the getter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be done without getters. If the member
property was not set when the object was created, then there can be no conditions when it will be set later (except manually). I can use the ternary operator to set null if there is no data.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const user = this.getUserFromMember(data); |
Please describe the changes this PR makes and why it should be merged:
Discord API provides member object with
TYPING_START
event in guild. We can use this for cache update and getting value without getterStatus and versioning classification: