mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-19 04:38:17 +00:00
feat(handlers/message): change getReactions() to use collection (#655)
* feat(handlers/message): change getReactions() to use collection * deno fmt
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
|||||||
MessageCreateOptions,
|
MessageCreateOptions,
|
||||||
UserPayload,
|
UserPayload,
|
||||||
} from "../../types/mod.ts";
|
} from "../../types/mod.ts";
|
||||||
|
import { Collection } from "../../util/collection.ts";
|
||||||
import { endpoints } from "../../util/constants.ts";
|
import { endpoints } from "../../util/constants.ts";
|
||||||
import { botHasChannelPermissions } from "../../util/permissions.ts";
|
import { botHasChannelPermissions } from "../../util/permissions.ts";
|
||||||
import { delay } from "../../util/utils.ts";
|
import { delay } from "../../util/utils.ts";
|
||||||
@@ -270,15 +271,12 @@ export async function getReactions(
|
|||||||
reaction: string,
|
reaction: string,
|
||||||
options?: DiscordGetReactionsParams,
|
options?: DiscordGetReactionsParams,
|
||||||
) {
|
) {
|
||||||
const result = (await RequestManager.get(
|
const users = (await RequestManager.get(
|
||||||
endpoints.CHANNEL_MESSAGE_REACTION(message.channelID, message.id, reaction),
|
endpoints.CHANNEL_MESSAGE_REACTION(message.channelID, message.id, reaction),
|
||||||
options,
|
options,
|
||||||
)) as UserPayload[];
|
)) as UserPayload[];
|
||||||
|
|
||||||
return Promise.all(result.map(async (res) => {
|
return new Collection(users.map((user) => [user.id, user]));
|
||||||
const member = await cacheHandlers.get("members", res.id);
|
|
||||||
return member || res;
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Edit the message. */
|
/** Edit the message. */
|
||||||
|
|||||||
Reference in New Issue
Block a user