From af135b9245226013ebf1a56752da5d35dc5e59fe Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Sat, 28 Oct 2023 17:43:27 -0300 Subject: [PATCH] Fix AlwaysAnimate --- src/plugins/alwaysAnimate/index.ts | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/plugins/alwaysAnimate/index.ts b/src/plugins/alwaysAnimate/index.ts index f3ae27af..d53e5145 100644 --- a/src/plugins/alwaysAnimate/index.ts +++ b/src/plugins/alwaysAnimate/index.ts @@ -21,16 +21,30 @@ import definePlugin from "@utils/types"; export default definePlugin({ name: "AlwaysAnimate", - description: "Animates anything that can be animated, besides status emojis.", + description: "Animates anything that can be animated", authors: [Devs.FieryFlames], patches: [ { - find: ".canAnimate", + find: "canAnimate:", all: true, + // Some modules match the find but the replacement is returned untouched + noWarn: true, replacement: { - match: /\.canAnimate\b/g, - replace: ".canAnimate || true" + match: /canAnimate:.+?(?=([,}].*?\)))/g, + replace: (m, rest) => { + const destructuringMatch = rest.match(/}=.+/); + if (destructuringMatch == null) return "canAnimate:!0"; + return m; + } + } + }, + { + // Status emojis + find: ".Messages.GUILD_OWNER,", + replacement: { + match: /(?<=\.activityEmoji,.+?animate:)\i/, + replace: "!0" } } ]