summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gateway/src/opcodes/Identify.ts15
-rw-r--r--util/src/entities/Guild.ts10
-rw-r--r--util/src/entities/Member.ts1
3 files changed, 21 insertions, 5 deletions
diff --git a/gateway/src/opcodes/Identify.ts b/gateway/src/opcodes/Identify.ts
index cd09653f..adfd98da 100644
--- a/gateway/src/opcodes/Identify.ts
+++ b/gateway/src/opcodes/Identify.ts
@@ -12,6 +12,8 @@ import {
 	EVENTEnum,
 	Config,
 	dbConnection,
+	PublicMemberProjection,
+	PublicMember,
 } from "@fosscord/util";
 import { setupListener } from "../listener/listener";
 import { IdentifySchema } from "../schema/Identify";
@@ -68,9 +70,16 @@ export async function onIdentify(this: WebSocket, data: Payload) {
 			"roles",
 		],
 	});
-	const merged_members = members.map((x: any) => {
-		return [x];
-	}) as Member[][];
+	const merged_members = members.map((x: Member) => {
+		return [
+			{
+				...x,
+				roles: x.roles.map((x) => x.id),
+				settings: undefined,
+				guild: undefined,
+			},
+		];
+	}) as PublicMember[][];
 	const guilds = members.map((x) => ({ ...x.guild, joined_at: x.joined_at }));
 	const user_guild_settings_entries = members.map((x) => x.settings);
 
diff --git a/util/src/entities/Guild.ts b/util/src/entities/Guild.ts
index 434699ac..c569d536 100644
--- a/util/src/entities/Guild.ts
+++ b/util/src/entities/Guild.ts
@@ -17,7 +17,15 @@ import { Webhook } from "./Webhook";
 // TODO: stage_instances
 // TODO: threads
 
-export const PublicGuildRelations = ["channels", "emojis", "members", "roles", "stickers", "voice_states"];
+export const PublicGuildRelations = [
+	"channels",
+	"emojis",
+	"members",
+	"roles",
+	"stickers",
+	"voice_states",
+	"members.user",
+];
 
 @Entity("guilds")
 export class Guild extends BaseClass {
diff --git a/util/src/entities/Member.ts b/util/src/entities/Member.ts
index 4cdd3421..38352890 100644
--- a/util/src/entities/Member.ts
+++ b/util/src/entities/Member.ts
@@ -24,7 +24,6 @@ import {
 } from "../interfaces";
 import { HTTPError } from "lambert-server";
 import { Role } from "./Role";
-import { Snowflake } from "../util/Snowflake";
 import { BaseClassWithoutId } from "./BaseClass";
 import { PublicGuildRelations } from ".";