summary refs log tree commit diff
path: root/src/util/entities/Member.ts
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-04-12 21:03:49 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-04-12 21:03:49 +1000
commit9a6390b9bdbb6eb7e3ea6360619a2879ce42cbe1 (patch)
treee55ca7e42e0a46975b605673587f249d5774e0b0 /src/util/entities/Member.ts
parentSet eslint env properly (diff)
downloadserver-9a6390b9bdbb6eb7e3ea6360619a2879ce42cbe1.tar.xz
Fix DC client throwing on GUILD_CREATE
Diffstat (limited to '')
-rw-r--r--src/util/entities/Member.ts26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/util/entities/Member.ts b/src/util/entities/Member.ts
index cc2bf2a1..8c208202 100644
--- a/src/util/entities/Member.ts
+++ b/src/util/entities/Member.ts
@@ -330,17 +330,25 @@ export class Member extends BaseClassWithoutId {
 		});
 
 		const memberCount = await Member.count({ where: { guild_id } });
-		const memberPreview = await Member.find({
-			where: {
-				guild_id,
-				user: {
-					sessions: {
-						status: Not("invisible" as const), // lol typescript?
+
+		const memberPreview = (
+			await Member.find({
+				where: {
+					guild_id,
+					user: {
+						sessions: {
+							status: Not("invisible" as const), // lol typescript?
+						},
 					},
 				},
-			},
-			take: 10,
-		});
+				relations: ["user", "roles"],
+				take: 10,
+			})
+		).map((member) => ({
+			...member.toPublicMember(),
+			user: member.user.toPublicUser(),
+			roles: member.roles.map((x) => x.id),
+		}));
 
 		if (
 			await Member.count({