mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-17 02:17:03 -04:00
more plugin fixes
This commit is contained in:
parent
1176896a1b
commit
2133823bd3
5 changed files with 47 additions and 5 deletions
|
@ -27,9 +27,9 @@ export default definePlugin({
|
|||
{
|
||||
find: "_messageAttachmentToEmbedMedia",
|
||||
replacement: {
|
||||
match: /\(\)\.container,children:[[^\]]*]\)},(.+?)\)};return/,
|
||||
replace: (_, accessories) =>
|
||||
`().container)},Vencord.Api.MessageAccessories._modifyAccessories([${accessories}],this.props))};return`,
|
||||
match: /(\(\)\.container\)?,children:)(\[[^\]]+\])(}\)\};return)/,
|
||||
replace: (_, pre, accessories, post) =>
|
||||
`${pre}Vencord.Api.MessageAccessories._modifyAccessories(${accessories},this.props)${post}`,
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
@ -46,11 +46,12 @@ export default definePlugin({
|
|||
{
|
||||
find: "currentPronouns:",
|
||||
all: true,
|
||||
noWarn: true,
|
||||
replacement: {
|
||||
match: /\(0,.{1,3}\.jsxs?\)\((.{1,10}),(\{[^[}]*currentPronouns:[^}]*(\w)\.pronouns[^}]*\})\)/,
|
||||
replace: (original, PronounComponent, pronounProps, fullProps) => {
|
||||
// UserSettings
|
||||
if (fullProps.includes("onPronounsChange")) return original;
|
||||
if (pronounProps.includes("onPronounsChange")) return original;
|
||||
|
||||
return `Vencord.Plugins.plugins.PronounDB.PronounsProfileWrapper(${PronounComponent}, ${pronounProps}, ${fullProps})`;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,10 @@ export interface Patch {
|
|||
plugin: string;
|
||||
find: string;
|
||||
replacement: PatchReplacement | PatchReplacement[];
|
||||
/** Whether this patch should apply to multiple modules */
|
||||
all?: boolean;
|
||||
/** Do not warn if this patch did no changes */
|
||||
noWarn?: boolean;
|
||||
predicate?(): boolean;
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ function patchPush() {
|
|||
|
||||
try {
|
||||
const newCode = code.replace(replacement.match, replacement.replace);
|
||||
if (newCode === code) {
|
||||
if (newCode === code && !replacement.noWarn) {
|
||||
logger.warn(`Patch by ${patch.plugin} had no effect (Module id is ${id}): ${replacement.match}`);
|
||||
if (IS_DEV) {
|
||||
logger.debug("Function Source:\n", code);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue