mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
fix: intents checking bugs
This commit is contained in:
@@ -17,7 +17,8 @@ import { ws } from "../../ws/ws.ts";
|
|||||||
*/
|
*/
|
||||||
export function fetchMembers(guildId: bigint, shardId: number, options?: Omit<RequestGuildMembers, "guildId">) {
|
export function fetchMembers(guildId: bigint, shardId: number, options?: Omit<RequestGuildMembers, "guildId">) {
|
||||||
// You can request 1 member without the intent
|
// You can request 1 member without the intent
|
||||||
if ((!options?.limit || options.limit > 1) && !(ws.identifyPayload.intents & DiscordGatewayIntents.GuildMembers)) {
|
// Check if intents is not 0 as proxy ws won't set intents in other instances
|
||||||
|
if (ws.identifyPayload.intents && (!options?.limit || options.limit > 1) && !(ws.identifyPayload.intents & DiscordGatewayIntents.GuildMembers)) {
|
||||||
throw new Error(Errors.MISSING_INTENT_GUILD_MEMBERS);
|
throw new Error(Errors.MISSING_INTENT_GUILD_MEMBERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ import { ws } from "../../ws/ws.ts";
|
|||||||
* GW(fetchMembers): 120/m(PER shard) rate limit. Meaning if you have 8 shards your limit is 960/m.
|
* GW(fetchMembers): 120/m(PER shard) rate limit. Meaning if you have 8 shards your limit is 960/m.
|
||||||
*/
|
*/
|
||||||
export async function getMembers(guildId: bigint, options?: ListGuildMembers & { addToCache?: boolean }) {
|
export async function getMembers(guildId: bigint, options?: ListGuildMembers & { addToCache?: boolean }) {
|
||||||
if (!(ws.identifyPayload.intents && DiscordGatewayIntents.GuildMembers)) {
|
// Check if intents is not 0 as proxy ws won't set intents in other instances
|
||||||
|
if (ws.identifyPayload.intents && !(ws.identifyPayload.intents & DiscordGatewayIntents.GuildMembers)) {
|
||||||
throw new Error(Errors.MISSING_INTENT_GUILD_MEMBERS);
|
throw new Error(Errors.MISSING_INTENT_GUILD_MEMBERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user