Skip to content

Commit

Permalink
Fix broken patches/finds
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuckyz committed Jul 11, 2024
1 parent 9f8c749 commit 04dce64
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/plugins/friendsSince/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const container = findByPropsLazy("memberSince");
const getCreatedAtDate = findByCodeLazy('month:"short",day:"numeric"');
const locale = findByPropsLazy("getLocale");
const lastSection = findByPropsLazy("lastSection");
const section = findLazy((m: any) => m.section !== void 0 && Object.values(m).length === 1);
const section = findLazy((m: any) => m.section !== void 0 && m.heading !== void 0 && Object.values(m).length === 2);

export default definePlugin({
name: "FriendsSince",
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/moreUserTags/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,14 +256,15 @@ export default definePlugin({
// in profiles
{
find: ",overrideDiscriminator:",
group: true,
replacement: [
{
// prevent channel id from getting ghosted
// it's either this or extremely long lookbehind
match: /user:\i,nick:\i,/,
replace: "$&moreTags_channelId,"
}, {
match: /,botType:(\i\((\i)\)),/g,
match: /,botType:(\i),(?<=user:(\i).+?)/g,
replace: ",botType:$self.getTag({user:$2,channelId:moreTags_channelId,origType:$1,location:'not-chat'}),"
}
]
Expand Down
28 changes: 15 additions & 13 deletions src/plugins/viewIcons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,24 @@ export default definePlugin({
},

patches: [
// Profiles Modal pfp
...[".MODAL,hasProfileEffect", ".FULL_SIZE,hasProfileEffect:"].map(find => ({
find,
// Avatar component used in User DMs "User Profile" popup in the right and Profiles Modal pfp
{
find: ".overlay:void 0,status:",
replacement: [
...[/"PRESS_VIEW_PROFILE".+?(?=children:)(?<=avatarSrc:(\i).+?)/, /avatarSrc:(\i),eventHandlers:(\i).+?"div",{...\2,/].map(match => ({

This comment has been minimized.

Copy link
@AutumnVN

AutumnVN Jul 13, 2024

Contributor

press view profile patch also blocks open profile from small profile popout, maybe we should drop it
the patch for dm profile avatar was added by me because i didnt know new profile makes it clickale to open profile lol, i thought it still does nothing, like old profile

This comment has been minimized.

Copy link
@moxie-coder

moxie-coder Jul 13, 2024

Contributor

yeah this is pretty annoying, since you can't view profiles without having to click profile from the context menu

This comment has been minimized.

Copy link
@Obsidianninja11

Obsidianninja11 Jul 14, 2024

Yeah. I made a fix for this (but people misunderstood it ig), but this pr broke it.
oh wait i fixed this blocking opening profile from right side dm panel

This comment has been minimized.

Copy link
@Vendicated

Vendicated Jul 14, 2024

Owner

it's already fixed in dev

match,
replace: "$&style:{cursor:\"pointer\"},onClick:()=>{$self.openImage($1)},"
}))
]
},
// Old Profiles Modal pfp
{
find: ".MODAL,hasProfileEffect",
replacement: {
match: /\{src:(\i)(?=,avatarDecoration)/,
replace: "{src:$1,onClick:()=>$self.openImage($1)"
}
})),
},
// Banners
...[".NITRO_BANNER,", "=!1,canUsePremiumCustomization:"].map(find => ({
find,
Expand All @@ -202,22 +212,14 @@ export default definePlugin({
'onClick:ev=>$1&&ev.target.style.backgroundImage&&$self.openImage($2),style:{cursor:$1?"pointer":void 0,'
}
})),
// User DMs "User Profile" popup in the right
// Old User DMs "User Profile" popup in the right
{
find: ".avatarPositionPanel",
replacement: {
match: /(avatarWrapperNonUserBot.{0,50})onClick:(\i\|\|\i)\?void 0(?<=,avatarSrc:(\i).+?)/,
replace: "$1style:($2)?{cursor:\"pointer\"}:{},onClick:$2?()=>{$self.openImage($3)}"
}
},
{
find: ".canUsePremiumProfileCustomization,{avatarSrc:",
replacement: {
match: /\.avatar,\i\.clickable\),onClick:\i,(?<=avatarSrc:(\i).+?)/,
replace: "$&style:{cursor:\"pointer\"},onClick:()=>{$self.openImage($1)},"

}
},
// Group DMs top small & large icon
{
find: /\.recipients\.length>=2(?!<isMultiUserDM.{0,50})/,
Expand Down

0 comments on commit 04dce64

Please sign in to comment.