diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-09-04 11:25:40 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-09-04 11:25:40 +0200 |
commit | bf81e9c352e6ab1b76dae6a50cc768281f5c0bf4 (patch) | |
tree | 7edd57bb27d539a0cbf53e73a495733b72f1a519 | |
parent | :bug: fix invites (diff) | |
download | server-bf81e9c352e6ab1b76dae6a50cc768281f5c0bf4.tar.xz |
:bug: fix ready members payload
-rw-r--r-- | gateway/src/opcodes/Identify.ts | 15 | ||||
-rw-r--r-- | util/src/entities/Guild.ts | 10 | ||||
-rw-r--r-- | util/src/entities/Member.ts | 1 |
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 "."; |