fix op 8 handler for some discord libraries

This commit is contained in:
dank074 2025-04-12 16:25:40 -05:00
parent 3ccf33950f
commit 3bf3adfa82

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;