feat: add presences on ready_supplemental#1680
Open
leafusfluffy wants to merge 2 commits into
Open
Conversation
| where: { | ||
| user_id: In(friendPresenceUserIds), | ||
| is_admin_session: false, | ||
| status: Not(In(["offline", "invisible"])), |
Member
There was a problem hiding this comment.
"unknown" is one i usually put in there too for good measure
Comment on lines
-691
to
+733
| presences: [], // TODO: Send actual data | ||
| presences: [], |
Member
There was a problem hiding this comment.
another disappearing comment
Comment on lines
+328
to
+348
| const friendPresenceUserIds = [...new Set(relationships.filter((relationship) => relationship.type === RelationshipType.friends).map((relationship) => relationship.to_id))]; | ||
| const { result: friendPresenceSessions, elapsed: friendPresenceSessionsQueryTime } = await timePromise(() => | ||
| friendPresenceUserIds.length === 0 | ||
| ? Promise.resolve([] as Session[]) | ||
| : getDatabase()!.getRepository(Session).find({ | ||
| where: { | ||
| user_id: In(friendPresenceUserIds), | ||
| is_admin_session: false, | ||
| status: Not(In(["offline", "invisible"])), | ||
| }, | ||
| relations: { user: true }, | ||
| select: { | ||
| user_id: true, | ||
| status: true, | ||
| activities: true, | ||
| client_status: true, | ||
| user: Object.fromEntries(PublicUserProjection.map((x) => [x, true])), | ||
| }, | ||
| }), | ||
| ); | ||
|
|
Member
There was a problem hiding this comment.
wouldn't this spam a bunch of db queries if you have a lot of friends?
Comment on lines
+897
to
+901
| return { | ||
| id: availableGuild.id, | ||
| voice_states: availableGuild.voice_states.map((state) => VoiceState.prototype.toPublicVoiceState.apply(state)), | ||
| activity_instances: [], | ||
| }; |
Member
There was a problem hiding this comment.
is embedded_activities not required?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This adds user and guild presences in READY_SUPPLEMENTAL Gateway response.