fix guild fetch members result on large guilds

This commit is contained in:
Skillz
2020-09-02 01:01:51 -04:00
parent f4d23957cb
commit 22da662dc3
3 changed files with 5 additions and 8 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ name: Discordeno
description: >- description: >-
Discord Deno TypeScript API library wrapper(Officially vetted library by Discord Deno TypeScript API library wrapper(Officially vetted library by
Discord Team) https://discordeno.netlify.app Discord Team) https://discordeno.netlify.app
version: 8.4.1 version: 8.4.3
stable: true stable: true
files: files:
- ./src/**/* - ./src/**/*
+3 -2
View File
@@ -36,8 +36,9 @@ import { identifyPayload } from "../module/client.ts";
import { requestAllMembers } from "../module/shardingManager.ts"; import { requestAllMembers } from "../module/shardingManager.ts";
import { MemberCreatePayload } from "../types/member.ts"; import { MemberCreatePayload } from "../types/member.ts";
import { cache } from "../utils/cache.ts"; import { cache } from "../utils/cache.ts";
import { createMember } from "../structures/member.ts"; import { createMember, Member } from "../structures/member.ts";
import { urlToBase64 } from "../utils/utils.ts"; import { urlToBase64 } from "../utils/utils.ts";
import { Collection } from "../utils/collection.ts";
/** Gets an array of all the channels ids that are the children of this category. */ /** Gets an array of all the channels ids that are the children of this category. */
export function categoryChildrenIDs(guild: Guild, id: string) { export function categoryChildrenIDs(guild: Guild, id: string) {
@@ -210,7 +211,7 @@ export async function getMembersByQuery(
return new Promise((resolve) => { return new Promise((resolve) => {
requestAllMembers(guild, resolve, { query: name, limit }); requestAllMembers(guild, resolve, { query: name, limit });
}); }) as Promise<Collection<string, Member>>;
} }
/** Create an emoji in the server. Emojis and animated emojis have a maximum file size of 256kb. Attempting to upload an emoji larger than this limit will fail and return 400 Bad Request and an error message, but not a JSON status code. If a URL is provided to the image parameter, Discordeno will automatically convert it to a base64 string internally. */ /** Create an emoji in the server. Emojis and animated emojis have a maximum file size of 256kb. Attempting to upload an emoji larger than this limit will fail and return 400 Bad Request and an error message, but not a JSON status code. If a URL is provided to the image parameter, Discordeno will automatically convert it to a base64 string internally. */
+1 -5
View File
@@ -372,11 +372,7 @@ export async function handleDiscordPayload(
if (options.chunk_index + 1 === options.chunk_count) { if (options.chunk_index + 1 === options.chunk_count) {
fetchAllMembersProcessingRequests.delete(options.nonce); fetchAllMembersProcessingRequests.delete(options.nonce);
resolve( resolve(guild.members);
options.members.map((member) =>
guild.members.get(member.user.id)
),
);
} }
} }
} }