Merge pull request #1274 from dank074/patch/fix-requestGuildMembers-libraires

fix op 8 handler for some discord libraries
This commit is contained in:
Madeline 2025-04-13 08:03:31 +10:00 committed by GitHub
commit 1d8e081fd8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -38,9 +38,16 @@ export async function onRequestGuildMembers(this: WebSocket, { d }: Payload) {
check.call(this, RequestGuildMembersSchema, d);
const { query, presences, nonce } = d as RequestGuildMembersSchema;
const {
presences,
nonce,
query: requestQuery,
} = d as RequestGuildMembersSchema;
let { limit, user_ids, guild_id } = d as RequestGuildMembersSchema;
// some discord libraries send empty string as query when they meant to send undefined, which was leading to errors being thrown in this handler
const query = requestQuery != "" ? requestQuery : undefined;
guild_id = guild_id as string;
user_ids = user_ids as string[] | undefined;