Fix Badges & MessageLinkEmbeds (#383)

This commit is contained in:
ActuallyTheSun 2023-01-07 18:17:18 +02:00 committed by GitHub
parent 5a3fbbfb30
commit eecc555dac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View file

@ -73,7 +73,7 @@ export default definePlugin({
replace: (_, imageMap, badge) => `src: ${badge}.image ?? ${imageMap}[${badge}.key], ...${badge}.props,` replace: (_, imageMap, badge) => `src: ${badge}.image ?? ${imageMap}[${badge}.key], ...${badge}.props,`
}, },
{ {
match: /spacing:(\d{1,2}),children:(.{1,40}(.{1,2})\.jsx.+?(.{1,2})\.onClick.+?\)})},/, match: /spacing:(\d{1,2}),children:(.{1,40}(\i)\.jsx.+?(\i)\.onClick.+?\)})},/,
// if the badge provides it's own component, render that instead of an image // if the badge provides it's own component, render that instead of an image
// the badge also includes info about the user that has it (type BadgeUserArgs), which is why it's passed as props // the badge also includes info about the user that has it (type BadgeUserArgs), which is why it's passed as props
replace: (_, s, origBadgeComponent, React, badge) => replace: (_, s, origBadgeComponent, React, badge) =>

View file

@ -151,9 +151,8 @@ export default definePlugin({
match: /{"use strict";(.{0,10})\(\)=>(.{1,2})}\);/, match: /{"use strict";(.{0,10})\(\)=>(.{1,2})}\);/,
replace: '{"use strict";$1()=>$2,me:()=>messageEmbed});' replace: '{"use strict";$1()=>$2,me:()=>messageEmbed});'
}, { }, {
match: /function (.{1,2})\((.{1,2})\){var (.{1,2})=.{1,2}\.message,(.{1,2})=.{1,2}\.channel(.{0,300})\.embedCard(.{0,500})}\)}/, match: /function (.{1,2})\(.{1,2}\){var .{1,2}=.{1,2}\.message,.{1,2}=.{1,2}\.channel.{0,300}\.embedCard.{0,500}}\)}/,
replace: "function $1($2){var $3=$2.message,$4=$2.channel$5().embedCard$6})}\ replace: "$&;var messageEmbed={mle_AutomodEmbed:$1};"
var messageEmbed={mle_AutomodEmbed:$1};"
}] }]
} }
], ],