mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-01 16:30:08 +00:00
19 lines
622 B
TypeScript
19 lines
622 B
TypeScript
import type { Bot } from "../../../bot.ts";
|
|
import { DiscordThreadMember } from "../../../types/discord.ts";
|
|
import { Collection } from "../../../util/collection.ts";
|
|
|
|
/** Returns thread members objects that are members of the thread. */
|
|
export async function getThreadMembers(bot: Bot, threadId: bigint) {
|
|
const result = await bot.rest.runMethod<DiscordThreadMember[]>(
|
|
bot.rest,
|
|
"GET",
|
|
bot.constants.routes.THREAD_MEMBERS(threadId),
|
|
);
|
|
// return result;
|
|
|
|
return new Collection(result.map((res) => {
|
|
const member = bot.transformers.threadMember(bot, res);
|
|
return [member.id, member];
|
|
}));
|
|
}
|