From 43ba1a4a5e74e066e32dcbd627906cd4db9eac02 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Tue, 1 Jul 2025 23:18:12 +0200 Subject: [PATCH] TypingIndicator: fix TypingTweaks compatibility --- src/plugins/appleMusic.desktop/native.ts | 1 - src/plugins/typingIndicator/index.tsx | 13 ++++++++----- src/plugins/typingTweaks/index.tsx | 10 +++++----- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/plugins/appleMusic.desktop/native.ts b/src/plugins/appleMusic.desktop/native.ts index b73d0733..c7dd40d2 100644 --- a/src/plugins/appleMusic.desktop/native.ts +++ b/src/plugins/appleMusic.desktop/native.ts @@ -44,7 +44,6 @@ const getToken = async () => { return token; }; -getToken().then(console.log); async function fetchRemoteData({ id, name, artist, album }: { id: string, name: string, artist: string, album: string; }) { if (id === cachedRemoteData?.id) { if ("data" in cachedRemoteData) return cachedRemoteData.data; diff --git a/src/plugins/typingIndicator/index.tsx b/src/plugins/typingIndicator/index.tsx index a5c9f49c..160b002d 100644 --- a/src/plugins/typingIndicator/index.tsx +++ b/src/plugins/typingIndicator/index.tsx @@ -69,26 +69,29 @@ function TypingIndicator({ channelId, guildId }: { channelId: string; guildId: s const myId = UserStore.getCurrentUser()?.id; - const typingUsersArray = Object.keys(typingUsers).filter(id => id !== myId && !(RelationshipStore.isBlocked(id) && !settings.store.includeBlockedUsers)); + const typingUsersArray = Object.keys(typingUsers).filter(id => + id !== myId && !(RelationshipStore.isBlocked(id) && !settings.store.includeBlockedUsers) + ); + const [a, b, c] = typingUsersArray; let tooltipText: string; switch (typingUsersArray.length) { case 0: break; case 1: { - tooltipText = getIntlMessage("ONE_USER_TYPING", { a: getDisplayName(guildId, typingUsersArray[0]) }); + tooltipText = getIntlMessage("ONE_USER_TYPING", { a: getDisplayName(guildId, a) }); break; } case 2: { - tooltipText = getIntlMessage("TWO_USERS_TYPING", { a: getDisplayName(guildId, typingUsersArray[0]), b: getDisplayName(guildId, typingUsersArray[1]) }); + tooltipText = getIntlMessage("TWO_USERS_TYPING", { a: getDisplayName(guildId, a), b: getDisplayName(guildId, b) }); break; } case 3: { - tooltipText = getIntlMessage("THREE_USERS_TYPING", { a: getDisplayName(guildId, typingUsersArray[0]), b: getDisplayName(guildId, typingUsersArray[1]), c: getDisplayName(guildId, typingUsersArray[2]) }); + tooltipText = getIntlMessage("THREE_USERS_TYPING", { a: getDisplayName(guildId, a), b: getDisplayName(guildId, b), c: getDisplayName(guildId, c) }); break; } default: { tooltipText = Settings.plugins.TypingTweaks.enabled - ? buildSeveralUsers({ a: getDisplayName(guildId, typingUsersArray[0]), b: getDisplayName(guildId, typingUsersArray[1]), count: typingUsersArray.length - 2 }) + ? buildSeveralUsers({ a: UserStore.getUser(a), b: UserStore.getUser(b), count: typingUsersArray.length - 2, guildId }) : getIntlMessage("SEVERAL_USERS_TYPING"); break; } diff --git a/src/plugins/typingTweaks/index.tsx b/src/plugins/typingTweaks/index.tsx index b20840f2..1ecf9521 100644 --- a/src/plugins/typingTweaks/index.tsx +++ b/src/plugins/typingTweaks/index.tsx @@ -22,7 +22,7 @@ import { Devs } from "@utils/constants"; import { openUserProfile } from "@utils/discord"; import definePlugin, { OptionType } from "@utils/types"; import { Avatar, GuildMemberStore, React, RelationshipStore } from "@webpack/common"; -import { Channel, User } from "discord-types/general"; +import { User } from "discord-types/general"; import { PropsWithChildren } from "react"; import managedStyle from "./style.css?managed"; @@ -45,12 +45,12 @@ const settings = definePluginSettings({ } }); -export const buildSeveralUsers = ErrorBoundary.wrap(({ a, b, count, channel }: { a: User, b: User, count: number; channel: Channel; }) => { +export const buildSeveralUsers = ErrorBoundary.wrap(({ a, b, count, guildId }: { a: User, b: User, count: number; guildId: string; }) => { return ( <> - + {", "} - + {", "} and {count} others are typing... @@ -115,7 +115,7 @@ export default definePlugin({ // Adds the alternative formatting for several users typing match: /(,{a:(\i),b:(\i),c:\i}\):\i\.length>3&&\(\i=)\i\.\i\.string\(\i\.\i#{intl::SEVERAL_USERS_TYPING}\)(?<=(\i)\.length.+?)/, replace: (_, rest, a, b, users) => - `${rest}$self.buildSeveralUsers({ a: ${a}, b: ${b}, count: ${users}.length - 2, channel: arguments[0]?.channel })`, + `${rest}$self.buildSeveralUsers({ a: ${a}, b: ${b}, count: ${users}.length - 2, channel: arguments[0]?.channel?.guild_id })`, predicate: () => settings.store.alternativeFormatting } ]