From 8d24906b97ffa71131686999cdeb8461f2b555ad Mon Sep 17 00:00:00 2001 From: NekoCyan Date: Wed, 23 Nov 2022 23:50:09 +0700 Subject: [PATCH] fix(GuildMemberManager): delay to client.sleep. --- src/managers/GuildMemberManager.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/managers/GuildMemberManager.js b/src/managers/GuildMemberManager.js index 52dfb26..6fe072b 100644 --- a/src/managers/GuildMemberManager.js +++ b/src/managers/GuildMemberManager.js @@ -484,7 +484,7 @@ class GuildMemberManager extends CachedManager { } /** - * Fetches multiple members from the guild. + * Fetches multiple members from the guild in the channel. * @param {GuildTextChannelResolvable} channel The channel to get members from (Members has VIEW_CHANNEL permission) * @param {number} [offset=0] Start index of the members to get * @param {boolean} [double=false] Whether to use double range @@ -495,16 +495,15 @@ class GuildMemberManager extends CachedManager { * @example * const guild = client.guilds.cache.get('id'); * const channel = guild.channels.cache.get('id'); - * const delay = ms => new Promise(resolve => setTimeout(resolve, ms)); * // Overlap (slow) * for (let index = 0; index <= guild.memberCount; index += 100) { * await guild.members.fetchMemberList(channel, index, index !== 100).catch(() => {}); - * await delay(500); + * await client.sleep(500); * } * // Non-overlap (fast) * for (let index = 0; index <= guild.memberCount; index += 200) { * await guild.members.fetchMemberList(channel, index == 0 ? 100 : index, index !== 100).catch(() => {}); - * await delay(500); + * await client.sleep(500); * } * console.log(guild.members.cache.size); // will print the number of members in the guild */