#🧩-plugin-development

1 messages · Page 78 of 1

quaint cipher
#

you can see the element like this once you find it

#

ee then i selected it

#

disable formatting

#

and then ctrl c to copy the original

#

(if you copy the formatted one and make regex based on that it wont match)

#

enable regex on the right

#

and you typed , instead of .

#

you could also just search channelTextArea but it might show a lot othewr results and youd have to look trhough those xd

#

this to enable regex search

turbid loom
#

tis fixed :3

quaint cipher
#

oki

#

now you'll likely see both the original file and the patched WebpackModule since this module is already regex patched

#

for stuff that you havent patched yet you will likely only see the web. numbers .js file (unless other vencord plugin patches it but you can still patch it anyways)

#

so uh once you find the element you can make sure by adding debugger by clicking in it and verifying it'll go in debugger mode when it renders and stuf

#

i didnt have to do that in this case

#

@turbid loom tel how far you got rn

turbid loom
#

guh my bad i havent been doing only reading, hyperfocus

quaint cipher
#

you dont have to do i just thought you were doing

turbid loom
#

would this be a proper element to select?

quaint cipher
#

sure

turbid loom
#

im not sure what constitutes the start and end

quaint cipher
#

thats probably fine

#

if you dont need anything above

#

make sure to disable formatting before copying

turbid loom
quaint cipher
#

go into ecmascript flavor

#

and paste the element as test string

turbid loom
#

did

quaint cipher
#

now u can start writing regex

#

what do you wanna do specifically?

turbid loom
#

i'm trying to do the same thing as before but this time get the height for example

quaint cipher
# turbid loom

eh then maybe you can add ref after className:te.subtitleContainer

#

not sure if thatd be right

#

so for example you make regex like

className:\w+\.subtitleContainer

