mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
add: better return
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
import { cacheHandlers } from "../../../cache.ts";
|
||||
import { rest } from "../../../rest/rest.ts";
|
||||
import { ThreadMember } from "../../../types/channels/threads/thread_member.ts";
|
||||
import { Errors } from "../../../types/discordeno/errors.ts";
|
||||
import { DiscordGatewayIntents } from "../../../types/gateway/gateway_intents.ts";
|
||||
import { Collection } from "../../../util/collection.ts";
|
||||
import { endpoints } from "../../../util/constants.ts";
|
||||
import { botHasChannelPermissions } from "../../../util/permissions.ts";
|
||||
import { threadMemberModified } from "../../../util/transformers/thread_member_modified.ts";
|
||||
import { ws } from "../../../ws/ws.ts";
|
||||
|
||||
/** Returns thread members objects that are members of the thread. */
|
||||
@@ -20,5 +23,9 @@ export async function getThreadMembers(threadId: bigint) {
|
||||
throw new Error(Errors.CANNOT_GET_MEMBERS_OF_AN_UNJOINED_PRIVATE_THREAD);
|
||||
}
|
||||
|
||||
return await rest.runMethod("get", endpoints.THREAD_MEMBERS(threadId));
|
||||
const result = await rest.runMethod<ThreadMember[]>("get", endpoints.THREAD_MEMBERS(threadId));
|
||||
|
||||
const members = result.map((member) => threadMemberModified(member));
|
||||
|
||||
return new Collection(members.map((member) => [member.id, member]));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user