From 0718b56f590204562596cc7f7167b16a1c78ef3f Mon Sep 17 00:00:00 2001 From: thororen <78185467+thororen1234@users.noreply.github.com> Date: Wed, 3 Dec 2025 12:22:40 -0500 Subject: [PATCH] Decor: Fix not displaying in multiple places (#3773) --- src/plugins/decor/index.tsx | 17 +++++++++++++++-- src/plugins/decor/ui/index.ts | 2 +- .../decor/ui/modals/ChangeDecorationModal.tsx | 4 ++-- .../decor/ui/modals/CreateDecorationModal.tsx | 2 +- src/utils/patches.ts | 2 +- 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/plugins/decor/index.tsx b/src/plugins/decor/index.tsx index 3fcc049f7..319bc14f6 100644 --- a/src/plugins/decor/index.tsx +++ b/src/plugins/decor/index.tsx @@ -91,11 +91,24 @@ export default definePlugin({ replacement: [ // Use Decor avatar decoration hook { - match: /(?<=\i\)\({avatarDecoration:)(\i)(?=,)(?<=currentUser:(\i).+?)/, + match: /(?<=\i\)\({avatarDecoration:)\i(?=,)(?<=currentUser:(\i).+?)/, replace: "$self.useUserDecorAvatarDecoration($1)??$&" } ] - } + }, + ...[ + '"Message Username"', // Messages + ".nameplatePreview,{", // Nameplate preview + "#{intl::ayozFl::raw}", // Avatar preview + ].map(find => ({ + find, + replacement: [ + { + match: /(?<=userValue.{0,25}void 0:)((\i)\.avatarDecoration)/, + replace: "$self.useUserDecorAvatarDecoration($2)??$1" + } + ] + })), ], settings, diff --git a/src/plugins/decor/ui/index.ts b/src/plugins/decor/ui/index.ts index ec9a9e74f..62040508f 100644 --- a/src/plugins/decor/ui/index.ts +++ b/src/plugins/decor/ui/index.ts @@ -10,5 +10,5 @@ import { extractAndLoadChunksLazy, findByPropsLazy } from "@webpack"; export const cl = classNameFactory("vc-decor-"); export const DecorationModalStyles = findByPropsLazy("modalPreview", "modalCloseButton", "spinner", "modal"); -export const requireAvatarDecorationModal = extractAndLoadChunksLazy(["initialSelectedDecoration:", /initialSelectedDecoration:\i,.{0,300}Promise\.all/]); +export const requireAvatarDecorationModal = extractAndLoadChunksLazy(["initialSelectedDecoration:", /initialSelectedDecoration:\i,.{0,300}\i\.e\(/]); export const requireCreateStickerModal = extractAndLoadChunksLazy(["stickerInspected]:"]); diff --git a/src/plugins/decor/ui/modals/ChangeDecorationModal.tsx b/src/plugins/decor/ui/modals/ChangeDecorationModal.tsx index df50c02a6..704648979 100644 --- a/src/plugins/decor/ui/modals/ChangeDecorationModal.tsx +++ b/src/plugins/decor/ui/modals/ChangeDecorationModal.tsx @@ -95,7 +95,7 @@ function ChangeDecorationModal(props: ModalProps) { const [tryingDecoration, setTryingDecoration] = useState(undefined); const isTryingDecoration = typeof tryingDecoration !== "undefined"; - const avatarDecorationOverride = tryingDecoration != null ? decorationToAvatarDecoration(tryingDecoration) : tryingDecoration; + const avatarDecoration = tryingDecoration != null ? decorationToAvatarDecoration(tryingDecoration) : tryingDecoration; const { decorations, @@ -197,7 +197,7 @@ function ChangeDecorationModal(props: ModalProps) { />
{isActiveDecorationPreset && Part of the {activeDecorationPreset.name} Preset} diff --git a/src/plugins/decor/ui/modals/CreateDecorationModal.tsx b/src/plugins/decor/ui/modals/CreateDecorationModal.tsx index e668f65ae..3c699de4f 100644 --- a/src/plugins/decor/ui/modals/CreateDecorationModal.tsx +++ b/src/plugins/decor/ui/modals/CreateDecorationModal.tsx @@ -115,7 +115,7 @@ function CreateDecorationModal(props: ModalProps) {
diff --git a/src/utils/patches.ts b/src/utils/patches.ts index c149765d5..c70249019 100644 --- a/src/utils/patches.ts +++ b/src/utils/patches.ts @@ -49,7 +49,7 @@ function canonicalizeMatchCompatString(str: string) { const re = /#{intl::([\w$+/]*)(?:::(\w+))?}/g; for (const match of str.matchAll(re)) { result += escapeRegex(str.slice(lastIndex, match.index)); - result += getCompatReplacement(match[1]); + result += match[2] === "raw" ? getReplacement(false, match[1]) : getCompatReplacement(match[1]); lastIndex = (match.index ?? 0) + match[0].length; } result += escapeRegex(str.slice(lastIndex));