revert back to original schema, but add missing members
This commit is contained in:
parent
f41164945e
commit
fd33d58af8
@ -458,18 +458,31 @@ export async function onIdentify(this: WebSocket, data: Payload) {
|
|||||||
// If we're a bot user, send GUILD_CREATE for each unavailable guild
|
// If we're a bot user, send GUILD_CREATE for each unavailable guild
|
||||||
// TODO: check if bot has permission to view some of these based on intents (i.e. GUILD_MEMBERS, GUILD_PRESENCES, GUILD_VOICE_STATES)
|
// TODO: check if bot has permission to view some of these based on intents (i.e. GUILD_MEMBERS, GUILD_PRESENCES, GUILD_VOICE_STATES)
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
pending_guilds.map((x) =>
|
pending_guilds.map((x) => {
|
||||||
Send(this, {
|
//Even with the GUILD_MEMBERS intent, the bot always receives just itself as the guild members
|
||||||
|
const botMemberObject = members.find(
|
||||||
|
(member) => member.guild_id === x.id,
|
||||||
|
);
|
||||||
|
|
||||||
|
return Send(this, {
|
||||||
op: OPCODES.Dispatch,
|
op: OPCODES.Dispatch,
|
||||||
t: EVENTEnum.GuildCreate,
|
t: EVENTEnum.GuildCreate,
|
||||||
s: this.sequence++,
|
s: this.sequence++,
|
||||||
d: {
|
d: {
|
||||||
...new ReadyGuildDTO(x).toJSON(),
|
...x.toJSON(),
|
||||||
} as GuildCreateEvent["data"],
|
members: botMemberObject
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
...botMemberObject.toPublicMember(),
|
||||||
|
user: user.toPublicUser(),
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: [],
|
||||||
|
},
|
||||||
})?.catch((e) =>
|
})?.catch((e) =>
|
||||||
console.error(`[Gateway] error when sending bot guilds`, e),
|
console.error(`[Gateway] error when sending bot guilds`, e),
|
||||||
),
|
);
|
||||||
),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: ready supplemental
|
// TODO: ready supplemental
|
||||||
|
Loading…
x
Reference in New Issue
Block a user