fix(MoreStickers): MoreSticker button (#128)

This commit is contained in:
leko 2025-01-26 23:21:27 +08:00 committed by GitHub
parent de1b74f6c7
commit 2d3032330f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -32,7 +32,7 @@ export default definePlugin({
patches: [ patches: [
{ {
find: "#{intl::STICKER_BUTTON_LABEL}", find: "ChannelStickerPickerButton",
replacement: [{ replacement: [{
match: /(children:\(0,\i\.jsx\)\()([\w.]+?)(,{innerClassName.{10,30}\.stickerButton)/, match: /(children:\(0,\i\.jsx\)\()([\w.]+?)(,{innerClassName.{10,30}\.stickerButton)/,
replace: (_, head, button, tail) => { replace: (_, head, button, tail) => {
@ -56,7 +56,7 @@ export default definePlugin({
{ {
find: ".gifts)", find: ".gifts)",
replacement: { replacement: {
match: /\(null===\(\i=\i\.stickers\).*?(\i)\.push\((\(0,\i\.jsx\))\((.+?),{disabled:\w,type:(\i)},"sticker"\)\)/, match: /,.{0,5}\(null===\(\w=\w\.stickers\)\|\|void 0.*?(\w)\.push\((\(0,\w\.jsx\))\((.+?),{disabled:\w,type:(\w)},"sticker"\)\)\)/,
replace: (m, _, jsx, compo, type) => { replace: (m, _, jsx, compo, type) => {
const c = "arguments[0].type"; const c = "arguments[0].type";
return `${m},${c}?.submit?.button&&${_}.push(${jsx}(${compo},{disabled:!${c}?.submit?.button,type:${type},stickersType:"stickers+"},"stickers+"))`; return `${m},${c}?.submit?.button&&${_}.push(${jsx}(${compo},{disabled:!${c}?.submit?.button,type:${type},stickersType:"stickers+"},"stickers+"))`;
@ -64,7 +64,7 @@ export default definePlugin({
} }
}, },
{ {
find: "role:\"tablist\",\"aria-label\":", find: `role:"tablist","aria-label":`,
replacement: { replacement: {
match: /role:"tablist",.*?,?"aria-label":.+?\),children:(\[.*?\)\]}\)}\):null,)(.*?closePopout:\w.*?:null)/s, match: /role:"tablist",.*?,?"aria-label":.+?\),children:(\[.*?\)\]}\)}\):null,)(.*?closePopout:\w.*?:null)/s,
replace: m => { replace: m => {