to match that (on the regex101 website you use \w+ but on vencord you should use \i

#

and then you can replace with something like $&,ref:$self.thing so that it'd add ref:$self.thing after which would pass it as a prop and then react would call thing with the html element when its re-rendered or null when its removed i think

#

sorry if much yap

quaint cipher
#

and then if you think its right you can use it on a plugin like this

#

also you should use the vencord dev companion vscode extension

turbid loom
#

luckily i've had that for like a year :3

quaint cipher
#

it tells u if a regex patch is right

#

you also need a "find" which is a string that will likely not change in the future anywhere in the module

#

so uhh

#

here you could use "this.renderHeaderToolbar()," as find

#

it also has to be unique (not anywhere in other modules) you can search in ctrl shift F to verify

turbid loom
#

this is valid cuz only one says module right?

quaint cipher
#

uhh

#

there are 2 diff files there

#

i think

#

should add the () at the end

#

so that it only matches the one place you're patching

#

so with this you get 2 js files (ignoring webpackmodule)

turbid loom
#

it's cuz i had regex on still

quaint cipher
#

with this theres only one

quaint cipher
#

yeah

#

thats right

#

theres only 1 js result so yeah

#

its unique

#

tell me what your patch look like once you write it

turbid loom
#

guh

quaint cipher
#

lol

#

try save?

turbid loom
#

wdym

#

try saving the file? that works ya it doesnt prevent me from saving

#

just thought the error might be important since it doesnt show up on the others

#

wait no the error is gone

#

guh

quaint cipher
turbid loom
#

just dissapeared randomly

quaint cipher
#

and it didnt update right after

turbid loom
#

makes sense ya

quaint cipher
#

oki so

#

replace \w+ with \i because thats a vencord thing you use \i to match identifiers that can change

#

and in the replace you use $& to add after the match (so you're not replacing the className but adding another prop after it)

#

in the other patch i replaced ref because there was already a ref but here there isnt one so we add one

turbid loom
#

like this?

quaint cipher
#

like $&,ref:$self.getRef for example

#

cause like

#

you have an object thats like

{
  className: te.subtitleContainer,
  children: [(0,
...
#

and you wanna add ref in there

#

so the replace should result in something like
you have an object thats like

{
  className: te.subtitleContainer,
  ref: $self.getRef,
  children: [(0,
...
#

if that makes sense,,

turbid loom
#

OHHHHHHHH

#

that makes so much more sense thx

quaint cipher
#

$self is vencord thing to access keys defined under your definePlugin so you can name getRef anything you'd like

#

and then add a corresponding key in your plugin's object

#

at this point you can use vencord companion's Test Patch to verify if the patch works

turbid loom
#

patch ok :D

quaint cipher
#

awesome

#

now getRef should be called when the element is re-rendered so you can verify having a console.log inside

#

and it'll be called with null when the element doesnt exist (unrenders)

turbid loom
quaint cipher
#

no current it'll be just passed the element or null i thimk

#

simply log the first argument it gets

#

like this

#

in your plugin's object

#

and reload discord to see if you see "got ref" anywhere

turbid loom
#

guh im getting a weird issue

#

vencord logs dont say e was ever started and yet i still get a single log saying 'got ref: [object Object]'

#

wait i see it

#
- index.ts:7 Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
-    at cw (index.ts:7:27)
-    at ResizeObserver.<anonymous> (index.ts:49:51)
quaint cipher
#

also are you using this patch together with the other one

quaint cipher
#

because if then you syhould maybe make a different function than getRef because theyre different types here

#

in the other one it'd receive {current: Element|null} here it receives Element|null

#

uhh

turbid loom
quaint cipher
#

yeah

#

looks like

quaint cipher
#

did you use + in the console log

turbid loom
quaint cipher
#

use , like this console.log("got ref", ref);

#

or it'll call toString

#

and you cant see objects

turbid loom
# quaint cipher can i see ur code
import definePlugin from "@utils/types";

let chatBarWidth;
let lastRef;

function updateThing(element: any) {
    chatBarWidth = window.getComputedStyle(element).width;
    document.documentElement.style.setProperty(
        "--chat-bar-full-width",
        chatBarWidth
    );
}

export default definePlugin({
    name: "e",
    description: "",
    authors: [],
    patches: [
        {
            find: "useRootElementContext",
            replacement: {
                match: /--saturation-factor:/,
                replace: '" + $self.getStyle() + "$&',
            },
        },
        {
            find: ".channelTextArea]",
            replacement: {
                match: /ref:(\i)(?=,className:.{0,50}channelTextArea)/,
                replace: "ref:($self.getRef($1),$1)",
            },
        },
        {
            find: "this.renderHeaderToolbar()",
            replacement: {
                match: /className:\i\.subtitleContainer/,
                replace: "$&,ref:$self.getRef",
            },
        },
    ],
    getStyle() {
        if (!chatBarWidth) return "";
        return `--chat-bar-full-width: ${chatBarWidth};`;
    },
    getRef(ref: React.RefObject<any>) {
        if (!ref.current) return;
        if (ref.current == lastRef) return;
        lastRef = ref.current;
        const observer = new ResizeObserver(() => updateThing(ref.current));
        observer.observe(ref.current);
        updateThing(ref.current);
        console.log("got ref", ref);
    },
    stop() {},
});
quaint cipher
#

also updateThing updates --chat-bar-full-width

#

im sure you want a different variable for this element?

turbid loom
#

O yesyes

#

@quaint cipher this is better, no?

function updateThing(element: any, value: string, propName: string) {
    const output = window.getComputedStyle(element).getPropertyValue(value);
    document.documentElement.style.setProperty(propName, output);
}
quaint cipher
#

probaly

turbid loom
#

Lol

quaint cipher
turbid loom
#
import definePlugin from "@utils/types";

let chatBarWidth;
let lastRef;

function updateThing(element: any, value: string, propName: string) {
    const output = window.getComputedStyle(element).getPropertyValue(value);
    document.documentElement.style.setProperty(propName, output);
}

export default definePlugin({
    name: "e",
    description: "",
    authors: [],
    patches: [
        {
            find: "useRootElementContext",
            replacement: {
                match: /--saturation-factor:/,
                replace: '" + $self.getStyle() + "$&',
            },
        },
        {
            find: ".channelTextArea]",
            replacement: {
                match: /ref:(\i)(?=,className:.{0,50}channelTextArea)/,
                replace:
                    "ref:($self.getRef($1, 'width', '--chat-bar-full-width'),$1)",
            },
        },
        {
            find: "this.renderHeaderToolbar()",
            replacement: {
                match: /className:\i\.subtitleContainer/,
                replace: "$&,ref:$self.getRef",
            },
        },
    ],
    getStyle() {
        if (!chatBarWidth) return "";
        return `--chat-bar-full-width: ${chatBarWidth};`;
    },
    getRef(ref: React.RefObject<any>, value: string, propName: string) {
        if (!ref.current) return;
        if (ref.current == lastRef) return;
        lastRef = ref.current;
        const observer = new ResizeObserver(() =>
            updateThing(ref.current, value, propName)
        );
        observer.observe(ref.current);
        updateThing(ref.current, value, propName);
        console.log("got ref", ref);
    },
    stop() {},
});
#

updated a bit

quaint cipher
#

since u wanna pass stuff to getRef

#

o also i think you forgot

#

' in the first getRef call

#

" or '

turbid loom
quaint cipher
#

ref:($self.getRef($1, width, --chat-bar-full-width),$1) is getting added to discord's js

#

so

#
{
  ref: ($self.getRef($1, width, --chat-bar-full-width), $1)
}
#

width and --chat-bar-full-width are not defined

#

(you wanna pass those as strings)

turbid loom
#

ohh ya i forgor

#

is good now :p

quaint cipher
#

and ur also gonna have to keep track of the value in a variable which updateThing did before with chatBarWidth
but since now you're gonna have many variables you probably want an object instead

#

look above function updateThing

#

chatBarWidth is now unused

#

uh idk how to explain

#

@turbid loom im going soon so ill fix it for u rq if u want

#

and u can uhh inspect th code

#

what variable do u want for the latter patch's element

turbid loom
#

oh oki :0 uhh

#

just "--header-bar-height" should be fine

#

if css variable is what you meant

quaint cipher
#

ye

turbid loom
#

the goal for this plugin is to be able to easily add a patch for another element to add a custom css property of my choice

#

without refactoring for every new one

#

if possible,,

quaint cipher
#

think this shoul work not sure

#
import definePlugin from "@utils/types";

let vars = {};
let lastRefs = {};

function updateThing(element: any, value: string, propName: string) {
    const output = window.getComputedStyle(element).getPropertyValue(value);
    vars[propName] = output;
    document.documentElement.style.setProperty(propName, output);
}

export default definePlugin({
    name: "e",
    description: "",
    authors: [],
    patches: [
        {
            find: "useRootElementContext",
            replacement: {
                match: /--saturation-factor:/,
                replace: '" + $self.getStyle() + "$&',
            },
        },
        {
            find: ".channelTextArea]",
            replacement: {
                match: /ref:(\i)(?=,className:.{0,50}channelTextArea)/,
                replace: "ref:($self.getRef($1.current, 'width', '--chat-bar-full-width'),$1)",
            },
        },
        {
            find: "this.renderHeaderToolbar()",
            replacement: {
                match: /className:\i\.subtitleContainer/,
                replace: "$&,ref:e=>$self.getRef(e, 'height', '--header-bar-height')",
            },
        },
    ],
    getStyle() {
        return Object.entries(vars).map(([name, value]) => `${name}: ${value}`).join(';') + ';';
    },
    getRef(ref: Element | null, value: string, propName: string) {
        if (!ref) return;
        if (ref == lastRefs[propName]) return;
        lastRefs[propName] = ref;
        const observer = new ResizeObserver(() =>
            updateThing(ref, value, propName)
        );
        observer.observe(ref);
        updateThing(ref, value, propName);
        console.log("got ref", ref);
    },
    stop() { },
});
#

1s ill add comments

turbid loom
#

uhh idk if this matters but with the code i made before this current update, whenever i click on anything that's meant to go to a different page, it reloads do to an error like uh

#

wait no it isnt all the time

#

that might just be me lagging

#

Lol

#

but i get the full screen discord crash screen it's odd

#

meh

quaint cipher
#

added some comments though im not sure it makes it any more understandable

#

let me say changes

#

now using a "vars" variable instead of chatBarWidth since we're gonna have more than 1 var

#

vars will get the css property name as key and the value to assign as value so it'll be like

vars = {
  "--chat-bar-full-width": "456px",
  "--header-bar-height": "278px"
} 
#

updateThing is responsible for modifying vars

#

the use of vars comes in getStyle

#

html's style is often refreshed by discord and a regex patch will add getStyle() there

#

so if you call getStyle() you can see the css that gets added

turbid loom
#

e=> is "e" just meant to be the plugin name without spaces or is that something else

quaint cipher
#

nope e there could be anything its just like

#
{
  ref: e => $self.getRef(e, 'height', '--header-bar-height')
}

im just used to calling it e but more appropiately i could've named it ref or elem

#

you can change it if you want

#

make sure to change it in those 2 places

#

idk if you know arrow functions its the same as

{
  ref: function (e) {
    return $self.getRef(e, 'height', '--header-bar-height')
  }
}
#

the function will be called with the element or null

turbid loom
#

ahhh i see i see

#

this is amazing work and good teaching, if that is all then thank you vary much for the help, i might have a plugin good enough to pr soon bc of u :3

quaint cipher
#

glad to hear

turbid loom
quasi maple
#

not exactly sure where to start with this, but does anyone know how to get these components? both separately for channels and users. it would be a hassle to recreate an already existing component for this

#

i'll have to use componentByCode or findComponentByCodeLazy to get the components right? but i dont know how to use this atm

unkempt hemlock
#

hello @carmine spade, not sure if you are aware, but your plugin "MutualGroupDMs" is kind broken on the new UI due to the new spacing

here's a screenshot

thx for your attention

north flame
#

Hey, I'm having some troubles with module 340895. I need to patch it for BypassDND (this is where the call ringtone check happens)

#

I can't find an access to the channel id

#

The function where it does the check is the only one that doesn't get an event waa

bronze dove
carmine spade
#

in a way which looks good

north flame
# bronze dove remove the ternaries from the class methods and then add your own filter to the ...

Like here?

 class Mavis extends (i = o.ZP.Store) {
        initialize() {
            this.waitFor(_.Z, p.Z),
            this.syncWith([p.Z], Ligma),
            this.syncWith([u.Z], Ligma),
            this.syncWith([l.Z], x)
        }
        getIncomingCalls() {
            return T ? O : Array.from(I.values())
        }
        getIncomingCallChannelIds() {
            return T ? y : Sigma
        }
        getFirstIncomingCallId() {
            return T ? null : Sigma.values().next().value
        }
        hasIncomingCalls() {
            return !T && Sigma.size > 0
        }
    }```
bronze dove
#

yeah just do

return Array.from(I.values()).filter(id=>$self.allow(id))

allow(id) {
  if (isDnd) {return whitelisted.includes(id)}
  return true
}
``` or something
#

nvm this might be better

getIncomingCalls() {
   return T ? Array.from(I.values()).filter(id=>$self.allow(id)) : Array.from(I.values())
 }
allow(id) {
  return whitelisted.includes(id)
}
north flame
#

thx though!

#

it was the hasIncomingCalls()

#

lmao I somehow completely missed the part where it assigns a var instead of returning

dull magnet
#

what are u trying to do

quasi maple
# dull magnet why do you need them

I'm trying to get the context menu (specifically the children of the Menu.Menu component) for channels/users/threads so that I can right click on them, while being able to separate the tabs functionality. Tho I'm not sure if getting the children is the right approach for this

#

the "venbot" menu item there will have the children of that contextmenu children

dull magnet
#

what tabs functionality do you mean?

quasi maple
#

Closing, pinning, moving from left/right via menu buttons

dull magnet
#

if you want to patch context menus (e.g. add new elements or reorder existing elements) then there's the Context menu api

quasi maple
#

I can't just patch the context menus using the api i think. coz my tabs is a custom component, but i am using the api for showing these context menus.

#

I'm just wondering if there's a way to get the children of those specific context-menu's so I can append them to the "venbot" menu item

quasi maple
#

brains kinda dead right now mb lmao, been coding nonstop

#

so far I tried figuring out how I'm gonna create the UserContext menu with proper props first, but that was already a dead end for me.

dull magnet
#

so you want part of the user context menu in your own context menu

quasi maple
#

yeah!

dull magnet
#

only part or the entire thing?

quasi maple
#

thinking of the entire thing, but i already added a few custom elements to the user context menu using the context menu api lol

#

probably just the entire thing to keep things simple, but is it possible?

dull magnet
#

yes

#

find the context menu source code

#

use inspect elements / react devtools

#

all context menu entries specify a unique id that you can easily find in the source code

quasi maple
#

alright cool, thanks

#

once i get around getting the UserContext component i'll get back in here bcos i dont know how i'll be getting the children components of those

flat hinge
#

What’s the difference between flux IDLE and AFK? Is afk for push notifications and idle is just general idle?

amber mantle
#

probably an alias

hardy adder
#

it might be related to this setting

flat hinge
#

ty. also how do you find code that discord calls? like all instances where the string "IDLE" is present

stiff drift
#

They keybind to open the Chrome Developer tools is SHIFT+CNTRL+I (i).

#

But I believe you need the DevCompanion plugin enabled. Which you need to export vencord in dev mode (pnpm build --dev, pnpm inject)

flat hinge
#

seems to work without dev

#

tysm tho

stiff drift
turbid loom
#

chat are settings lists a thing

#

i forgor

#

like a list i can add or remove from

#

guh

#

i'll just use a fake one with string

#

good enough for this plugin for now if someone gets annoyed they ccan pr

turbid loom
#

oh nevermind i couldnt do that even if i wanted to okay

#

cuz patches cant be added dynamically

#

welp

turbid loom
#

@quaint cipher do you know how to play local or link sounds with a plugin, maybe it's more complicated than i thought cuz no matter what i do i cant get it to work

quasi maple
#

i gotta do this for all the gdm/channel/user/thread context menus

dull magnet
quasi maple
# dull magnet 1. Do you really need mapMangled? That function is only for specific cases where...

got it!
i think yeah i need to use mapMangled. when I try findByCodeLazy('navId:"user-context"'); normally it doesn't find any matches.

I've also been messing around with extractAndLoadChunksLazy and got the chunks for group dms myself, the one for UserContextsMenus I just found from this PR: https://github.com/Vendicated/Vencord/pull/2902

Now I'm not exactly sure what the process is for finding these chunks are tho. thats whats been taking most of my time today

#
const requireUserContextMenu = extractAndLoadChunksLazy([".userIds.length>0).reverse("]);
const waitForGroupContextMenu = extractAndLoadChunksLazy(['surface:"private-channel"']);

these two works fine. (but idk how)

and this is how im rendering the components at the moment

#

this is info i found in this discord trying to search if anyones done something similar before.

bronze dove
bronze dove
quasi maple
#

Ohh, so I just need to find a module that loads the context menus i need

bronze dove
#

Yeah

quasi maple
#

finally found them all lol

#
const findUserContextChunks = extractAndLoadChunksLazy([".userIds.length>0).reverse("]);
const findGroupContextChunks = extractAndLoadChunksLazy(["PrivateChannel.renderAvatar"]);
const findThreadContextChunks = extractAndLoadChunksLazy(["},handleRightClick:"]);
const findChannelContextChunks = extractAndLoadChunksLazy(['("CategoryChannel")']);

not sure if these are good ways to extract them but it works

inner loom
#

uhm so i'm making a pr to vencord and ive never done that before, is there a specific way i need to write that or something?

quasi maple
#

well this is a little annoying

#

how can i tell extractAndLoadChunksLazy that i need the second part of this chunk

#

not the first one

bronze dove
#

like ```js
const requireChannelContextMenu = extractAndLoadChunksLazy(["&&this.handleActivitiesPopoutClose(),"], new RegExp(DefaultExtractAndLoadChunksRegex.source + ".{1,150}isFavorite"));

quasi maple
#

ooo thanks!

turbid loom
#

what in this could POSSIBLY be unique

(0,r.jsx)(d.tEY,{offset:{left:4,right:4},children:(0,r.jsxs)("li",{id:a,className:X.messageListItem,"aria-setsize":-1,children:[(0,_.Uw)(y)&&(0,r.jsx)(g.Z,{compact:en,message:y,hovering:ej&&!eZ&&!eX}),(0,r.jsx)(A.Z,$(J({},eu),{"aria-setsize":-1,"aria-roledescription":K.NW.string(K.t.BAB0yM),"aria-labelledby":eV,"aria-describedby":ez,onFocus:eP,onBlur:eS,onContextMenu:e_,onKeyDown:eU,onClick:eC,compact:en,contentOnly:eo,className:o()(er,{[X.message]:!0,[X.cozyMessage]:!en,[X.mentioned]:y.mentioned,[X.ephemeral]:(0,I.Pv)(y),[X.nitroMessage]:y.type===q.uaV.NITRO_NOTIFICATION||y.type===q.uaV.CHAT_WALLPAPER_SET||y.type===q.uaV.CHAT_WALLPAPER_REMOVED,[X.systemMessage]:(0,S.Z)(y),[X.groupStart]:!eo&&(eQ||y.type===q.uaV.REPLY),[X.selected]:eA,[X.replying]:(null==eF?void 0:eF.message.id)===y.id,[X.interactionSending]:y.isCommandType()&&y.state===q.yb.SENDING,[X.automodMessage]:eK,[X.editing]:eZ,[X.hasOpenPopouts]:eX,[X.potioned]:(0,_.Uw)(y)&&ed}),zalgo:!eZ,childrenRepliedMessage:eo||y.type!==q.uaV.REPLY?void 0:(0,V.Z)($(J({},e),{setPopout:eb,referencedUsernameProfile:em.referencedUsernameProfile,referencedAvatarProfile:em.referencedAvatarProfile,replyReference:ea,replyMessage:ef,isReplySpineClickable:!0})),childrenExecutedCommand:(0,G.Z)(e,eb,em),childrenHeader:eo?void 0:(0,F.Z)({messageProps:e,setPopout:eb,messagePopouts:em,replyReference:ea,author:eB,repliedMessage:ef,roleIcon:eG}),childrenAccessories:(0,W.Z)({channelMessageProps:e,hasSpoilerEmbeds:eW,handleContextMenu:e_,isInteracting:ew,isAutomodBlockedMessage:eK}),childrenButtons:ex||eE?(0,B.Z)({buttonProps:e,setPopout:eb,messagePopouts:em,isFocused:ej||eO}):void 0,childrenSystemMessage:(0,z.Z)(e),childrenMessageContent:l,onMouseMove:ev,onMouseLeave:ey,hasThread:!eo&&y.hasFlag(q.iLy.HAS_THREAD)&&null!=eR,isSystemMessage:(0,S.Z)(y),hasReply:y.type===q.uaV.REPLY,messageRef:eq}))]})});
#

i genuinely cant find anything there i'd be able to patch

empty sundial
#

probably like CHAT_WALLPAPER_REMOVED

turbid loom
empty sundial
#

damn i misread

turbid loom
empty sundial
hushed loom
turbid loom
#

that's it

#

i already have everything else set up

empty sundial
#

nvm wait

#

my brain is slow rn

#

should be 534469?

empty sundial
turbid loom
#

just the entire message area

#

messageListItem

vast karma
#

.referencedAvatarProfile,replyReference: looks somewhat unique

turbid loom
empty sundial
#

for what...

vast karma
#

As does .messageListItem,"aria-setsize":-1,children:[(0,

hushed loom
# turbid loom

i feel like you would be better off patching later down, but idk what your end goal is

turbid loom
#

thsnk you :3

turbid loom
#

:p

#

well, properties more like

#

height in px, width in px, etc

hushed loom
#

why wires

turbid loom
#

can't say yet, this plugin is a bit of a secret project until i try to pr or open on #1256395889354997771

hushed loom
#

😭

#

im pretty sure you're doing things in an insane way, but i cant know blobcatcozy

empty sundial
#

no need for patches

hushed loom
empty sundial
#

thats probably a lot easier than making a patch

hushed loom
#

yop

turbid loom
# hushed loom 😭

all i can say is aWYgeW91IGRldmVsb3AgdGhlbWVzIGF0IGFsbCB5b3UnbGwgbG92ZSB0aGUgcGx1Z2lu

empty sundial
turbid loom
empty sundial
turbid loom
#

:3

hushed loom
#

i know what base64 is, im husking because you sent it in base64 😭

turbid loom
#

lmfao

hushed loom
#

insane

empty sundial
#

i am also trying to make the theme space more sane... or less sane depending on your stance on rust

turbid loom
fiery berry
#

Hello, is there a way I can make a plugin setting hidden unless another setting is enabled? For example, an "enable feature" setting that when enabled unhides an "API key required for feature" setting.

#

The methods I've attempted so far don't update without closing and reopening the settings interface, which is a no go.

hushed loom
quasi maple
#

findStoreLazy("UserGuildSettingsStore").isChannelMuted(guildId, channelId) doesn't seem to work for user dms anymore

#

does anyone here know what user dms use for this

quasi maple
#

nvm im a dumbass. i was passing guildId as undefined instead of null in my component and that fucks things up

ancient light
#

how do you send a file through vencord as an embed to a pre-defined uid?

#

if it’s not a source method yet, can you think of an already-existing plugin that does something similar that I can steal from?

north flame
ancient light
#

basically

random grove
#

I already tried, but I'm not finding the fucntion because it's on a menu and it's closing itself when I'm not focusing it

#

so still trying to get the function to update our status 🥲

#

hello ! maybe you found a way ? and you could help me ?

humble tulip
#

There's a toggle in dev tools to keep the window focused, that might help

#

I don't remember where, it might be in the styles tab

random grove
#

mmh I tried but not working or idk how to do it

tribal sentinel
#

you can use breakpoints to stop it from closing

random grove
#

i'm trying since 3 hours now 😅 but I still find nothing

humble tulip
north flame
#

@swift delta

swift delta
north flame
#

real message component

swift delta
#

Cool

north flame
#

instead of

swift delta
#

Ohh nice

north flame
#

Although that's a hell of a lot easier and simpler, so it may as well be left alone ig

swift delta
north flame
north flame
#

If there's a way to generate dummy messages/channels I'd love to know lmao

normal wagon
#

what do i do to override parameters of voice message before its uploaded im wanting to change the name

#

i have a way to override attachments, and text

#

but since discord doesnt allow voice messages its not included in attachment data

north flame
swift delta
#

@vast karma

vast karma
#

...why

swift delta
#

Money grab

north flame
north flame
#

Grayscale to make the badges more focused

#

Also cut from 9 settings to 5

swift delta
#

Ohhh

#

Ight

swift delta
#

Ohh…

#

That’s stupid

humble tulip
humble tulip
#

I kinda wanna make a plugin that changes channels/servers if you hold a dragged file over them, so you can drag a file into discord and then navigate to the chat you want to drop it in like the windows taskbar or something

#

Sounds like a pain to do though

vast karma
#

That'd be a lot of effort for little benefit, but it'd certainly be cool in the rare cases

#

Discord themselves should be doing that kind of things rather than visual refreshes and potions

humble tulip
#

True

#

Tbh most of things I've done with Vencord have been more like programming practice than actually being useful

#

Or at least worth the effort

north flame
#

although maybe I'm missing smth

azure fossil
#

is there a way i could patch discord strings to replace them ?
gs+qcH
1ZZttr
in french, these 2 have become very long and i'd like to replace them, but i'm not sure how i could do that

#

i mean even in english with the only "visible by you"

dull magnet
azure fossil
# dull magnet just use a patch to change them

thing is, where do i patch them
cause i know they are used there, but also at some other places, so i won't patch that code, but idk where is the code that load them and i'm not sure how i could track it

limber escarp
#

Hello, I'm having trouble with patches (or not if can be done without patches) for when user is clicking on a button check a condition if true just do the action and if not show a popup message and cancel action. For a already existing button in the user context menu

iron epoch
limber escarp
quasi maple
#

just got told off my automod nvm ShiggySad

amber mantle
#

you just cant use markdown headers

ancient light
north flame
modern chasm
#

What do you think about making the vencord settings screen i18n?
if you agree to this things, i will make i18n system and japanese translate.

@dull magnet

dull magnet
#

no, sorry

modern chasm
dull magnet
#

yes

modern chasm
#

ok
thx for answering

ancient light
#

how do you add a file to your drafts?

#

like this

#

above the text input box

#

does somebody have a snippet of this being done?

rose fiber
ancient light
#

how do you guys deal with cors errors?

#

i'm failing to fetch discordapp from discord

#

it needs to be opaque btw

velvet anchor
#

hey guys, how do you add plugin settings? I'm using import { definePluginSettings } from '@api/Settings'; but every time I open the settings menu in vencord, it just crashes.

ancient light
velvet anchor
hushed loom
#

that bypasses cors

hushed loom
velvet anchor
# hushed loom send your code

this is just a snippet

import definePlugin, { OptionType } from '@utils/types';

interface ExecutableNode {
  type: 'executable';
  name: string;
  path: string;
}

const Native = VencordNative.pluginHelpers.discordExecutableLauncher as PluginNative<typeof import("./native")>;

const settings = definePluginSettings({
  withExecutableName: {
    type: OptionType.BOOLEAN,
    description: 'Include the executable name in the launch log',
    default: true,
  },
  executables: {
    type: OptionType.ARRAY,
    description: 'List of executables to launch',
    default: [
      { name: 'ExampleApp', path: 'C:/path/to/your/executable.exe' },
    ],
  },
});```
#

when i open the settings, it just crashes discord

ancient light
#

do you actually have that path?

hushed loom
hushed loom
humble tulip
#

Are you on the branch with array settings?

#

Otherwise OptionType.ARRAY isn't a thing

velvet anchor
hushed loom
humble tulip
#

Am I way behind

ancient light
ancient light
#

oh

hushed loom
#

esbuild does not do typechecking

#

that's why it's so fast

#

(+ written in go)

hushed loom
velvet anchor
# hushed loom what error does it crash with

no, it doesn't not build, the plugin builds when making vencord. i mean like when i open the vencord plugins tab, go to my plugin, click on the settings icon to edit settings, vencord just crashes

hushed loom
#

open console and screenshot the error

velvet anchor
hushed loom
humble tulip
#

I thought I was losing it

velvet anchor
hushed loom
rocky lynx
ancient light
velvet anchor
ancient light
ancient light
velvet anchor
hushed loom
hushed loom
#

just look for uses of OptionType.CUSTOM

ancient light
humble tulip
ancient light
ancient light
hushed loom
#

vp reacterror

shrewd tundraBOT
hushed loom
#

can de-minify react errors

ancient light
#

I suppose I assumed that they would know how to do that already

#

silly assumption, because they didn't

green vessel
#

id like to create a plugin which adds buttons above the text input box just for some moderation stuff, it would also push the chat elements up as not to cover messages, just wondering if theres any resources i can have a look at to help
also i do have js & ts knowledge just feel really out of my depth reading through this stuff lol

tough nymph
#

I've looked on the official guide on how to make a plugin and I found it quite confusing. How do you replace html elements with other html elements using the plugin? I assume using the plugin is the only way to go about this. I want to make the status icons that show up on the bottom right of people's avatars square. I've tried it using CSS but discord uses two types of masks for the status icons for some reason. Some are masked using only <rect> elements (which I can make square using CSS) and some are masked using <rect> elements with a mask attribute which has the property url(#svg-mask-status-<status like online/online-mobile/idle/dnd/streaming/offine>). It links to a mask element which houses <circle> elements. I want to replace those elements. This is the result I'm looking for (in the image)

I've tried doing this in the start() method:

start() {
        const online = "#43a25a";
        const idle = "#ca9654";
        const dnd = "#d83a42";
        const streaming = "#593695";
        const offline = "#83838b";
        const replaceMaskChildrenWithRect = (maskName, colour) => {
            if (!maskName.includes("mobile")) {
                const dmListAvatarOnlineStatusMask = document.getElementById(maskName);
                const newRectElement = document.createElement("rect");
                newRectElement.setAttribute("x", "22");
                newRectElement.setAttribute("y", "22");
                newRectElement.setAttribute("width", "10");
                newRectElement.setAttribute("height", "10");
                newRectElement.setAttribute("fill", colour);
                newRectElement.setAttribute("aria-hidden", "true");
                newRectElement.setAttribute("class", "pointerEvents__44b0c");
                dmListAvatarOnlineStatusMask?.replaceChildren();
            } else {
                const dmListAvatarOnlineStatusMask = document.getElementById(maskName);
                const newRectElement = document.createElement("rect");
                newRectElement.setAttribute("x", "22");
                newRectElement.setAttribute("y", "17");
                newRectElement.setAttribute("width", "10");
                newRectElement.setAttribute("height", "15");
                newRectElement.setAttribute("fill", colour);
                newRectElement.setAttribute("aria-hidden", "true");
                newRectElement.setAttribute("class", "pointerEvents__44b0c");
                dmListAvatarOnlineStatusMask?.replaceChildren();
            }
        };
        replaceMaskChildrenWithRect("svg-mask-status-online", online);
        replaceMaskChildrenWithRect("svg-mask-status-online-mobile", online);
        replaceMaskChildrenWithRect("svg-mask-status-idle", idle);
        replaceMaskChildrenWithRect("svg-mask-status-dnd", dnd);
        replaceMaskChildrenWithRect("svg-mask-status-streaming", streaming);
        replaceMaskChildrenWithRect("svg-mask-status-offline", offline);
    }
vast karma
#

You don't replace html elements

#

You replace react elements

tough nymph
#

ive also tried using the patches array with regex:

patches: [
        {
            // Online mask
            find: 'function x(e){ return (0, r.jsx) ("mask", { id: e, maskContentUnits: "objectBoundingBox", viewBox: "0 0 1 1", children: (0, r.jsx) ("circle", { fill: "white", cx: .5, cy: .5, r: .5 }) }) }',
            replacement: [{
                match: /^\("circle", \{ fill: "white", cx: \.5, cy: \.5, r: \.5 \}\)$/i,
                replace: '("rect", { x: 19, y: 19, rx: 0, ry: 0, width: 16, height: 16 })'
            }]
        },
        {
            // Online mobile mask
            find: 'function V(e) { let t = 8 , n = 8 * s.EW; return (0, r.jsxs) ("mask", { id: e, maskContentUnits: "objectBoundingBox", viewBox: "0 0 1 1", children: [(0, r.jsx) ("rect", { fill: "white", x: 0, y: 0, width: 1, height: 1, rx: n * s.e7 / t, ry: n * s.e7 / n }), (0, r.jsx) ("rect", { fill: "black", x: 1 / t, y: 2 / n, width: 6 / t, height: 6 / n }), (0, r.jsx) ("ellipse", { fill: "black", cx: t / 2 / t, cy: 10 / n, rx: 1 / t, ry: 1 / n })] }) }',
            replacement: [{
                match:  /^function V\(e\) \{ let t = 8 , n = 8 \* s\.EW; return \(0, r\.jsxs\) \("mask", \{ id: e, maskContentUnits: "objectBoundingBox", viewBox: "0 0 1 1", children: \[\(0, r\.jsx\) \("rect", \{ fill: "white", x: 0, y: 0, width: 1, height: 1, rx: n \* s\.e7 \/ t, ry: n \* s\.e7 \/ n \}\), \(0, r\.jsx\) \("rect", \{ fill: "black", x: 1 \/ t, y: 2 \/ n, width: 6 \/ t, height: 6 \/ n \}\), \(0, r\.jsx\) \("ellipse", \{ fill: "black", cx: t \/ 2 \/ t, cy: 10 \/ n, rx: 1 \/ t, ry: 1 \/ n \}\)\] \}\) \}$/i,
                replace: 'function V(e) { let t = 8 , n = 8 * s.EW; return (0, r.jsxs) ("mask", { id: e, maskContentUnits: "objectBoundingBox", viewBox: "0 0 1 1", children: [(0, r.jsx) ("rect", { fill: "white", x: 0, y: 0, width: 1, height: 1, rx: 0, ry: 0 }), (0, r.jsx) ("rect", { fill: "black", x: 1 / t, y: 2 / n, width: 6 / t, height: 6 / n }), (0, r.jsx) ("ellipse", { fill: "black", cx: t / 2 / t, cy: 10 / n, rx: 0, ry: 0 })] }) }'
            }]
        }
    ],
north flame
#

Tf

vast karma
#

That sure is a lot of minified variable names

#

And also wrong formatting, where did you get all those spaces from

tough nymph
#

Yeah I have no idea what I'm doing

#

lmao

#

Tis why I came here

#

I looked at the crash course thingy for the webkit but that didnt really help me either

#

I wanna replace this element with a <rect> element. Im pretty sure I found the function that adds it?

#

but again I have no idea on how to go about doing it so I'd be really grateful for some help

tough nymph
empty sundial
tough nymph
#

I want to change the children of the mask

#

replace them entirely

#

I tried changing the mask attribute but it... wait, can you add html elements to the mask attribute?

#

I tried changing the mask attribute but it always ended up breaking it

empty sundial
#

you want to make them square no?

#

requires tweaking of course

tough nymph
#

I dont want to remove the mask

#

Ive tried that already and it looks a little ugly imo

#

besides it only works with specific ones

#

some tweak out and get really wide

#

If I understand this correctly, the patches array directly edits the functions that render/create the react elements?

vast karma
#

Or any other code, yes

#

It's search-and-replace on the minified code

empty sundial
#

the patches array patches all code

tough nymph
#

so that includes the DOM or nah?

empty sundial
#

yesn't

#

discord is a react app

#

the dom is made out of components

vast karma
#

React element functions are code

empty sundial
#

the components get bundled into reacts own calls which create the elements

tough nymph
#

I know

#

didnt know that discord used react though

#

thats good to know

#

I have experience with it

empty sundial
#

instead of <div></div> you will see for example \i.jsxs)("div", {})

tough nymph
#

yeah ive saw that a bunch when scouring the source tab yesterday

#

i take it thats the raw code and not how youd actually write it?

vast karma
#

Yes, you patch the compiled code

#

Since we don't have access to the sources

tough nymph
#

okay i see

#

how do you format the find/match/replacement values?

vast karma
#

Wdym

tough nymph
vast karma
#

You don't format shit, you just write things that match the code

rose fiber
#

the minified code doesnt have those spaces

#

those were added by your browsers devtools I'd guess

tough nymph
#

ah okay, so no spaces even if there is a line break?

vast karma
#

There are no line breaks

tough nymph
tough nymph
rose fiber
#

the line breaks were also added by your browser's formatter

vast karma
#

Exactly as written

tough nymph
#

I wrote it all in one line here

vast karma
#

Surely you can see that that's not how the code is

tough nymph
rose fiber
vast karma
#

Even if that patch works after you remove the newlines, it won't work tomorrow once the names are rerolled

tough nymph
#

I see, I wanted to make sure it was exactly the mask I wanted to edit

rose fiber
#

also the find should just be something identifying of the module the code is in, not your match

vast karma
#

Use patch helper btw

tough nymph
tough nymph
#

Which setting do I need to look in?

rose fiber
#

you need to compile vencord with either pnpm watch or with the --dev flag

tough nymph
#

ahh

empty sundial
#

which adds all the whitespace

tough nymph
#

thats really good to know, thank you

empty sundial
#

thats also why you do not see any lines on the left of the file, its all on line 1

tough nymph
#

hmm i still dont have the patcher helper setting

vast karma
#

It's not a setting

empty sundial
#

its a tab in the settings

tough nymph
#

oh my god im blind

#

yeah I see it

#

alright thanks Ill try some things out now

#

btw is build --watch kinda like nodemon which reloads the app every time you make a change?

vast karma
#

It recompiles automatically, but it doesn't reload

#

You'll still need f5 for that

tough nymph
#

Alright thanks

#

i just f5 in the app right? or in the dev tools

rose fiber
humble tulip
#

ctrl+r in the app or f5 in dev tools

tough nymph
#

mkay

#

thanks

rose fiber
#

I thought both just worked everywhere

humble tulip
empty sundial
#

im very convinced that what you want to do can be done with pure css

#

especially because the masks from the url are just .... elements on the page

tough nymph
#

So I did this and it still didnt replace the code

tough nymph
#

I think my regex is incorrect

humble tulip
#

Since all the code is actually on one line

tough nymph
#

ahh yeah you're right

#

hmm

#

nice, it worked

green vessel
#

im just trying to get this element but ive tried findByCodeLazy, findByProps, findByPropsLazy, findComponentByCode, findLazy so im obviously doing someting wrong 💔 am i looking in the wrong place here?

green vessel
#

i cant find any documentation 💔

hushed loom
#

why do you want to find it, what are you trying to do

green vessel
#

uhhh i want to add buttons above the text input bar, i assumed id need to find that element first

green vessel
#

ts is so confusing

#

i wanna learn but i cant find resources

hushed loom
#

this is not a place to learn typescript

#

you should know it already

green vessel
#

not typescript, im familiar with ts and js

#

just not in this context at all

#

oh my bad

#

ts is an abreviation

#

im just trying to figure out patches based off of other plugin code but its not going so well

dull magnet
#

ts = this shit

hushed loom
hushed loom
green vessel
#

thanks im gonna keep trying

steady knot
#

hey @humble tulip custommessagetimestamps broke btw and I have no idea how to fix it but you probably do

humble tulip
#

Thanks, I'll take a look tomorrow

humble tulip
#

@steady knot it's still fine for me, have you pulled recently? The patch changed a few weeks ago

steady knot
#

yeah I did

#

wait

#

ok I swear I did but apparently not

#

I however crash if I try to view the settings

#

oh I think I know why

yeah didn't pull constants lol

empty sundial
#

what would be the best way to force a component to rerender? im adding my own logic here to force true at a specific condition, doesnt update until i change channels/upload something though

empty sundial
#

any plugin where i can get an example from orr

humble tulip
steady knot
#

yeah all good

humble tulip
#

Sweet

steady knot
#

yeah took me a while to notice it's broken because a lot of my stuff is in various states of disrepair

#

but someone made an issue in my github about it lol

dull magnet
#

it's just react

#

insert a useState() call

#

update state to rerender component

empty sundial
#

i was thinking about inserting a usestate but i wasnt sure if there were better ways

hushed loom
#

tbh AI prob can do basic react

dull magnet
#

yes it can

empty sundial
hushed loom
clear parcel
tropic ice
#
{
            find: ".full,tooltipClassName:",
            replacement: {
                match: /text:(\i).full,/,
                replace: "text:$self.renderTimestamp($1,'tooltip')"
            }
        }

How do i fix Unexpected identifier 'tooltipClassName'

#

test <t:1744617600:t>

dull magnet
tropic ice
#

🤦

#

yay i actually made a functioning patch

#

<t:1744543174>

ancient light
#

I was looking at other implementations of fetch, and I don’t know what I’m doing differently. Can it not happen on-demand, and it has to be run on startup?

ancient light
#

I was talking about this earlier, but I’m running into issues with cors.

#

I’m trying to fetch a file embed from discordapp from discord

dull magnet
#

show code and error

vast karma
ancient light
#

Is there a more abstract fix that you can just describe?

#

The response needs to be opaque.

fallen sandal
#

why are you speaking to vee like hes an llm 😭😭😭

vast karma
#

Is he not?

ancient light
ancient light
#

3PBp

amber mantle
#

larger large language foundation reasoning model with thinking

#

that actually hates its own kind

#

wait i'm just describing humans now

#

everyone hates each other blobcatcozy

ancient light
#

Indeed.

empty sundial
#

i genuinely cannot figure out how to stop the message input stop clearing after sending a message, already tried patching all the "shouldClear"s to false, tried patching out various setState calls, big mystery to me...

dull magnet
#

why

empty sundial
# dull magnet why

on the forward plugin i made the message gets cleared from your input even if you have keepforwarding enabled which is annoying asf

cedar olive
#

it's definitely controlled by shouldClear

empty sundial
#

patching shouldClear to false definitely does something, it delays the clearing but it still clears

#

specifically using the patch

{
    find: "this.props.pendingScheduledMessage",
    replacement: {
        match: /(\i\.drafts\.type\),{shouldClear:)!0/,
        replace: "$1false"
    }
}
#

(unless this is the wrong module? xd)

cedar olive
#

very likely the wrong

clear parcel
gusty maple
#

thankls for the ping now i know what to steal blobcatcozy

normal wagon
#

what's the store that discord relies on to display this number here

dull magnet
#

RelationshipStore

normal wagon
normal wagon
#

is getMutualFriendsCount linked with

#

UserProfileStore

#

because it doesn't seem to be working

#

UserProfileStore.getMutualFriendsCount()

clear parcel
#

i believe the profile needs to be loaded

#

yeah it does

silk sorrel
#

50 mutual friends 😩

north flame
#

Oh vee

azure fossil
#

how do i access a localstorage key ?
basically i want to force set "resizable-sidebar-width-2" and patch the function that allow resizing so that the sidebar can't be resized

empty sundial
#

why do that when you can just

.sidebarResizeHandle_c48ade {
    display: none !important;
}
#
  • has the benefit of being able to resize again just by turning off your quickcss
azure fossil
#

so sure i don't need to patch the function

hushed loom
azure fossil
vast karma
#

Desktop app is web

azure fossil
#

yeah but what i mean is that the key value is the one that's actually used

#

it's not just some random stuff

#

if i change the value and reload, it will take the size

hushed loom
#

Maybe they have a store for it

#

Just look at the Stores global with console Shortcuts enabled

azure fossil
#

idk, i only found it used there

Vencord.Webpack.findModuleFactory("resizable-sidebar-width-2")
ƒ (e,t,n){n.d(t,{li:()=>r,nT:()=>a,p8:()=>o,qO:()=>l,zx:()=>i});let r=264,i=432,l=375,o=12633==n.j?76:null,a="resizable-sidebar-width-2"}
humble tulip
#

Am I misunderstanding or do you just want to know how to set a value in local storage? Like localStorage.setItem("resizable-sidebar-width-2", 150);

humble tulip
azure fossil
humble tulip
#

You'll need module 37082 then

#

Either patch out that delete or use the reassigned one

azure fossil
#

the idea is basically i'm gonna make a js + CSS snippet to make a custom UI ressembling the old UI so ideally it'd be smth easy to use

dull magnet
#

vencord exports localStorage somewhere

#

just import from there

#

or Vencord.Util.localStorage in devtools

azure fossil
#

that's convenient

signal glade
#

hi!!

#

ok prepare for rookie ahh questions

#

this doesnt seem to work

#

im using vencord desktop custom build (with one example plugin) and have restarted

humble tulip
#

It may be in the overflow menu at the top of dev tools

empty sundial
#

elaborate, do the tabs not show up or?

humble tulip
#

If not, sometimes once you do the full restart you also have to do a soft reload for it to pop up

signal glade
empty sundial
#

have you done a full restart? completely closing the app from the task manager?

empty sundial
#

ctrl r is not a full restart

signal glade
#

noted

#

hooray thank you both (did task manager restart + ctrl R restart)

empty sundial
azure fossil
#

i think i have noticed a vanilla discord issue and i have no idea how i could even fix it
basically if you right click on a message then right click on another with the menu still open, instead of bringing the menu on the other message, it simply make the menu disappear
it's like the menu will simply consume the action when exiting

#

actually it's not just limited to right clicking actions

#

if you right click and then try to left click smth like the window close button, it'll steal your input

vast karma
#

Yep

#

That's how it's worked on every platform for a few decades

azure fossil
#

worst thing is it didn't exist on the old UI

vast karma
#

If it didn't do that, that'd be a bug

azure fossil
#

i'm pretty sure

vast karma
#

...Huh, apparently not on windows

#

On linux every program does it like that

azure fossil
vast karma
#

That's a windows bug then

azure fossil
#

having to do 2 inputs instead of one when you miss the position sucks

vast karma
#

Because that's the correct behavior

#

Clicking outside the menu closes it

azure fossil
#

i disagree, but fine

azure fossil
#

the menu is merely smth that's added on top of the context, it's not a new context

#

if i can see smth, i should be able to interact with it

vast karma
#

The menu has keyboard focus and everything

#

It's a new context

azure fossil
#

unless it's made clear that i cannot by by example hiding it completely or making it unreadable with blur

azure fossil
humble tulip
#

Add css div[class*="trapClicks_"]{ pointer-events: none !important; } to your quickcss

azure fossil
#

omg
did they really do that

azure fossil
#

but it's better than nothing, thanks

signal glade
#

i dont think i understand finding matching for patches

#

because when i try to search something someone else wrote in the source code i cant find it

hardy adder
#

well it uses regex

#

sort of

signal glade
#
  1. sort of? 😭
  2. but even if i search something like "REPLY_QUOTE_MESSAGE" it doesnt find it
vast karma
signal glade
#

what is this referring to then

vast karma
#

That's referring to the hash of the intl key REPLY_QUOTE_MESSAGE_BLOCKED

#

Since those hashes are a bit opaque

azure fossil
humble tulip
#

Discord memoised message timestamps and it's made my custom timestamps plugin crash the app smh

signal glade
#

nooo i love your custom timestamps plugin

signal glade
#

hooray i got a patch working thank you

humble tulip
#

I guess it works but this seems like a weirdly roundabout way of detecting the timestamp format

#

I'm tempted to just patch out the useMemo to fix it but I probably should fix it properly

#

I think it's just because I'm using the force updater inside it

empty sundial
# cedar olive very likely the wrong

whelp i searched through what feels like every file and i cant see anything else that clears it
now ive even tried patching out the calls to clearValue completely and patching the function to just immediately return and it still clears..... in genuinely at a loss

humble tulip
restive imp
#

how can i disable notfication in system? to show it only in discord

restive imp
#

no, i mean in plugin (in code)

vast karma
#

I'm sure you can write some code that toggles that settning

#

Why?

restive imp
# vast karma Why?

I am writing a plugin in which when you click on a notification a function will be executed, and because of this I would not like it to be shown the system notification as well

#

i didnt see this option in interface NotificationData but maybe somewhere other setting disablint that

humble tulip
#

I think you'd need to add a condition here to let it be set per notification

normal wagon
restive imp
dull magnet
signal glade
#

nvm i got it

mighty topaz
#

What is the best way to have a small tag or a place holder on my banner? Is there a pre-made function?

rugged latch
#

really sorry for asking this, but does anybody have any resources to get started with "modding" the app? i already know typescript, i have followed the guide to create a plugin, but now i'm stuck with not knowing how discord actually works plugin-wise, (meaning where to find patch "find" values, etc.)
really appreciate any reply

signal glade
rugged latch
#

thx I'll take a look

signal glade
#

im not the best source since i started literally yesterday but feel free to ask more questions

hoary pilot
rugged latch
#

yeah I tried doing that yesterday
it kinda worked but still

hoary pilot
#

but for other APIs and all read existing plugins.

fickle jetty
#

hey quick question is there a way to get patch helper in vesktop or do i have to run it through the vscode extension/patched discord?

#

i tried compiling vesktop from source but the tab doesn't appear in settings despite enabling dev mode

hushed loom
hushed loom
fickle jetty
hushed loom
#

also you need to do this

#

set the location to your local vencord dir

fickle jetty
#

oh so build vencord and set the location in vesktop?

hushed loom
#

yes

fickle jetty
#

gotcha, ty

mighty topaz
#

nvm I found it

unkempt hemlock
#

@wraith carbon hi, your plugin ForceOwnerCrown does not seem to be working anymore. could you take a look, please? thanks!

oak sundial
unkempt hemlock
oak sundial
# unkempt hemlock that is the logical way to inform them?

Does not matter, its needy and who knows if they even work on Vencord anymore. We know what is and isn't broken and you do not need to pester plugin developers about it.

Do it in the future and we may strip your access to these channels

#

Also, its not even ForceOwnerCrown which is broken, actually

#

it being broken is a side effect iirc

dull magnet
#

be nice 😭

oak sundial
#

some other stuff with the memberlist broke too, i wouldn't be surprised if it has to do with that

unkempt hemlock
#

I had checked if the developer was active before sending the message, and he/she is

#

I had notified developers in the past about problems in their plugins and I have always been very welcomed by that

#

if you don't like it, sure, but you can't speak for them

unkempt hemlock
#

👍

empty sundial
#

so there is no real point in notifying people because someone else (probably sadan) will fix it

#

thank you sadan btw blobcatcozy

unkempt hemlock
#

all hail sadan

hoary pilot
#

I killed @hushed loom

#

no more vencord plugin maintenance for yall

swift delta
fresh jetty
ancient light
#

What am I doing wrong? I've tried many things and nothing seems to work.

empty sundial
#

what is your plugin called

ancient light
#

uploadAsConstructor

#

folder and definition

empty sundial
#

send full code

ancient light
#

okay, but it's really ugly

empty sundial
#

ok

ancient light
empty sundial
ancient light
#

capital U?

#

thanks

#

sorry

empty sundial
#

no need to apologise everyone makes mistakes 👍

ancient light
#

the plugin is illegal anyway, it breaks rule 7

#

No plugins that interact with specific Discord bots

dull magnet
#

Also every time you make changes to your native script you need to fully restart discord for it to apply

#

i.e. close it from tray

ancient light
#

im developing with the extension, so refresh works, right?

#

pnpm buildWeb -> reload extension -> refresh webpage

dull magnet
#

natives are not a thing in web

#

how would that work

#

natives are desktop only for when you need to run code in the system process with stuff like filesystem access

ancient light
#

no, i'm using it for cors

ancient light
hoary pilot
ancient light
#

so.. am I just screwed?

hushed loom
ancient light
#

yeah, that was my first thought

dull magnet
#

your own or someone else's

ancient light
#

discordapp

#

so someone else's

#

if it was my own I could just give it cors perms

dull magnet
#

okay just asking cause a lot of people have no idea how cors works and have cors problems with their own api

#

well there's nothing you can do

#

just don't use that

#

why do you need to fetch smth from there

ancient light
#

embed/cdn link

dull magnet
#

you should be able to just fetch that

#

from the media proxy

ancient light
#

what's the url?

#

just the cdn subdomainɁ̦ cuz that doesn't work

#

or is it something jank like a specific port is the only one let through

swift delta
#

What is the asset?

ancient light
#

it’s dynamic

ancient light
#

in vesktop:

vapid oar
twilit rivet
#

how the hell am i supposed to write a patch for this (newbie question sorry)

#

im trying to make it so the l function return true (which supposedly should make the channel list collapsible)

empty sundial
#

just patch the place where the function is used (more unique and will also reduce side effects)

twilit rivet
#
{
    find: "\"ChannelSidebar\"",
    replacement: {
        match: /.isOpen\)&&(.);/,
        replace: ".isOpen);$1=true;"
    }
}

any idea why this patch doesnt work? patch helper says everythings good and it compiles but when i put it into my plugin it doesnt even try to patch the file

empty sundial
#

check console

#

scroll the the beginning vencord will throw a warning if the patch had no effect (nothing got matched) or an error if the patch resulted in a javascript error

silk sorrel
empty sundial
#

forgot to rebuild... classic

silk sorrel
#

u can use pnpm run watch so u dont have to rebuild every time

twilit rivet
empty sundial
#

reinject

twilit rivet
#

a who what now

empty sundial
#

..

#

you need to build

#

then inject

#

pnpm run inject

twilit rivet
silk sorrel
#

Go to vesktop settings > developer options, and change the vencord location

empty sundial
#

set the custom vencord path to your vencord directory

#

yeah

twilit rivet
#

already done

#

its not that my plugin isnt loading, another one of my patches is still working

#

ok i figured it out but i wil lnot say what i did wrong in fear of getting jumped

ancient light
#

discord is weird

dull magnet
#

give an example url you wanna fetch

ancient light
#

https://cdn.discordapp.com/attachments/1032770730703716362/1363161306416287996/1745073379881.png?ex=68050665&is=6803b4e5&hm=cf34ab78bcf06428341ec5c2c4887867bb5db1ae919d16833d824e78ae4c0c27&

dull magnet
#

why do u even need to fetch it

ancient light
#

What do you mean?

empty sundial
ancient light
#

I sent my code earlier…

turbid loom
#

does anyone know how to intercept (or remove) the original functions for hotkeys, like remove the thing that edits if you hit up on your keyboard with a vc plugin

hushed loom
mighty topaz
#

Anyone knows the name of the icon in loading (the one where it shows the quotes)

dry reef
hoary pilot
#

doesn't

dry reef
#

Thanks

#

sorry for ping

quasi maple
#

working on a fork of it with tab groups. prob gonna finish within the next month if im not lazing off

hushed loom
#

@gusty maple i think you were looking for this module earlier

cosmic wigeon
#

hello someone can now help me with my code or technical error?

swift seal
cosmic wigeon
oak sundial
#

horror plugin but please do not interact with the api via fetch

#

though, i'd make sure you actually restart the client properly

#

if it compiles just fine, and you are following the correct structure, it will appear

fresh marsh
#

anyone know how i can hide/unhide an embed client-side (pretty much without sending a request to change the message flags) (no not all embeds either)

tropic ice
fresh marsh
#

what plugin

#

restrictembeds sends a request and doesn't work everywhere

humble tulip
#

I do it here by just removing it from the message object and rerendering but I then send a request to retrieve the embed to show it again which could probably be done easier if you just wanna hide/show existing embeds

fresh marsh
#

yeash just hide/show existing ones

bronze dove
#

vp hidemedia

shrewd tundraBOT
fresh marsh
#

thank you

fresh marsh
#

how do i get author id from a message

tropic ice
fresh marsh
#

sorry i don't know which one in particular

vast karma
#

View raw for example

iron epoch
#

it's in vanilla discord so no plugins needed

fresh marsh
#

i mean in the context of the plugin so i can filter...
also i got it now, haven't thought of using the raw data

vast karma
#

Or just console.log the message, like you do with literally any type you want to inspect to find the props to use

cosmic wigeon
brittle apex
#

why's regex have to be so hard >:c

dull magnet
#

you found the right location in the code?

brittle apex
#

yea

#

It's js doin a rlly bad work at showing u what to do with it

dull magnet
#

what does Test Patch result in

brittle apex
#

Patch failed: Error: No Discord Clients Connected! Make sure you have Discord open, and have the DevCompanion plugin enabled (see README for more info!)

#

I m 2 lazy 2 setup DevCompanion

dull magnet
#

lazy how

#
pnpm watch

done

brittle apex
#

uhh idk I remeber it not working 4 me

#

ran it did the same error

dull magnet
#

restart discord

brittle apex
#

aight

#

Patch failed: Expected exactly one 'find' matches, found 2

dull magnet
#

fix that

#

two modules match

brittle apex
#

and how do I like... fix it

#

srry am js dumb asf

#

huh

#

@dull magnet r u here?

dull magnet
#

by making your find more specific so that it only matches the one module you want to patch

brittle apex
#

but the tutorial didn't show how to do it

#

r u good w regex?

#

cuz I may or may not(MAY VERY MAY) need help

normal wagon
#

if i'm using UserStore.GetUser(<user_id>) on a large amount of people will that put my account at risk?

#

i'm trying to get mutual-friends, data im just wondering

fallen sandal
twilit rivet
#

how do i do the "error" screenshake that happens when, for example, you try sending a message while you still have slowmode

bronze dove
dull magnet
#
setInterval(() => ComponentDispatch.dispatch("SHAKE_APP", {duration: 300,intensity: 2}), 400);
humble tulip
#

duration: Number.MAX_VALUE

brittle apex
#

uhh

cosmic wigeon
#

anyone know what is going on? i don't have such import in the code even i only have such:

const { Plugin } = require('vencord');
const { Button, ActionRow } = require('vencord-components');
const { prompt } = require('vencord-utils');
> vencord@1.11.9 build C:\Users\X-Code\Documents\Vencord
> node --require=./scripts/suppressExperimentalWarnings.js scripts/build/build.mjs "--dev"


  dist\preload.js
  dist\            2.4kb
  vencordDesktopPreload.js            2.3kbdist\
  preload.js.LEGAL.txt    dist\0b vencordDesktopPreload.js.LEGAL.txt    0b
  dist\vencordDesktopPreload.js.map        9.4kb

Done in 24ms

  dist\preload.js.map        9.4kb

Done in 22ms

  dist\patcher.js             44.8kb
  dist\
  dist\patcher.js.LEGAL.txt    1.1kb
  dist\patcher.js.map        239.9kb

Done in 101ms
vencordDesktopMain.js             39.9kb
  dist\vencordDesktopMain.js.LEGAL.txt    1.1kb
  dist\vencordDesktopMain.js.map        221.0kb

Done in 103ms
X [ERROR] Could not resolve "./userplugins/removechannel"

    import-plugins:~plugins:188:17:
      188 │ import p187 from "./userplugins/removechannel";
          ╵                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

X [ERROR] Could not resolve "./userplugins/removechannel"

    import-plugins:~plugins:185:17:
      185 │ import p184 from "./userplugins/removechannel";
          ╵                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1 error
Build failed with 1 error:
import-plugins:~plugins:188:17: ERROR: Could not resolve "./userplugins/removechannel"
 ELIFECYCLE  Command failed with exit code 1.
vast karma
#

Do you have a removechannel folder with no index.{ts,tsx}?

vast karma
#

Plus, that isn't how you import things anyway

vast karma
cosmic wigeon
vast karma
#

Have you looked at literally any other plugin

cosmic wigeon
vast karma
#

So you acknowledge that you do things completely different from all other plugins

#

But you haven't considered that that might be why things aren't working?

cosmic wigeon
normal wagon
#

i'm trying to get the server-tags from the list here

#

nevermind found it

#

my question is what would i use to grab that array there emojithinkin

normal wagon
#

nvm once again

normal wagon
#

right now im using patches to get the function data once its called is there a way to call it without relying on a call first?

#

and what function would i use to find it

iron epoch
#

you could use it to find function by their code

normal wagon
#

probably cause of lack of experience i've tried fetching the table with all different kinds of stuff only thing working for me is my patch

#

but its fetching once i open the profiles tab and i need it before

iron epoch