Fix AlwaysAnimate

This commit is contained in:
Nuckyz 2023-10-28 17:43:27 -03:00
parent 4b958d17fd
commit af135b9245
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9

View file

@ -21,16 +21,30 @@ import definePlugin from "@utils/types";
export default definePlugin({ export default definePlugin({
name: "AlwaysAnimate", name: "AlwaysAnimate",
description: "Animates anything that can be animated, besides status emojis.", description: "Animates anything that can be animated",
authors: [Devs.FieryFlames], authors: [Devs.FieryFlames],
patches: [ patches: [
{ {
find: ".canAnimate", find: "canAnimate:",
all: true, all: true,
// Some modules match the find but the replacement is returned untouched
noWarn: true,
replacement: { replacement: {
match: /\.canAnimate\b/g, match: /canAnimate:.+?(?=([,}].*?\)))/g,
replace: ".canAnimate || true" 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"
} }
} }
] ]