diff --git a/src/plugins/betterNotes/index.tsx b/src/plugins/betterNotes/index.tsx index da41b973..2183d98e 100644 --- a/src/plugins/betterNotes/index.tsx +++ b/src/plugins/betterNotes/index.tsx @@ -18,6 +18,7 @@ import { Settings } from "@api/Settings"; import { Devs } from "@utils/constants"; +import { canonicalizeMatch } from "@utils/patches"; import definePlugin, { OptionType } from "@utils/types"; import { findByPropsLazy } from "@webpack"; @@ -39,8 +40,12 @@ export default definePlugin({ match: /hideNote:.+?(?=([,}].*?\)))/g, replace: (m, rest) => { const destructuringMatch = rest.match(/}=.+/); - if (destructuringMatch == null) return "hideNote:!0"; - return m; + if (destructuringMatch) { + const defaultValueMatch = m.match(canonicalizeMatch(/hideNote:(\i)=!?\d/)); + return defaultValueMatch ? `hideNote:${defaultValueMatch[1]}=!0` : m; + } + + return "hideNote:!0"; } } }, @@ -52,10 +57,10 @@ export default definePlugin({ } }, { - find: ".Messages.NOTE}", + find: ".popularApplicationCommandIds,", replacement: { - match: /(?<=return \i\?)null(?=:\(0,\i\.jsxs)/, - replace: "$self.patchPadding(arguments[0])" + match: /lastSection:(!?\i)}\),/, + replace: "$&$self.patchPadding($1)," } } ], @@ -75,8 +80,8 @@ export default definePlugin({ } }, - patchPadding(e: any) { - if (!e.lastSection) return; + patchPadding(lastSection: any) { + if (!lastSection) return; return (
);