Files
discordeno/helpers/channels/threads/getThreadMembers.ts
ITOH 03996c5f58 refactor: revert "feat: base plugin lib idea (#2308)" (#2336)
* Revert "feat: base plugin lib idea (#2308)"

This reverts commit ffe7cdbc6f.

* fmt
2022-07-02 14:24:43 +01:00

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];
}));
}