refactor!: move dirs outside of src/ (#2032)

This commit is contained in:
Skillz4Killz
2022-02-11 04:49:53 -05:00
committed by GitHub
parent 471ef5cb6c
commit 8aaea9f339
594 changed files with 84 additions and 66 deletions
+28
View File
@@ -0,0 +1,28 @@
import type { GuildMemberWithUser } from "../../types/members/guildMember.ts";
import type { ListGuildMembers } from "../../types/members/listGuildMembers.ts";
import type { Bot } from "../../bot.ts";
import { Collection } from "../../util/collection.ts";
/**
* Highly recommended to **NOT** use this function to get members instead use fetchMembers().
* REST(this function): 50/s global(across all shards) rate limit with ALL requests this included
* GW(fetchMembers): 120/m(PER shard) rate limit. Meaning if you have 8 shards your limit is 960/m.
*/
export async function getMembers(bot: Bot, guildId: bigint, options: ListGuildMembers & { memberCount: number }) {
const result = await bot.rest.runMethod<GuildMemberWithUser[]>(
bot.rest,
"get",
bot.constants.endpoints.GUILD_MEMBERS(guildId),
{
limit: options?.limit ?? options.memberCount,
after: options?.after,
},
);
return new Collection(
result.map((res) => {
const member = bot.transformers.member(bot, res, guildId, bot.transformers.snowflake(res.user.id));
return [member.id, member];
}),
);
}