Skip to content

Commit

Permalink
Stickers+: fix regex
Browse files Browse the repository at this point in the history
  • Loading branch information
lekoOwO committed Dec 9, 2023
1 parent 68bb619 commit 422b4af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/plugins/moreStickers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default definePlugin({
replacement: {
match: /role:"tablist",.+?\.Messages\.EXPRESSION_PICKER_CATEGORIES_A11Y_LABEL,children:(\[.*?\)\]}\)}\):null,)(.*?closePopout:\w.*?:null)/s,
replace: m => {
const stickerTabRegex = /(\w+)\?(\(.+?\))\((.{1,2}),.*?isActive:(.)===.*?children:(.{1,10}Messages.EXPRESSION_PICKER_STICKER).*?:null/s;
const stickerTabRegex = /(\w+?)\?(\([^()]+?\))\((\w{1,2}),{.{0,128},isActive:(\w{1,2})===.{1,150},children:(.{1,10}Messages.EXPRESSION_PICKER_STICKER).*?:null/s;
const res = m.replace(stickerTabRegex, (_m, canUseStickers, jsx, tabHeaderComp, currentTab, stickerText) => {
const isActive = `${currentTab}==="stickers+"`;
return (
Expand All @@ -94,7 +94,7 @@ export default definePlugin({
);
});

return res.replace(/:null,((.)===.*?\.STICKER&&\w+\?(\(.*?\)).*?(\{.*?,onSelectSticker:.*?\})\):null)/s, (_, _m, currentTab, jsx, props) => {
return res.replace(/:null,((.{1,200})===.{1,30}\.STICKER&&\w+\?(\([^()]{1,10}\)).{1,15}?(\{.*?,onSelectSticker:.*?\})\):null)/s, (_, _m, currentTab, jsx, props) => {
return `:null,${currentTab}==="stickers+"?${jsx}($self.moreStickersComponent,${props}):null,${_m}`;
});
}
Expand Down

0 comments on commit 422b4af

Please sign in to comment.