mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
add implementation
This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
|
import { cache } from "../../cache.ts";
|
||||||
import { DiscordenoMember } from "../../structures/member.ts";
|
import { DiscordenoMember } from "../../structures/member.ts";
|
||||||
|
import { DiscordGatewayOpcodes } from "../../types/codes/gateway_opcodes.ts";
|
||||||
import { DiscordGatewayIntents } from "../../types/gateway/gateway_intents.ts";
|
import { DiscordGatewayIntents } from "../../types/gateway/gateway_intents.ts";
|
||||||
import { RequestGuildMembers } from "../../types/guilds/request_guild_members.ts";
|
import { RequestGuildMembers } from "../../types/guilds/request_guild_members.ts";
|
||||||
import { Errors } from "../../types/misc/errors.ts";
|
import { Errors } from "../../types/misc/errors.ts";
|
||||||
import { Collection } from "../../util/collection.ts";
|
import { Collection } from "../../util/collection.ts";
|
||||||
|
import { sendShardMessage } from "../../ws/send_shard_message.ts";
|
||||||
import { ws } from "../../ws/ws.ts";
|
import { ws } from "../../ws/ws.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,21 +34,20 @@ export function fetchMembers(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
return requestAllMembers(guildId, shardId, resolve, options);
|
const nonce = `${guildId}-${Date.now()}`;
|
||||||
|
cache.fetchAllMembersProcessingRequests.set(nonce, resolve);
|
||||||
|
|
||||||
|
sendShardMessage(shardId, {
|
||||||
|
op: DiscordGatewayOpcodes.RequestGuildMembers,
|
||||||
|
d: {
|
||||||
|
guild_id: guildId,
|
||||||
|
// If a query is provided use it, OR if a limit is NOT provided use ""
|
||||||
|
query: options?.query || (options?.limit ? undefined : ""),
|
||||||
|
limit: options?.limit || 0,
|
||||||
|
presences: options?.presences || false,
|
||||||
|
user_ids: options?.userIds,
|
||||||
|
nonce,
|
||||||
|
},
|
||||||
|
});
|
||||||
}) as Promise<Collection<string, DiscordenoMember>>;
|
}) as Promise<Collection<string, DiscordenoMember>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: finish implementing this
|
|
||||||
function requestAllMembers(
|
|
||||||
_guildId: string,
|
|
||||||
_shardId: number,
|
|
||||||
_resolve: (
|
|
||||||
value:
|
|
||||||
| Collection<string, DiscordenoMember>
|
|
||||||
| PromiseLike<Collection<string, DiscordenoMember>>,
|
|
||||||
) => void,
|
|
||||||
// deno-lint-ignore no-explicit-any
|
|
||||||
_options: any,
|
|
||||||
): void {
|
|
||||||
throw new Error("Function not implemented.");
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user