#๐Ÿ‘พ-core-development

1 messages ยท Page 45 of 1

austere talon
#

i think it's just the tabs on top

#

like friends, library, parental controls, etc

nocturne haven
#

oh right

#

my dementia is hitting stage 5

charred monolithBOT
austere talon
#

you better work

desert cosmos
#

\i

austere talon
#

iVencord just dropped

#

new apple product

charred monolithBOT
nocturne haven
austere talon
#

IT WORKS

#

HOLY SHIT

#

I thought it didnt work but i realised i just didnt have any dms pinned

#

LETS GOOOO

#

wow this is so much easier than my old method

#

this was my old code

#

horrible

nocturne haven
#

could be worse

austere talon
#

well

#

in BD land

#

with monkeypatching

#

but with regex patches you can usually avoid having to walk any react trees

#

that's one of the nice aspects of regex patches

nocturne haven
#

I've even seen worse monkey patching than this

austere talon
#

but wow this is actually so simple

#

thanks

nocturne haven
#

so I don't even bother adding it atm

austere talon
#

yeah

#

im not saying u should add it :P

#

both ways of patching have their upsides

#

regex patching is very dangerous if u dont know what you're doing

nocturne haven
#

tbf, back in the day, monkey patching was the new stuff, I guess BD's getting old lol

austere talon
#

cause it can easily brick discord

austere talon
nocturne haven
#

dom manipulation, observers, jQuery hell

austere talon
#

OH NO

austere talon
#

minus jquery

nocturne haven
#

I mean, they weren't dangerous at all, no react crashes etc. it's just not very performant

austere talon
#

i love arguments, it's so convenient for us

nocturne haven
austere talon
#

oh BD initially used dom

nocturne haven
#

yes, one of BD's devs also "invented" react patching

#

also tbf, this was pretty much electron v8 times, you never actually had any OOM crashes or any sort of shit like this

nocturne haven
charred monolithBOT
austere talon
#

okay i got it to work

#

but

#

it's rendering many times for some reason

nocturne haven
#

missing a key?

austere talon
#

no

#

im not creating any ui myself

charred monolithBOT
austere talon
grave mangoBOT
# austere talon https://github.com/Vendicated/Vencord/blob/pinDms/src/plugins/pinDms/index.tsx#L...

**index.tsx: **Lines 37-70

usePinCount() {
    const pinnedDms = usePinnedDms();
    return pinnedDms.size;
},

getChannel(idx: number) {
    return ChannelStore.getChannel(getPinAt(idx));
},

