Fix AlwaysAnimate
This commit is contained in:
		
							parent
							
								
									4b958d17fd
								
							
						
					
					
						commit
						af135b9245
					
				
					 1 changed files with 18 additions and 4 deletions
				
			
		| 
						 | 
					@ -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"
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue