summary refs log tree commit diff
path: root/src/util/entities/Member.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/entities/Member.ts')
-rw-r--r--src/util/entities/Member.ts18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/util/entities/Member.ts b/src/util/entities/Member.ts
index f2762adc..27c67c40 100644
--- a/src/util/entities/Member.ts
+++ b/src/util/entities/Member.ts
@@ -10,6 +10,7 @@ import {
 	JoinTable,
 	ManyToMany,
 	ManyToOne,
+	Not,
 	PrimaryGeneratedColumn,
 	RelationId,
 } from "typeorm";
@@ -287,6 +288,19 @@ export class Member extends BaseClassWithoutId {
 			relations: [...PublicGuildRelations, "system_channel"],
 		});
 
+		const memberCount = await Member.count({ where: { guild_id } });
+		const memberPreview = await Member.find({
+			where: {
+				guild_id,
+				user: {
+					sessions: {
+						status: Not("invisible" as "invisible")	// lol typescript?
+					}
+				}
+			},
+			take: 10,
+		});
+
 		if (
 			await Member.count({
 				where: { id: user.id, guild: { id: guild_id } },
@@ -342,8 +356,8 @@ export class Member extends BaseClassWithoutId {
 				event: "GUILD_CREATE",
 				data: {
 					...guild,
-					members: [...guild.members, { ...member, user }],
-					member_count: (guild.member_count || 0) + 1,
+					members: [...memberPreview, { ...member, user }],
+					member_count: memberCount + 1,
 					guild_hashes: {},
 					guild_scheduled_events: [],
 					joined_at: member.joined_at,