patches: [
    // Patch DM list
    {
        find: ".privateChannelsHeaderContainer,",
        replacement: [
            {
                match: /sections:\[\i,/,
                replace: "$&$self.usePinCount(),"
            },
            {
                match: /children:(\i\.\i\.Messages.DIRECT_MESSAGES)(?<=renderSection=function\((\i)\).+?)/,
                replace: "children:$2.section===1?'Pinned DMs':$1"
            },
            {
                // inside renderDM: channel=channels[channelIds[row]]
                match: /(?<=preRenderedChildren,\i=)(\i\[\i\[\i\]\])/,
                // section 1 is us, manually get our own channel
                replace: "arguments[0]===1?$self.getChannel(arguments[1]):$1"
            },
            {
                match: /channel:\i,selected:/,
                replace: "inPins:arguments[0]===1,$&"
            }
        ]
    },
austere talon
#

just these

#

the first patch adds our pin count to the sections array, the second makes the header render our own text instead of "Direct Messages", the third one just patches discord's logic for obtaining channel from section, the last one adds a prop

#

oh perhaps

#

i don't remove the original dms

#

so there will be duplicate keys

#

now its somehow even more broken

#

oh

#

i need () dont i

#

yeah lol

#

ayy that fixed it

#

why is this shit so pain to work with

charred monolithBOT
austere talon
#

also there's some weird bug where when u start the app on dms tab it breaks and forever shows loading

#

any idea why this could be happening? @nocturne haven ๐Ÿ˜ตโ€๐Ÿ’ซ

#

god this component is gonna give me ptsd

nocturne haven
#

ah, is it maybe because it does shit when dms aren't loaded yet?

charred monolithBOT
austere talon
#

maybe i should use a hook?

#

so that it rerenders if channels loaded

#

but i would assume discord can already do that eeeh

#

well I'm using ChannelStore manually

#

maybe i should use the object used by the dm list

#

that didnt work

#

so weird

#

okay so the first time it calls it, channels aren't loaded, but then it calls again and the channels are there

charred monolithBOT
austere talon
#

If you have DMs open as initial page, it infinitely loads

I'm going crazy someone help me figure this out

#

I'm just using Discord's data so it can't be that my data is stale

nocturne haven
#

seems like it doesn't catch up a re-render

austere talon
#

it really shouldn't cause im not stopping discord from calling any hooks

#

but yeah

nocturne haven
#

simple fix trolley

austere talon
#

I GOT IT @nocturne haven

#

wait i didnt

#

????

nocturne haven
#

trolled

austere talon
#

grrr

jagged cloak
#

discord doing some trolling

austere talon
nocturne haven
#

yeah, that seems like a simple solution

#

haven't got the bug with that

austere talon
#

wow that's...

#

it works yeah

#

thank u so much

#

how did you evenfigure that out

#

i dont think i would have found that

nocturne haven
#

discord specifically checks for for the 2nd item in the array if no dms are loaded

austere talon
#

waaait

#

i had a patch fixing that tho

nocturne haven
#

๐Ÿคทโ€โ™‚๏ธ no clue

austere talon
#

shouldn't the -1 fix that?

nocturne haven
#

I thought "if it works by default, why don't I let it think it's default sections?"

austere talon
#

that doesn't care if section is 1 or 2 tho

#

PAGES = 0

#

I'm soso confused lol

#

magic

nocturne haven
austere talon
#

waitt

#

i think i know why

#

it doesn't render empty sections

#

wow yeah

austere talon
#

wait no

#

discord is legit trolling me

#

okay idk lol

#

i will just use your fix

#

thansk again

charred monolithBOT
nocturne haven
#

np ๐Ÿ‘

austere talon
#

now its just this

#

but should be easy probably

frail skyBOT
#
Bad Patches

WebContextMenus (had no effect):
ID: 638525
Match: /(?<=showApplicationCommandSuggestions;)if\(![A-Za-z_$][\w$]*\.[A-Za-z_$][\w$]*\)/

WebContextMenus (had no effect):
ID: 638525
Match: /("submit-button".+?)(\(0,[A-Za-z_$][\w$]*\.jsx\)\([A-Za-z_$][\w$]*\.MenuGroup,\{children:[A-Za-z_$][\w$]*\}\),){2}/

DisableDMCallIdle (found no module):
ID: -
Match: .Messages.BOT_CALL_IDLE_DISCONNECT

Bad Starts

None

Discord Errors

JSHandle@error

#
Bad Patches

WebContextMenus (had no effect):
ID: 638525
Match: /(?<=showApplicationCommandSuggestions;)if\(![A-Za-z_$][\w$]*\.[A-Za-z_$][\w$]*\)/

WebContextMenus (had no effect):
ID: 638525
Match: /("submit-button".+?)(\(0,[A-Za-z_$][\w$]*\.jsx\)\([A-Za-z_$][\w$]*\.MenuGroup,\{children:[A-Za-z_$][\w$]*\}\),){2}/

DisableDMCallIdle (found no module):
ID: -
Match: .Messages.BOT_CALL_IDLE_DISCONNECT

Bad Starts

None

Discord Errors

JSHandle@error

austere talon
#

i checked all window listeners and searched for ArrowUp

#

discord deranged code again

charred monolithBOT
austere talon
#

found it

lament nimbus
#

btw I saw pronoundb local pronouns got closed because nea forgot about it lol, did anyone else start that because I kind of want to do it (if there is an api now it would be 1000x easier)

austere talon
#

i dont think so

lament nimbus
#

cool

#

now to remember where I put my vencord repo

austere talon
lament nimbus
#

where is the armcord config stored

austere talon
#

just use vencord desktop

lament nimbus
#

nvm found the button in settings

lament nimbus
shut socket
#

hi

austere talon
#

yes

lament nimbus
#

maybe later

austere talon
lament nimbus
#

oh fancy

#

you really did a ton of stuff since I last checked

austere talon
#

yeah

lament nimbus
#

I should install the vscode ext

austere talon
#

I've been daily driving it

#

it works really well

#

only vc is broken lol

#

and according to zt ping sounds sometimes dont play but they work fine for me lol

#

okay i can't find the logic for alt up/down that switches to prev/next channel

lament nimbus
#

publish the extension to openvsx smh

austere talon
#

and can't be bothered to find it

austere talon
#

open pr :D

lament nimbus
#

because vscodium + idk its probably on the website somewhere

austere talon
#

yeah

#

already reading

#

minor inconvenience

#

you will publish to openvsx for me

lament nimbus
#

guh

#

I could make a release workflow if you really want

austere talon
#

i just put a breakpoint in transitionTo, idk why i didnt think of that earlier ๐Ÿณ๏ธโ€โšง๏ธ

lament nimbus
#

now to see how horribly outdated my vencord is

austere talon
#
function S(e) {
    var t, n = c.Z.getState(), r = n.channelId, o = n.path, i = n.basePath, a = p.Z.getPrivateChannelIds(), u = __OVERLAY__ ? a : b(v()).concat(b(a)), l = (null == r ? (t = null != o ? o : i,
    v().findIndex((function(e) {
        return t.startsWith(e)
    }
    ))) : null != r ? u.indexOf(r) : 0) + e;
    l >= u.length ? l = 0 : l < 0 && (l = u.length - 1);
    var s, f, h = u[l];
    v().includes(h) ? (s = h,
    f = d.Z.getCurrentRoute(),
    s === E.Z5c.APPLICATION_STORE && null != f ? (0,
    y.z)(f) : (0,
    y.z)(s)) : _(E.ME, h)
}
lament nimbus
austere talon
#

i love unreadable code

lament nimbus
#

ykw im switching to vencord desktop its probably easier than creating a singular symlink (no its not but who cares)

charred monolithBOT
lament nimbus
#

IT HAS SHIGGY SPLASH ok I regret nothing

shut socket
#

hey can someone help me

fleet depot
shut socket
fleet depot
#

well either way don't ask to ask

shut socket
nocturne haven
fleet depot
#

oh i missed it then

shut socket
#

Yeah I deleted them after I figured it out like right after I asked

fleet depot
#

always a good time

lament nimbus
#

ok vencord desktop setup, dev time

shut socket
#

I see a Message Accessories API plugin, Is that something I can use?

#

I'm looking to just modify the appearance of a PDF embed

turbid hatch
#

for a custom embed, you might want to look at the messagelinkembeds plugin @shut socket

#

that has an example on how you can do it

#

but overall yes messageaccessories is what you would need

shut socket
turbid hatch
#

^^

charred monolithBOT
#

Hi!
I understand that adding this feature might sacrifice some options if itโ€™s enabled as I said in my post that it might be itโ€™s own plugin if itโ€™s too different, along with platform emulator features if possible for extra customization and privacy

Regarding its customization all I know for certain that is customizable because of the replit is that you can change the text above the โ€œwatchโ€ button and possibly the location of where the button takes you because you donโ€™t need to link your ...

austere talon
#

holy fuck

#

i finally did it

#

(that was from me spam switching dms to make sure it works lol)

#

@limber skiff review? :3

charred monolithBOT
austere talon
shut socket
charred monolithBOT
austere talon
#

@nocturne haven do u want me to include u in the plugin authors list

#

cause u helped me :P

nocturne haven
#

It was just a tiny snippet though

cunning canyon
limber skiff
lament nimbus
#

I love how react renders things like 50 times when you click a single thing

nocturne haven
nocturne haven
austere talon
lament nimbus
#

what approach

austere talon
#
const seen = new WeakSet()
const ContextMenuPatch = (children, props) => {
  if (seen.has(children)) return;
  seen.add(children);
  ...
}
#

to not add ur menu item 5 million times

lament nimbus
#

oh to make it only go once

#

yeah

austere talon
#

yeah

lament nimbus
#

ok

austere talon
#

otherwise it will add it dozens of times lmao

austere talon
#

just a few authors

nocturne haven
#

Fair I guess

austere talon
lament nimbus
#

you are an honorary author to all of them because you made vencord

nocturne haven
#

The plugin was only possible because you made [insert api] api

austere talon
#

true

charred monolithBOT
austere talon
#

hmm how would i best add reordering

#

maybe just open some modal

#

now u have cute badge

limber skiff
lament nimbus
#

woooo I have successfully added a button to the menu that does absolutely nothing

#

time to do a little modalling

austere talon
#

does this feel intuitive

#

it's way easier than anything else

lament nimbus
#

mostly

#

as long as you don't have 50 pinned dms to click up through

austere talon
#

why would u have so many dms

lament nimbus
#

I don't

charred monolithBOT
lament nimbus
#

gonna be honest don't know how I managed to do this

austere talon
#

why don't u use a context menu for this

lament nimbus
#

no clue where the random letters came from

lament nimbus
#

hm

#

good point

austere talon
#

like this

austere talon
#

you can use radio

lament nimbus
#

yeah

austere talon
#

look at the greetStickerPicker plugin

#

its file is named welcomeStickerPicker lol

#

lol i just realised i accidently put a penis in GreetStickerPicker

limber skiff
#

you what

austere talon
grave mangoBOT
austere talon
#

<=%

limber skiff
#

lmao

austere talon
#

not even intended

limber skiff
#

what does the % do

austere talon
#

nothing its just their code

limber skiff
#

oh

lament nimbus
#

you think its safe to just not care about fetching the pronouns and use the cached version only for the radio menu?

austere talon
lament nimbus
#

its probably rendered & fetched by then I would assume

austere talon
#

uh

#

probably

#

but u could just useAwaiter to be safe if u wanna

shut socket
#

Anyone encounter this issue?
I am trying to frame a file

Refused to frame 'https://drive.google.com/' because it violates the following Content Security Policy directive: "frame-src https://discordapp.com/domain-migration discord: 
lament nimbus
#

can I use react functions from inside the patch

austere talon
#

why in the world are u trying to frame that

#

what are u doing

lament nimbus
#

pdf viewer

shut socket
#

^

lament nimbus
#

cool

austere talon
#
doThing() {
  return <div>banana</div>
}

replace: "$self.doThing()"
lament nimbus
#

(I meant the ctx menu patch)

austere talon
#

oh

#

yeah lol

#

well actually

#

im not fully sure

lament nimbus
#

Id assume not

#

time to try it and see โ„ข๏ธ

austere talon
#

you can always just

#
function MyHooker() {
  useState()
}

// in patch
children.push(<MyHooker />)
#

you can use hooks in any context that has React.createElement somewhere along the callstack

#

however you should usually create your new React component context if u wanna add to discords ui

#

because conditional hooks (that only sometimes run) cause errors

#

so you either need to make sure ur hook always runs or make a new react component like i just showed

lament nimbus
#

yeah ill just do a wrapper component

charred monolithBOT
limber skiff
#

cuz it lets you clean up how pin dms context menu works

austere talon
#

guh

#

what does it do

#

ah u just did the WeakSet fix in the context menu api itself

#

tbh idk if that's a good idea? maybe some plugins might need the updates

#

as in, if it's rerendered some props might have changed

#

eh it's fine

#

we can change it if it ever causes issues trolley

#

oh wait it had both settings and options?

#

yeah lol

#

weird

#

holy cow u spelt whether correctly this time

#

character development

woeful sable
#

weather

lament nimbus
#

I am stupid at react, how do I make the state update when the awaiter changes

austere talon
#

which state?

#

selected?

lament nimbus
#

yeah

austere talon
#

update how?

lament nimbus
#

update the value

austere talon
#

oh i see

lament nimbus
#

so when the fetch finishes I can change the selected value

austere talon
#

using an effect

#
useEffect(() => {
  if (defaultPronouns && !selected) setSelected(defaultPronouns);
}, [defaultPronouns]);
#

i added the !selected so it doesn't override the user's choice

lament nimbus
#

thanks

austere talon
#

why is that branch called e

#

insan

shut socket
#

alr so iframes are cancer

#

discord and their content policy

austere talon
#

wow nice update

#

|| (jk i had a breakpoint somewhere lmao) ||

#

why are there two replys

lament nimbus
#

lmao
right clicks on profile pic
Helful notice in corner: Discord has crashed

austere talon
#

clueless

austere talon
lament nimbus
#

Menu API only allows Items and groups of Items as children. Received function UserContextMenuComponent(props)
trolley

limber skiff
limber skiff
austere talon
#

idk u tell me

limber skiff
#

wtf

austere talon
#

it only happens with ur pr

limber skiff
#

too lazy to think of a name

#

okay let me debug it

austere talon
#

oh

#

silly you

limber skiff
#

oh

austere talon
#

that search is searching for discord's element

limber skiff
#

that one was actually needed

#

lmao

austere talon
#

okay i restored it

#

ye fixed

austere talon
#

oh right

#

u cant actually make a wrapper component i forgot

#

try just not using a wrapper

charred monolithBOT
lament nimbus
austere talon
#

lol

lament nimbus
austere talon
#

fix!!

charred monolithBOT
lament nimbus
#

well I take the "it renders" part back, im stupid

#

and it doesn't use the correct default anyways

charred monolithBOT
lament nimbus
#

the thing with custom greet is that it creates its own menu

#

so it works with a custom component

austere talon
#

yeah

lament nimbus
#

im just not going to try not fetching it
its either cached or who cares

austere talon
#

@cunning canyon is UsrBG stable now

austere talon
#

i think thats sensible

cunning canyon
#

ig

austere talon
#

wdym ig ๐Ÿ˜ญ

#

yes or no

#

did u fix the crashes and stuff

cunning canyon
#

yes

austere talon
#

your css selectors seem oooverly complex

#

are u sure they can't be simplified

limber skiff
#

what does snapshot mean @austere talon

austere talon
limber skiff
#

oh

austere talon
#

wtf my old USRBG banner is kinda cute

lament nimbus
#

now to make it actually do something

limber skiff
#

I cant understand why you need snapshot

austere talon
#

because i dont want to constantly resplit

cunning canyon
austere talon
#
[class*="userPopout"] [class*="NonPremium"]:has([class*="bannerPremium"]) [class*="bannerSVGWrapper"] mask rect```
limber skiff
#

oh

austere talon
#
[class*="bannerSVGWrapper"] rect```
#

wouldnt this work too

limber skiff
#

cant you

const save = (pins: string[]) => {
    snapshot = new Set<string>(pins);
    snapshotArray = pins;
    Settings.plugins.PinDMs.pinnedDMs = pins.join(",");
};
austere talon
#

as opposed to?

limber skiff
#

setting snapshot to undefined and require splitting again

austere talon
#

doesnt matter this is easier :P

limber skiff
#

aight

austere talon
#

infrequent action so it's whatever

#

i just did the snapshot because react calls functions A LOT OF times

lament nimbus
#

ok wait how do I make the selected one actually select if I can't use hooks

austere talon
#

so i tried to avoid some work

austere talon
#

have u tried

lament nimbus
#

I think I might be able to, but im just causing random internal errors in discord's code

shut socket
#

im dead bruh

#

ive been staring at content security policy stuff and now brain hurt โ˜ ๏ธ

#

i need a break

lament nimbus
#

TypeError: Cannot create property 'current' on string 'unspecified'
now

#

unspecified being the default pronoun selection

#

hm

austere talon
#

if u have a good reason to, you can just add a nother exception

limber skiff
#

woah I have never seen this syntax

austere talon
limber skiff
#

that's so cursed

shut socket
austere talon
#

it's the same as

const [a, b] = [1, 2]
#

just instead of assigning to a const you're assigning to existing variables

#

lets u swap array elements without a third variable MenheraBunnyEar

lament nimbus
#

yeah I don't know how to do this without a custom component, or a higher level patch

austere talon
#

where r u stuck?

lament nimbus
#

why its trying to set a property on a string

austere talon
#

show code

lament nimbus
austere talon
#

whats h

#

is h using a hook

lament nimbus
#

h is from useRef()

austere talon
#

you cant

#

put your hook at the veeery start of ur function

#

actually @limber skiff your seen change made it so that patches cant use hooks now

lament nimbus
shadow mango
#

yo im trying to make an anti jerma plugin, i stole some code from the moyai code but cant seem to edit the message content even though the object is being edited

anyone know a way i can modify the message

lament nimbus
#

clicking on buttons changes nothing

lament nimbus
#

it logs the msg but doesn't change the selected value

limber skiff
#

did it break anything?

austere talon
#

no but

#

it might

limber skiff
#

hmm

#

well it's fine for now

#

we will see I guess

#

hmm

#

let me think better

#

idk I think it's fine?

lament nimbus
limber skiff
#

if any discord hooks cause a context menu re render it's gonna patch again at least

austere talon
#

no

#

your change makes it impossible to use hooks in context menu patches

#

because the hook will only run once then not again for subsequent renders

limber skiff
#

how so

#

you sure?

austere talon
#

yes

#

the way react keeps track of hooks is the order they're called in

austere talon
# lament nimbus

if you only sometimes cause a hook, everything will be fucked up and this happens

limber skiff
#

if a hook cause a re-renders it's gonna evaluate the props again

#

so the reference will change

austere talon
#

no

#

this happened because tyman wrote code like

if (seen) return;
const myStringChoice = useState("tt")

so the whole code was like

if (!seen) useState("tt");
const ref = useRef()
ref.target = "hi"
#

the first time it works, the second time useState isn't called so react gets confused and makes useRef return the state of useState, aka a string

#

so you get "cannot create property target on string 'tt'"

#

the same thing applies to ur change to the ContextMenuApi, the same thing will happen

#

you ALWAYS need to call the same amount of hooks or stuff breaks

lament nimbus
#

could I get a hook inside of this somehow

limber skiff
#

ahhh

#

I see

austere talon
#

better idea:
make an (opt-in) option for addContextMenuPatch that makes your patch always run and add "isFirstRender" to the props

limber skiff
#

I cry

austere talon
#

nono dw

#

react is really confusing with this i cant blame u for not knowing this fully

#

you usually wouldn't have to deal with this cause in a normal app you wouldnt write code like this

lament nimbus
#

i love react internals i love react internals i love react internals i love react internals i love react internals

limber skiff
austere talon
#

uh

#

what if neither and we just make it required

limber skiff
#

god this is so confusing

austere talon
#

less confusion

limber skiff
#

so instead of checking for the child in the group

#

we check isFirstRender?

austere talon
#
addContextMenuPatch("banana", (children, props, isFirstRender) {
  if (!isFirstRender) return;
}, true /* runOnRerender */)

addContextMenuPatch("banana", (children, props) {
  
}, false/* runOnRerender */)
limber skiff
#

if you choose to use hooks you have to run on rerender then?

#

that's kinda confusing

austere talon
#

yes

#

how else would we do it

limber skiff
#

no idea lmao

#

also we spread props

austere talon
#
addContextMenuPatch("banana", (children, props, isFirstRender) {
  const [banana, setBanana] = useState("banana")
  if (!isFirstRender) return;

  children.push(banana)
}, true /* runOnRerender */)
limber skiff
#

so kinda bad to access isFirstRender

austere talon
#

have u seen any menu that uses more than 1 ?

#

we could add it on props but i dont wanna pollute props

limber skiff
#

well

#

we could move it before

#

maybe we should always pass isFirstRender

#

and always use that

cunning canyon
austere talon
limber skiff
#

that's a bit better than using group.some blabla lol

#

but still not good

#

๐Ÿ˜ญ

austere talon
#

Well we could add it to props

#

with virtual merge

limber skiff
#

nono I mean, I wanted to completely avoid that predicate

#

I gotta chill a bit

#

gonna think about this later

charred monolithBOT
shut socket
#

alrighty its coming together now

#

@austere talon thanx for help

austere talon
austere talon
#

can't u just

<embed src={URL} width="500" height="375" 
 type="application/pdf">
shut socket
#

Yeah I did that the first time

austere talon
#

but?

austere talon
#

So just add that

#

embed and allow blobs or whatever you're using

shut socket
austere talon
#

huh?

shut socket
#

pdf**

#

ngl I like how the google drive one looks a lot more

#

i'll probably stick with that

pure skiff
#

what does \i mean in regex??

#

it has some special meaning here, because regex101 says it doesn't exist

#

this here

cunning canyon
#

it is vencord thing

golden gulch
#

it's weird being reply sniped by a screenshot of my own message blbctscrd

fleet depot
#

I was just looking into this yesterday and i sent it to my friend

austere talon
#

@spark cove \i corrupted me

#

when I write regex for other stuff not vencord I think \i is real and then get hit with reality check very soon

#

open ecmascript proposal immediately

pure skiff
#

oh i understand

#

thx

austere talon
#

but yeah \i is our own regex extension

pure skiff
#

do you just do regex.source.replace(...)?

austere talon
#

yes

grave mangoBOT
# austere talon https://github.com/Vendicated/Vencord/blob/main/src/utils/patches.ts#L21-L36

**patches.ts: **Lines 21-36

export function canonicalizeMatch(match: RegExp | string) {
    if (typeof match === "string") return match;
    const canonSource = match.source
        .replaceAll("\\i", "[A-Za-z_$][\\w$]*");
    return new RegExp(canonSource, match.flags);
}

export function canonicalizeReplace(replace: string | ReplaceFn, pluginName: string): string | ReplaceFn {
    const self = `Vencord.Plugins.plugins[${JSON.stringify(pluginName)}]`;

    if (typeof replace !== "function")
        return replace.replaceAll("$self", self);

    return (...args) => replace(...args).replaceAll("$self", self);
}

pure skiff
#

ah ok

spark cove
austere talon
charred monolithBOT
austere talon
#

nvm did it now

#

on phone

austere talon
#

lol why

#

the vercel ones?

#

it's useful

#

oh

#

on ur own server

#

?

#

Well you haven't pushed anything here have u

#

So how could it give u notifications

#

I'm confused!!

#

yeaaa that's what I meant

golden gulch
#

There's someone at my workplace that pings me in pull requests then sends me the PR on slack at the same time and now I have an email, github notif, and slack dm all about the same thing

#

we love duplicate notifs nyaboom

charred monolithBOT
#

Discord Account

Spectral#7751

What happens when the bug or crash occurs?

When i install Vencord on Discord (Discord is not in /applications/, it is on /Users/me/Documents/app/ ) Finder says : Discord is damaged, With two button : cancel and Put into bin (I'm not sure for traduction, my mac os is in French)

What is the expected behaviour?

I expect Vencord work ๐Ÿ˜‚

How do you recreate this bug or crash?

  1. Use Mac os
  2. have Discord install in other location of /App...
charred monolithBOT
lime stone
lime stone
charred monolithBOT
charred monolithBOT
vestal grove
charred monolithBOT
muted hinge
vestal grove
#

right

charred monolithBOT
charred monolithBOT
austere talon
verbal pumice
#

macos users on their way to download free discord nitro april 2023 working halal pubjabi

austere talon
#

okay but seriously why does apple do this shit

#

"I think this app might do something bad so now I will stop you from using it at all"

#

instead of just adding an "use anyway" button

verbal pumice
#

we're talking about apple here

#

you expect basic choice for users?

charred monolithBOT
austere talon
#

what's "this"?

#

for capturing variables names:

  • are they parameters passed to the current function? Use arguments[0] to get the first argument
  • are they used somewhere near the code you're matching? Match them
  • if the only way for you to do it is to match way earlier code, you can do a lookbehind to find them /actualMatch(?<=var (\i)=foo.bar.+?)/
#

oh yeah totally

#

but u can still use a lookbehind

#

if you use a lookbehind at the end of your regex, it essentially lets you first find your initial regex then walk back from there until you find the other match

#

/foo(?<=function.+?)/ will first find foo then walk back until it finds the first function

#

kinda cursed that lookbehinds work like this but it's also very cool

#

by far I meant like thousands of characters

#

also usually more performant

#

the less string u match the better

jagged cloak
#

wait so \i will just match shit like t.doSomethingRandom

austere talon
#

no

#

it matches identifiers

#

variable names, class names, etc

jagged cloak
#

so t

austere talon
#

yes

#

\i\.\i would match t.doSomethingRandom and banana.$mil_shake1 but not 1banana.ye

jagged cloak
#

mk

austere talon
#

it technically doesnt cover all valid js identifiers because u can use stuff like amogus unicode as varname

#

but it covers everything discord might have

jagged cloak
#

until discord uses amogus unicode Troll

austere talon
lament nimbus
austere talon
#

yes

#

amogusjs

jagged cloak
#

amoJuS

lament nimbus
#
charred monolithBOT
lime stone
#

lol sorry for my obvious/useless comments

austere talon
#

urghh

#

badges broke again!!

lime stone
#

oh, not just me!

#

:'(

austere talon
#

it seems to just not be using this function anymore

#

AHAHHAHAHA

lime stone
#

at least they are fully broken and not partially this time!

#

how thoughtful of them

austere talon
#

TYPICAL DISCORD CODE

#

they have duplicate modules again

#

LOLLL

verbal pumice
#

discord loves testing in prod

austere talon
#

wait no

#

im drunk

#

thats just the unmodified one

#

im dum lol

lime stone
#

discord using ctrl+c and ctrl+v

austere talon
#

but its still somehow not calling that

austere talon
#

they have not one, not two, but THREE copies of spring

#

just for good measure i guess!!!

charred monolithBOT
#

Discord Account

Taco๐ŸŒฎ#8329

What happens when the bug or crash occurs?

When your spotify account is linked and you enable to option to show it in your profile (when listening to music) the LastFMRichPresence does not work.

What is the expected behaviour?

The LastFMRichPresence should be displayed too

How do you recreate this bug or crash?

  1. Link your spotify account
  2. Enable to show spotify in your status
  3. Enable the LastFMRichPresence-Plugin

Errors

Can't pr...

lime stone
#

maybe it's actually written in c and compiled to javascript

#

oh, nvm read it wrong

charred monolithBOT
austere talon
grave mangoBOT
austere talon
#

.W

#

I love tharki plugins

dense fossilBOT
#

๐Ÿ‘‘โ€Šโ€…โฆLynxโฉ - 285 plays
โ€…2.โ€„โ€…โฆZekkenโฉ - 148 plays
โ€…3.โ€„โ€…โฆVrayporโฉ - 75 plays
โ€…4.โ€„โ€…โฆnattadasuโฉ - 50 plays
โ€…5.โ€„โ€…โฆhazโฉ - 34 plays
โ€…6.โ€„โ€…โฆlekekzโฉ - 32 plays
โ€…7.โ€„โ€„โฆZachโฉ - 27 plays
โ€…8.โ€„โ€…โฆBorisโฉ - 26 plays
โ€…9.โ€„โ€„โฆPixelHirโฉ - 18 plays
โ€…10.โ€„โฆCoplmunโฉ - 17 plays
โ€…11.โ€„โ€…โฆAlpookachuโฉ - 13 plays
โ€…12.โ€„โ€…โฆDziurwa Spokoโฉ - 11 plays
โ€…13.โ€„โ€…โฆStickโฉ - 9 plays
โ€…14.โ€„โ€…โฆfmleoโฉ - 7 plays
**โ€…16.โ€…โ€‰โฆV for vending machineโฉ** - 5 plays

Crown stolen by Lynx with 285 plays!
Previous owner: Zekken with 148 plays.

austere talon
grave mangoBOT
austere talon
stark flint
#

.whoknows command alias

stark flint
#

vencord already has a bunch of those just as separate plugins

charred monolithBOT
lime stone
#

it seems breakpoints don't work well on component rendering ;-;

austere talon
#

this readme is incomprehensible

austere talon
lime stone
#

vsauce says it best i think

stark flint
lime stone
#

One of Those

#

I do that too Sometimes

austere talon
#

randomly capitalising words where it doesn't have semantic meaning is so hard to read

#

I do it sometimes to put emphasis on specific words

lime stone
#

Me Too

austere talon
#

The Worst Thing However Is When People Type Like This, Capiralisating Every Word

#

it makes me actually struggle to read

lime stone
#

fakenitro seems to have a bug here

austere talon
#

how?

stark flint
#

i mean, it is an attachment

#

it's not a real sticker lol

austere talon
#

yeah

lime stone
#

it's only rendering as a sticker in the message

#

not in the replies

#

but i guess it would be misleading

austere talon
austere talon
#

I see

#

but it doesn't matter tbh, who cares

lime stone
#

happy sticker

#

hm, do we need to use a browser to use react devtools?

#

I can't find it in Vencord Desktop

austere talon
lime stone
#

Oh, I forgot lol

#

how did I-

#

thank you

austere talon
#

no I get it, it's a bit confusing that some settings are in desktop and some in vencord itself

lime stone
#

well, I thought it was on by default :P

austere talon
#

the reason is that the Vencord tab has all the things that also exist in discord desktop

#

whereas the Vencord desktop tab has features that only vencord desktop has

charred monolithBOT
jagged cloak
# austere talon this readme is incomprehensible

Help with Everything to do with Obs Live / Webcam Live Deepfakes, Omegle Live Deepfakes, Snapcamera Live Deepfakes, Omegle Trolling Like Hyphonix, SomethingAboutChickens, Microfilms and Omegle Live Deepfakes Must Have a 1080ti or 5700xt or 3060 or 6600xt or Better The more Powerful and The Higher The Vram The Better the Deepfakes will Be

#

i had a 24yr old friend that typed like that i stg

royal bane
charred monolithBOT
sour compass
# charred monolith

@turbid hatch just so you know, this PR changes a bit of the style tag in layout to add light / dark vars and classes
(just letting you know cause ven said to tell you if i made any style changes)

#

(oh and yes i know im a bad dev and the code looks bad)

charred monolithBOT
fleet depot
#

That's weird

#

Why would Vencord mess with that

lament nimbus
#

Unless anyone has a better idea or figures out how to make hooks work, I might just do a modal rather than ctx menu radio buttons
Maybe I could make it fancy and add a msg preview like Cynthia did in powercord's plugin

charred monolithBOT
jagged cloak
#

experiment lmao

turbid hatch
#

the purple accent is green

#

:P

lament nimbus
lime stone
#

ah

lament nimbus
#

The weird way items are added means hooks are brokey in them

#

So radio buttons just don't change the selected value

spark cove
#

react dev build in discord soon (never)

austere talon
#

possible actually

#

you just need to replace their react

#

I might make maybe but I feel like it would make Discord super laggy

spark cove
#

probably would

#

cus these days it makes effects fire twice on mount

lime stone
#

ok, finally managed to either patch the user popout or some code that's used in other places for some reason

#

this has taken a long time :(

lime stone
#

otherwise it wouldn't duplicate the server list as well as the popout!

#

i guess that's one way to go over 100

#

i think i just patched a utility method yay

#

i'll never find it :(

sour compass
charred monolithBOT
austere talon
sour compass
#

ok imma implement those changes you said and then you can merge ๐Ÿ‘

austere talon
#

btw do you guys have any idea how we could rework the download page tabs to work without javascript?

#

I think the html details element might work for this but not sure

#

oh shit we could do this with :has() and a radio

#

we dont even need has ayooo

#

lol @royal bane

#

this is a radio

#

a multi choice single option select

spark cove
#

85.2 FM venradio

royal bane
#

iโ€™m not that much of an idiot

#

just a little bit

sour compass
charred monolithBOT
lament nimbus
sour compass
#

๐Ÿ’€

austere talon
#

@sour compass sorry i gave you ill advice

#

button:focus also applies to when you click it with mouse (and doesnt go away either!)

#

button:focus-visible is what we're looking for

#

also i think the way the icons were before was more intuitive? I think the icon should correspond to the current theme

sour compass
#

oh okk

austere talon
#

so show the sun on light theme and the moon on dark theme

sour compass
#

also literally no other site does that afaik

austere talon
#

does what?

sour compass
#

have the icon show the current theme

austere talon
#

actually true ig

#

this is google fonts

#

thats fine then maybe im just weird idk

sour compass
#

we could have it set to a switch

#

but it'd be less intuitive that it's a theme toggle

austere talon
#

the current is fine

#

what editor are u using? @sour compass

sour compass
#

VSC

austere talon
#

why dont u have format on save enabled

#

ur code isn't formatted correctly (with astros prettier config)

sour compass
#

uhhh ๐Ÿ˜…

austere talon
#

i recommend u enable format on save

#

or just format manually

sour compass
#

i normally dont mess with vsc's settings so it's mostly on default, except for saving when changes are made (or whatever that setting is called)

#

oh god wait now i remember why i changed this

#

cause the formatting is just ugly and changes everything

austere talon
#

yes, i dont like prettier

#

but it's better than inconsistently formatted code

sour compass
#

ok well i formatted themetoggle, is there anything else i need to update

austere talon
#

oh a lot of the files aren't properly formatted lol

austere talon
sour compass
#

i tried to do that, but the title wouldn't show up when i did

#

oh what

austere talon
#

it does

sour compass
#

nope it doesnt show

#

at least on FF

austere talon
#

works for me

sour compass
#

oh because it doesn't add it if i just do <Icon> <title>text</title> <Icon>

austere talon
#

yes thats not how u do it

#

it's a prop for the icon

#
<Icon
    name="fa-regular:sun"
    slot="light"
    title="Switch to Light theme"
/>
sour compass
#

ohh ok, sorry I never used this lib before, I just use icomoon

austere talon
#

whats that

sour compass
#

icon pack generator that turns custom icons into fonts or SVGs

lament nimbus
sour compass
#

LOOK ok shush

lament nimbus
#

title tag changes the tab text lol

austere talon
#

looks like both work the same way actually! But i think it's cleaner to have the title on the icon so if we ever wanted to add more options it wouldn't need an insane if else chain

austere talon
charred monolithBOT
austere talon
#
<svg ...blahblahboilerplatehere>
  <title>Banana</title>
</svg>
sour compass
lament nimbus
#

Oh didn't realize it was SVG not HTML

sour compass
#

ok I committed

austere talon
#

pog

#

does it work on firefox now?

#

the title

sour compass
#

yeah

austere talon
#

niice

sour compass
#

has the bonus of adding "theme" at the end which I couldn't get with auto generating (dont ask, idk)

austere talon
#

wouldn't this first interfere with the inline raw script tag we added?

sour compass
#

that's so if it doesn't exist it would add it first

#

which i dont think is in the inline tag, lemme check

#

yeah it isn't in there

austere talon
#

i have a better idea that is more robust

#
document.body.classList.remove(prev)
document.body.classList.add(v)
#

why not just do this?

#

:P

sour compass
#

cause i made this on my dev hangover ok shush

austere talon
#

ahahaha

true gullBOT
#

I just realized yesterday working on that PR that you didnโ€™t have to re-inject every single time you change stuff

true gullBOT
austere talon
#

whats a -ln

#

oh wait is that ur pk trigger

true gullBOT
#

ye

#

proxy tag

austere talon
#

ye makes sense

true gullBOT
#

and then I looked at the app.asar and was like wait okay this just requires my repo dist folder

Lena | she/her ๐Ÿ’ซ RyanCaoDev & Co.โ€„โ†ฉ๏ธ

[Reply to:](#๐Ÿ‘พ-core-development message) I just realized yesterday working on that PR that you didnโ€™t have to re-inject every single time youโ€ฆ

austere talon
#

since your alters have different genders, does that make u nb/genderfluid

#

genuine question

frail skyBOT
#
Bad Patches

WebContextMenus (had no effect):
ID: 638525
Match: /(?<=showApplicationCommandSuggestions;)if\(![A-Za-z_$][\w$]*\.[A-Za-z_$][\w$]*\)/

WebContextMenus (had no effect):
ID: 638525
Match: /("submit-button".+?)(\(0,[A-Za-z_$][\w$]*\.jsx\)\([A-Za-z_$][\w$]*\.MenuGroup,\{children:[A-Za-z_$][\w$]*\}\),){2}/

Bad Starts

None

Discord Errors

JSHandle@error

austere talon
#

they not actually broken guh

frail skyBOT
#
Bad Patches

WebContextMenus (had no effect):
ID: 638525
Match: /(?<=showApplicationCommandSuggestions;)if\(![A-Za-z_$][\w$]*\.[A-Za-z_$][\w$]*\)/

WebContextMenus (had no effect):
ID: 638525
Match: /("submit-button".+?)(\(0,[A-Za-z_$][\w$]*\.jsx\)\([A-Za-z_$][\w$]*\.MenuGroup,\{children:[A-Za-z_$][\w$]*\}\),){2}/

Bad Starts

None

Discord Errors

JSHandle@error

austere talon
#

wait idek why it fails

#

for some reason my forceLoadAllChunks is broken?

austere talon
#

lmao too late lewi i already merged

junior olive
#

@austere talon i saw the weirdest thing earlier

charred monolithBOT
junior olive
#

vendetta's tweak insights said that some traffic came from vencord-website.vercel.app skulley

austere talon
#

lol???

#

i dont think we link to vendetta anywhere

junior olive
#

exactly

#

wait

#

not that

austere talon
#

wel we will likely link to you in the FAQ in the future

charred monolithBOT
#

For icons, I suggest using icomoon for any icons that aren't on FA (a bit of work to get it on the site each time you change the icon set, but completely free and allows you to use any additional icons. also based on fonts so it works in a lot of browsers.)

As for an icon key, I think it makes more sense to show it on the top of the page. It doesn't require the user to scroll all the way down for it, and it can be short and sweet:
![image](https://user-images.github...

austere talon
#

github i think

junior olive
#

yeah

#

for vendetta-mod/vendettatweak

charred monolithBOT
austere talon
#

i hate how slow first load after new deploy is on vercel, maybe we should make some bot that automatically loads all pages on new deploy trolley

charred monolithBOT
austere talon
#

@turbid hatch TohruGun u must format

sour compass
#

we do a little formatting

sour compass
#

omg ๐Ÿ’€

austere talon
#

sp,

turbid hatch
#

wdym

austere talon
#

granted we should probably set up ci for this

turbid hatch
#

im pretty sure i overrid the formatter in a couple of cases because it generated junk

#

but i didnt think it was terrible

sour compass
turbid hatch
#

and i was always formatting on save

turbid hatch
#

look at the line numbers

sour compass
#

i know but it still looks bad normallyyy

austere talon
#

it does look bad yeah

sour compass
austere talon
#

but there's no better way for it to format this

turbid hatch
#

yeah

#

that was one of the ones i did by hand

sour compass
#

just have a tags on separate lines

turbid hatch
#

i dislike the whole "split the tag end" thing

#

its terrible

austere talon
#

i understand that but I use auto format (and u should too), so having unformatted code is meh

jagged cloak
#

</a

turbid hatch
#

i do use autoformat

#

:<

sour compass
#

like

<p>
  Please note that due to Discord's 
  <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP">
    content security policy
  </a>, 
  the CSS Editor, custom themes and plugins making use of external
</p>
turbid hatch
#

it stopped complaining after i manually did it

turbid hatch
#

on an unrelated note

austere talon
#

a is an inline element, newlines like this inside it will show up as actual spaces in the dom

turbid hatch
#

i bought a sake set!

#

lookie

sour compass
#

still looks a little ugly but better than the auto format

turbid hatch
#

ignore the desk mat im dry cleaning it later

austere talon
turbid hatch
#

sake

sour compass
turbid hatch
#

its a drinking set!

austere talon
#

how to defeat the formatter

sour compass
#

dont get too drunk now

turbid hatch
#

so you pour the sake into the big flask

austere talon
#

insert {}

turbid hatch
#

and then there's another 3 cups that go along with it

#

because you shouldnt drink too much at once

#

so the flask and cups store the right amount

austere talon
#

wow drunkard lewi!!!!

turbid hatch
#

also remind me to never buy that brand again

#

it was like $20 for that bottle of 300ml

austere talon
#

but yeah i agree that the formatter is terrible lol

turbid hatch
#

it was really good though..

turbid hatch
austere talon
#

i wish astro just did it like jsx and made newlines in inline tags NOT be whitespace

turbid hatch
turbid hatch
#

i guess cause they're leaning more towards the html side of things

#

though JSX has its own annoyances

austere talon