diff options
author | Nuckyz <61953774+Nuckyz@users.noreply.github.com> | 2023-02-12 14:58:44 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-12 18:58:44 +0100 |
commit | 2489bc68315f4e2c7cd54eae7c64846d6d1218d9 (patch) | |
tree | 18db17dccadde59436b63003fd84bd2379591189 /src/plugins | |
parent | d95be1acbaa282c53508a33d85cdda2ea76c50da (diff) | |
download | Vencord-2489bc68315f4e2c7cd54eae7c64846d6d1218d9.tar.gz Vencord-2489bc68315f4e2c7cd54eae7c64846d6d1218d9.tar.bz2 Vencord-2489bc68315f4e2c7cd54eae7c64846d6d1218d9.zip |
Fix WhoReacted (#487)
Co-authored-by: Ven <vendicated@riseup.net>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/whoReacted.tsx | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/plugins/whoReacted.tsx b/src/plugins/whoReacted.tsx index a14ca3a..a260bac 100644 --- a/src/plugins/whoReacted.tsx +++ b/src/plugins/whoReacted.tsx @@ -32,12 +32,13 @@ const ReactionStore = findByPropsLazy("getReactions"); const queue = new Queue(); -function fetchReactions(msg: Message, emoji: ReactionEmoji) { +function fetchReactions(msg: Message, emoji: ReactionEmoji, type: number) { const key = emoji.name + (emoji.id ? `:${emoji.id}` : ""); return RestAPI.get({ url: `/channels/${msg.channel_id}/messages/${msg.id}/reactions/${key}`, query: { - limit: 100 + limit: 100, + type }, oldFormErrors: true }) @@ -46,18 +47,19 @@ function fetchReactions(msg: Message, emoji: ReactionEmoji) { channelId: msg.channel_id, messageId: msg.id, users: res.body, - emoji + emoji, + reactionType: type })) .catch(console.error) .finally(() => sleep(250)); } -function getReactionsWithQueue(msg: Message, e: ReactionEmoji) { - const key = `${msg.id}:${e.name}:${e.id ?? ""}`; +function getReactionsWithQueue(msg: Message, e: ReactionEmoji, type: number) { + const key = `${msg.id}:${e.name}:${e.id ?? ""}:${type}`; const cache = ReactionStore.__getLocalVars().reactions[key] ??= { fetched: false, users: {} }; if (!cache.fetched) { queue.unshift(() => - fetchReactions(msg, e) + fetchReactions(msg, e, type) ); cache.fetched = true; } @@ -104,7 +106,7 @@ export default definePlugin({ ); }, - _renderUsers({ message, emoji }: RootObject) { + _renderUsers({ message, emoji, type }: RootObject) { const forceUpdate = useForceUpdater(); React.useEffect(() => { const cb = (e: any) => { @@ -116,7 +118,7 @@ export default definePlugin({ return () => FluxDispatcher.unsubscribe("MESSAGE_REACTION_ADD_USERS", cb); }, [message.id]); - const reactions = getReactionsWithQueue(message, emoji); + const reactions = getReactionsWithQueue(message, emoji, type); const users = Object.values(reactions).filter(Boolean) as User[]; return ( |