#🧩-plugin-development

1 messages · Page 66 of 1

amber basin
#

wrong

#

the find is a unique string from the module you are trying to edit

#

it doesnt need to have any relation to what you want to edit, it just has to be in the same module

#

its how vencord knows its editing the right module

indigo oriole
amber basin
#

now thats an i18n string so you could either ctrl+shift+f the text for it, or you could inspect it in react devtools and click the view source button to see where the code that makes the popup is

indigo oriole
#

hmmm

indigo oriole
#

you can find that i18n string?

amber basin
#

well you would see that that variable is being used there

#

but to find the actual contents of it youd need to set breakpoints or ctrl+shift+f the variable name

indigo oriole
#

hmmm

indigo oriole
indigo oriole
#

ight

#

thanks for your help and lilith's

tight canyon
#

Is there a way to do fallback in ErrorBoundary without typescript telling me to fuck off

fallback: data => {
  return <>{data.children?.props?.text}</>;
},

I'm getting Property 'props' does not exist on type 'string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | ReactFragment | ReactPortal'. Property 'props' does not exist on type 'string'.ts(2339) while doing so

amber basin
#

try (data.children as ReactElement<any>)

tight canyon
#

oh, it works now. Thanks!

ripe smelt
#

I'm trying to make it so the plugin upload files to files.offshore.cat (using sharex config values), but I keep getting this error. I believe its because I'm passing through the header wrong. Would appreciate some help.

Error: Access to fetch at 'https://any.corsbypass-f43.workers.dev/?https://files.offshore.cat/api/upload' from origin 'https://canary.discord.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
POST https://any.corsbypass-f43.workers.dev/?https://files.offshore.cat/api/upload net::ERR_FAILED

Code:

async function uploadOffShoreCat(file: File, channelId: string) {
    try {
        const formData = new FormData();
        formData.append("file[]", file);

        const headers = new Headers({
            "x-api-key": "OFFSHORE.CAT KEY HERE"
        });

        const corsBypassURL = "https://any.corsbypass-f43.workers.dev/?";
        const uploadResponse = await fetch(corsBypassURL + "https://files.offshore.cat/api/upload", {
            method: "POST",
            body: formData,
            headers: headers
        });

        const uploadResult = await uploadResponse.text();

        if (uploadResult.startsWith("https://")) {
            setTimeout(() => insertTextIntoChatInputBox(`${uploadResult}`), 10);
            UploadManager.clearAll(channelId, DraftType.SlashCommand);
        } else {
            console.error("Error uploading file:", uploadResult);
            sendBotMessage(channelId, { content: "Error uploading file. Check the console for more info." });
            UploadManager.clearAll(channelId, DraftType.SlashCommand);
        }
    } catch (error) {
        console.error("Error uploading file:", error);
        sendBotMessage(channelId, { content: "Error uploading file. Check the console for more info." });
        UploadManager.clearAll(channelId, DraftType.SlashCommand);
    }
}```
dull magnet
#

don't use cors proxy

#

you can send request via native.ts to bypass cors

ripe smelt
#

same was true with this native.ts

export async function uploadFileToCatbox(_, data) {
    try {
        const userhash = "";

        const blob = JSON.parse(data).blobData;

        const formData = new FormData();
        formData.append("reqtype", "fileupload");
        formData.append("fileToUpload", new Blob([blob]));

        const catboxApiResponse = await fetch("https://catbox.moe/user/api.php", {
            method: "POST",
            body: formData
        });

        const contentType = catboxApiResponse.headers.get("content-type");
        if (contentType && contentType.includes("application/json")) {
            return await catboxApiResponse.json();
        } else {
            const textResponse = await catboxApiResponse.text();
            return JSON.stringify({
                success: true,
                url: textResponse
            });
        }

    } catch (error: any) {
        return JSON.stringify({
            error: "oh shit",
            errorData: {
                message: error.message,
                stack: error.stack
            }
        });
    }
}
#

it would just error without the cors proxy

dull magnet
#

then you did something else wrong

#

check the error

ripe smelt
#

it just tells me something like "the function native.uploadFileToCatbox is undefined or invalid"

#

and I'm not aware of a way that allows native.ts to log/show specific errors that occur within native.ts

ripe smelt
#

oh it works without any issues

#

so you should always fully restart when making changes to native?

ripe smelt
#

alright, thanks

#

is there a way to import settings.store into native.ts?

hushed loom
#

Iirc you can do Vrncord. Plugins.plugins.YoutPluyin.Settings. Store

#

Could be wrong

ripe smelt
hushed loom
dull magnet
#

it exports the global settings object

flint bronze
#

THE ??? button

#

love passing false in react

ripe smelt
dull magnet
#

no

#

the "main" folder

#

look at other plugins

frosty otter
#

they added it to canary

acoustic nest
#

@dull magnet my plugin's first party feature is now deployed to canary, prob best to have the vencord plugin removed before it hits stable

boreal vessel
#

what

acoustic nest
boreal vessel
#

make what a what party feature

dull magnet
vast karma
#

Make party mode a party feature

boreal vessel
#

ah

dull magnet
#

i feel like "Jump to Context" or something like that sounds better tho

#

well

#

Discord can bikeshed it

boreal vessel
#

fr

cedar olive
#

@acoustic nest literally the same method we used haha

acoustic nest
#

I did guide him a bit on how it worked

#

He wasn’t familiar with that part of the code base

cedar olive
#

what does he normlly work at?

#

if you are able to disclose

acoustic nest
#

He’s on the bots team rn iirc? Apps and activities or smtn

#

I don’t often talk work with him

cedar olive
#

I see

#

that's very cool

acoustic nest
#

I also told him about the quirk that makes it all work at all

#

Specifically the message jump only using the timestamp

cedar olive
#

I mean i'm not even sure if it's a quirk

#

it's very much intended that message jumps work like that

acoustic nest
#

Yeah

#

I suppose

dull magnet
#

yes it is

rocky falcon
#

is there any way to detect typing in the chatbox and dynamically change it in-app?
kinda like AHK?

boreal vessel
#

oh

#

textreplace does that when you send a message

#

but probably for while youre typing its possible

rocky falcon
boreal vessel
#

yeah ofc

rocky falcon
#

(obviously it should end up in the sent message, but i mean i want to change it while the user is typing, not after they send it)

boreal vessel
#

sounds like a good idea, one day ill learn how to do it too

#

sorry i cant help

hushed loom
#

Also clear then append text to edit the chatbox

boreal vessel
#

wait if you hook and event dont you get access to the element

#

or would it be a vencord hook not js

trim marlin
#

is something like this gonna be worthy of being an official plugin if i make it, or is that too niche?

the old experiment is completely removed so im gonna have to recreate the channel icons
i can use discord's emoji data cause it should be available somewhere in the webpack modules
but i'll also remove the brackets/dashes/dots/other fancy charactes people use (using regex) so that it doesnt look weird like #《》general or #-general with the separated emoji

rocky falcon
#

please make that 🥺

trim marlin
#

although im not sure how to get the color of the emoji

rocky falcon
balmy sky
#

I made that

rocky falcon
#

where

trim marlin
rocky falcon
#

where is it i want it in my fork

trim marlin
balmy sky
#

I mean feel free to remake it the code is shit

#

It uses a local ollama server and i'm not sure how else you would get emojis for channels without emoji names (?) so not sure if it's a good idea for stock

trim marlin
#

my idea is just to replace the channel icon if theres already an emoji

#

no AI or anything

balmy sky
#

Might look kinda out of place if some aren't there

#

Random emoji?

#

Maybe

trim marlin
#

replacing the hashtag icon looks good enough

#

so some will look like just the hashtag and some will have an emoji

balmy sky
#

Oh true

#

Emoji ?? hashtag trolley

trim marlin
#

also removes the need for the circle whose color matches the most common color of the emoji

#

which is kinda a hacky thing to do in a plugin

#

and i dont like including large predefined stuff in userscripts/plugins

trim marlin
quasi timber
#

im trying to figure out how to add text under names like a status?

#

also specifically when the user doesnt have a status showing, i want to put some custom text there

jagged briar
#

find the status text component and patch it

quasi timber
#

i can keep trying

#

i'm quite new to this

quasi timber
#

i did it :)

boreal vessel
#

whatd u do

#

ohh

#

W

quasi timber
#
{
  find: ".MEMBER_LIST_ITEM_AVATAR_DECORATION_PADDING)",
  replacement: {
    match: /subText:(\i){1,2}\(\),/,
    replace: "subText:[\"test\"],",
  }
}```
boreal vessel
#

now make a function that gives an output for it

quasi timber
#

yeah

boreal vessel
#

also console.log when that function is ran (so you can see the interval that subtext thingy is ran/checked)

quasi timber
#

ah good idea thanks

boreal vessel
#

np

boreal vessel
#

how to get the guild member version of a User obj for a specific guild

hushed loom
quasi timber
hushed loom
quasi timber
#

it works so i kept it

hushed loom
quasi timber
#

doesnt that part just mean any two characters?

#

or 1 to 2 characters

#

im not sure now

hushed loom
#

\i expands to [A-Za-z_$][\w$]*

quasi timber
#

ohh thank u

#

yeah i think it makes sense to have that part right?

#

why not

#

currently its subText: eR()

hushed loom
#

its useless

#

could only match incorrect things

quasi timber
#

hm okay, so i should make it more specific?

#

i'll do that

vast karma
#

I guess \i? is pretty uncommon

hushed loom
#

oh

vast karma
#

(?:) is a verb now

quasi timber
#

(?:3

flint bronze
# quasi timber

this doesnt actually look like it's editing the status itself, instead it looks like it's editing where the status component itself is

quasi timber
flint bronze
#

want to hear a fun fact

#

there was an experiment that did this and got removed

quasi timber
boreal vessel
#

W

flint bronze
quasi timber
#

it basically works now

quasi timber
#

i think its basically ready, ill probably share it soon after some tweaks

#

blobcatcozy

boreal vessel
#

WWWWW

quasi timber
#

it also does this

boreal vessel
#

WWW

#

i like this

#

makes it easier to stalk my friends

#

jkjkjkjk

#

lmk when its out 🙏

quasi timber
#

not stalking, just being socially one step ahead Teehee

hushed loom
quasi timber
#

nah im using this to predict their every move

quasi timber
#

i feel kinda stupid but idk why Vencord is undefined

#

it only happens when i use a rect svg element

#

its really weird

cedar olive
#

how are you using it

quasi timber
cedar olive
#

you are using on top level

#

make it a functional compononent

quasi timber
#

ok i think i understand what to do thank you

swift delta
#

nl I think this would have to have a “opt-out” feature if if not it’s kinda creepy gang

quasi timber
#

i feel you

#

but idk how that would be possible

#

other than just offline/invisible mode

amber basin
#

make a little express server with discord auth and allow ppl to opt out

#

like reviewdb

swift delta
#

^ this

quasi timber
#

hmm okay cool idea

amber basin
#

vee's untrusted apis rule can prob be ignored if you ask them to host it on their vps

swift delta
#

I mean, that’s why this could nuke the experiment because you know creepy

#

if anything I feel like this would be the opposite of reviewdb where you would have to opt into it

quasi timber
#

i mean people would just be able to modify the code since it only enforces who's opted in on the client side right?

#

most people wont do that, but still

rocky falcon
#

imma edit the code to bypass my own opting out rather than just opting in

swift delta
#

you could easily make that server side

quasi timber
#

i'll share the repo when i'm done, im not 100% sure what the best way to implement this would be

empty sundial
#

discord spyware and stalking !! love it

rocky falcon
#

aint spyware if you have to opt in

empty sundial
rocky falcon
#

then they made spyware lol

hushed loom
#

what if, and hear me out, we didnt make creepy plugins

rocky falcon
#

also that really isnt spyware

empty sundial
swift delta
empty sundial
#

insane idea

empty sundial
hushed loom
#

its soooo hard to resist stalking people
- average vencord whitename

quasi timber
#

now this is spyware: .

empty sundial
#

this entire plugin is a really REALLY bad idea no matter how much you twist it

#

okay guys

#

hear me out

#

what if we killed people like this

#

to make people actually afraid of making stuff like this

#

?

#

good idea? yeah? thanks for agreeing with me

quasi timber
hushed loom
#

why even post it husk

quasi timber
#

should i unpost it?

swift delta
empty sundial
#

YES

quasi timber
#

i didnt make this with malintent, im sorry 😔

#

maybe i wont share it with the world if you think its harmful

fallen sandal
#

guys can I get a plugin to track all changes to a specific persons profile and send me a text when ANYTHING changes

swift delta
quasi timber
hushed loom
fallen sandal
#

help I installed Vencord and now my PC is slow is this normal

empty sundial
hushed loom
#

too lazy

fallen sandal
#

where's that ultimate token logger plugin I was promised

hushed loom
#

@hoary pilot will make

swift delta
rocky falcon
#

ive never been triple husked so fast lmao

#

quintuple, damn

fallen sandal
swift delta
quasi timber
#

guys should i add live physical location tracking to vencord, you can opt out for a small fee :3

swift delta
vast karma
#

What's the point of location tracking if you don't have a keylogger

quasi timber
#

thats why we need people like you

fallen sandal
#

incredible innovation

rocky falcon
fallen sandal
rocky falcon
#

edit: thanks for 200 likes

#

the love yall was specifically sarcastic

vast karma
rocky falcon
rocky falcon
balmy sky
fallen sandal
swift spear
#

what's wrong here?
problem with : in replace: "guild:$1," and I have no idea why

jagged briar
#

click this in the error and screenshot

swift spear
jagged briar
#

conflicted with other plugin or bad patch

swift spear
dull magnet
#

you don't match anything yet add new guild:$1

swift spear
dull magnet
#

because your match makes no sense

swift spear
#

why? I'm capturing guild variable in lookbehind group and adds it between this group and last one with pronouns

#

rn I'm adding it before nicknameIcons and it works

dull magnet
#

stop doing that

#

match only the place you need to change

#

don't match 2km away

#

and make your match more specific

dull magnet
#

and don't overuse lookarounds

#

matching 0 characters and only using lookarounds is confusing

#

and why are you even adding guild there

#

what's the point?

swift spear
#

I think it's time to sleep for me

swift spear
dull magnet
#

so you are passing it to a different component just to be able to use it there?

swift spear
#

yea, there's better way?

dull magnet
#

that's terrible never do that unless you really have to

#

why can't you just use getCurrentGuild()

swift spear
#

thanks

#

and good night for me xd

north flame
humble tulip
#

Pretty simple but d'you think this is something anyone would be interested in using? If not I'm just gonna leave it as a basic "I only really care about chrome" plugin for myself lol

#

Only needed on desktop obviously

sudden belfry
sudden belfry
humble tulip
#

Yeah maybe. I got into the habit of always opening like one-off suggested youtube videos in incognito so it didn't affect my recommendations too much and it evolved into me just opening everything in incognito now

#

So it's nice to be able to do straight from discord as well

sudden belfry
#

I often open incognito when doing searches for things, like while developing and I do a quick search for stackoverflow. I guess I just got in the habit of it as well

humble tulip
#

Also considering the custom option is just you writing your own shell command, I imagine it could be expanded into a general "Open with..." but I don't wanna think about that right now

tight canyon
vast karma
#

I mean "open link in new window" has been a thing in browsers for decades

tight canyon
#

But not from discord window

vast karma
#

Shift right click

tight canyon
#

I often use it when just browsing

tight canyon
#

I didn't know that

sudden belfry
#

I actually also made a plugin but idk if I can share it or not since it wasn’t accepted in unofficial plugins (though it was quite buggy so glad it wasn’t), but it’d be especially nice to show it to some people with my recent update

humble tulip
#

I have a second one too but it requires a slight change to core and allows people to execute arbitrary code ("run" button on codeblocks) so I imagine it would be shot down lol

#

And then on top of that it's also just pretty niche. I just wanted a quicker way to store and run useful snippets or try stuff from #🎨-css-snippets and #📜-js-snippets
The change to core is allowing plugins to amend web request headers (without exposing it to openasar and causing conflicts) so it can allow code to run in iframes, etc

humble tulip
#

Yeah I figured that too, that's why I haven't submitted it for anything

iron epoch
#

the plugin name is quicksnippet ig?

#

if you wanna borrow code go ahead

humble tulip
#

Yeah I found it like a week after I made it myself lol

#

But that's okay, it was a good learning experience, I've never used react before

iron epoch
#

I have a new plan for that name but because my frontend skills don't allow me to execute it sadly

sudden belfry
sudden belfry
empty sundial
#

just say what it is

sudden belfry
#

Well it’s a plugin which utilizes Vencord’s badge api to create profile badges exclusively visible to the user through locally stored data. (Used to use JSON but now DataStores)

empty sundial
#

well it probably wasnt allowed because badges are supposed to be exclusively for donators

sudden belfry
#

Yeah I know, I was told that

#

But I meant just talking about it since I recently updated it to make it better, not having it posted there

sly quiver
#

im trying to create a settings option where i can turn off showing the "@" but im bad with discord patches and i cant find anyway to do it, any help please?

sly quiver
#

this option but for role mentions

cedar marsh
#

Hide replies to messages from blocked users:

{
    find: ".messageListItem",
    replacement: {
        match: /(?<=\i=)(?=\(0,(\i)\.jsx)/,
        replace: "!$self.isReplyToBlocked(arguments[0].message)&&"
    }
}
isReplyToBlocked(message: Message) {
    const { messageReference } = message;
    if (!messageReference) return false;
    const replyMessage = getMessageByReference(messageReference).message;
    return this.isBlocked(replyMessage);
},

@cedar olive this works, but I honestly have no idea if its the correct way of going about it

cedar olive
#

what does message reference contain

cedar marsh
# cedar olive what does message reference contain
const { getMessageByReference } = findByPropsLazy("getMessageByReference");

an example messageReference is

{type: 0, channel_id: '1032770730703716362', message_id: '1276689815106093076', guild_id: '1015060230222131221'}
dull magnet
#

msg, chan, guild

#

id

cedar olive
#

is the replied message always loaded?

cedar marsh
#

I have no idea

#

I just found getMessageByReference by looking at how discord got replied message

cedar olive
#

where do you patch this

cedar marsh
#

src\plugins\noBlockedMessages\index.ts

#

I don't understand the question I think

cedar olive
#

the place in the ui

#

where does it target

cedar marsh
#

the li containing each message

cedar olive
#

screenshot blobwob

cedar marsh
cedar olive
#

hmm

#

so the replied message might not be cached

#

you will need to handle that

cedar marsh
#

I have no idea how to test that

#

honestly spent like an hour going through discord code finding how it turns messageReference into what is used by reply component

#

No clue what is going on most of the time

#

I don't know how caches work in this app

cedar olive
#

you could have done a simple MessageStore.getMessage

cedar marsh
#

like

const replyMessage = MessageStore.getMessage(messageReference.channel_id, messageReference.message_id);
#

oki that works

#

how does MessageStore.getMessage handle uncached messages? @cedar olive

#

also I don't have any useEffect to make sure this runs once per message

#

so this is probably rerunning every time react decides to shit all over the dom

#

I have literally no idea how I would add a useEffect to minified react code

cedar olive
#

it doesnt fetch them

#

MessageStore is the cache

cedar marsh
#

Ig my code does handle that though

#
-    isBlocked(message: Message) {
+    isBlocked(message: Message | undefined) {
+        if (!message) return false;
swift spear
flint bronze
flint bronze
cedar olive
#

do more new lines 😭

flint bronze
#

i know blobcatcozy

cedar olive
#

also

#

you have no flux listeners

#

I don't think useStateFromStores is gonna ever update

#

unless this is what you want

flint bronze
#

it is

cedar olive
#

I dont think you need to use a store but howitis_shrug

flint bronze
#

but also I hate spamming useSyncExternalStore everywhere

#

feels wrong

#

i do not want to do the API call from a component itself btw

cedar olive
flint bronze
#

very unholy hack for building your own hook

cedar olive
#

also isn't there a store for audit logs you can just use to make the reason?

flint bronze
#

not really

#

last time I looked at audit log shit i got scared away from finishing my plugin idea by it all

cedar olive
#

xd

flint bronze
# flint bronze not really

"not really" meaning "there is, but it's super cursed, designed for a totally different purpose, and has a horrible api I don't even understand how it works or why it was made that way"

#

time to Add Comments

cedar olive
#

add new lines blobwob

flint bronze
#

yes that too

ripe smelt
#

Does anyone know how to get offshore cat (using Chibisafe) to work with an account API key that is given in its ShareX config? It works fine without the key. Not sure if I'm inserting the header wrong, but headers work fine for other file uploading services when I structure them like this. (for context if its not obvious enough, I'm trying to make file uploading to offshore cat possible via plugin)
-# And yes I know I included my API key in the code below but its for a dump account I made for testing and I can reset the API key.
Code

async function uploadOffShore(file: File, channelId: string) {
    const url = "https://files.offshore.cat/api/upload";

    const headers = {
        "x-api-key": ""
    };

    try {
        const formData = new FormData();
        formData.append("file[]", file);

        const uploadResponse = await fetch(url, {
            method: "POST",
            headers: headers,
            body: formData
        });

        if (!uploadResponse.ok) {
            throw new Error(`Upload failed: ${uploadResponse.status}`);
        }

        const uploadResult = await uploadResponse.json();

        if (uploadResult.url) {
            setTimeout(() => insertTextIntoChatInputBox(`${uploadResult.url}`), 10);
            UploadManager.clearAll(channelId, DraftType.SlashCommand);
        } else {
            throw new Error("Upload successful, but URL not found in response");
        }
    } catch (error) {
        console.error("Error uploading file:", error);
        sendBotMessage(channelId, { content: "Error uploading file. Check the console for more info." });
        UploadManager.clearAll(channelId, DraftType.SlashCommand);
    }
}
#

ShareX Config:

{
        "Name": "chibisafe",
        "DestinationType": "ImageUploader, FileUploader",
        "RequestType": "POST",
        "RequestURL": "https://files.offshore.cat/api/upload",
        "FileFormName": "file[]",
        "Headers": {
            "x-api-key": ""
        },
        "ResponseType": "Text",
        "URL": "$json:url$",
        "ThumbnailURL": "$json:thumb$"
    }```
flint bronze
#

I don't know but I hope that isnt your actual API key

ripe smelt
#

nah its a dump account for testing

dull magnet
#

you need to share more info like what exactly doesnt work

#

we cant read ur mind

ripe smelt
#

it just fails to upload with the API key

#

Cannot parse Access-Control-Allow-Headers response header field in preflight response.

#

removing the api key from headers makes it work just fine

dull magnet
#

then the api doesn't support cors properly

#

complain to them or use native file

#

or dont use api key

ripe smelt
#

gotta love cors blobhuskcozy

#

thanks

green vessel
#

#🪅-progaming message
cross posting here, was able to optimize out the dependency on virtual-merge in fakeProfileThemes

#

virtual merge isn't needed since the changes don't actually need to be reflected onto the user object

bronze python
#

I'm making a plugin that changes the behaivour of pressing the esc key in settings to the same of pressing the close button. I got to this which works but i feel like it's a horrible way of doing it, is there a way to more directly call the function that gets executed when you press the button?

document.querySelectorAll('div[class^=\"closeButton\"]')[0].click()
rocky falcon
#

😭

boreal vessel
bronze python
dull magnet
#

i'm so confused, do you mean this

#

thats already ESC

bronze python
#

ESC ignores unsaved changes

dull magnet
#

use react devtools to inspect the close button and see what its onClick is

tropic ice
#

How long does it take pull requests to be reviewed usually?
It's been a little while (about a week. although I thought it was longer) since I made the pr, and there haven't been any reviews yet
https://github.com/Vendicated/Vencord/pull/2790

GitHub

Adds a button to copy the contents of a text file (even if the text isn't in the tiny preview).
After clicking, the copy icon will turn into a checkmark (like in large codeblocks), and the ...

hushed loom
tropic ice
#

poggers
new plugin: CopyFileContents coming in 2030!

honest stump
#

unless im tripping

vast karma
#

I guess this is about attached files, not code blocks. Does shiki affect those?

cedar olive
#

if you click copy it only does that part which shows

north flame
#

W

boreal vessel
#

how can I check if the user has nitro (or more specifically their message sending length limit, but I'm pretty sure checking nitro is the only way to check that)

balmy sky
#

look at the message length counter thing

boreal vessel
#

thats like

#

a bad idea

#

bc it only appears if you have enough message length in the box to make it show up

rocky falcon
#

would badges work?

boreal vessel
#

if i could get the user obj yeah

#

its just for the local user btw

rocky falcon
#

so UserStore.currentuser or whatever

iron epoch
boreal vessel
#

act premium type

#

would be the thing id want to check

#

done

#

UserStore.getCurrentUser().premiumType

#

0: none
1: classic
2: premium
3: basic

#

those are the types for future refrence btw

vast karma
swift delta
#

i feel like this is for a CharCounter plugin

hushed loom
swift delta
hushed loom
swift delta
tough otter
#

Is there a way I can open links in my discord itself (vencord)?
I've seen in vesktop thats possible even though its in beta phase. I don't wanna install vesktop because it has a rpc bug for me.

balmy sky
boreal vessel
#

this was already resolved?

cedar olive
#

what

rocky falcon
boreal vessel
boreal vessel
#

@swift delta i sent that bc it just didnt make sense why you said it

swift delta
boreal vessel
#

k

balmy sky
#

Probably esaier to use css

swift delta
tough otter
#

Hello, is there a plugin/way to disable pings/red dot/sound from a specific server?
I know muting a server is an option but that still shows the rec icon. I don't want that to be shown either.

#

And if possible, if we can specifically supress a specific ping of @role or from a @member.

dull magnet
#

use css to hide the red dot

tough otter
hushed loom
tough otter
#

I see, thanks!

hushed loom
#

how would you disable a plugin

rocky falcon
#

oh

#

like, in another plugin?

hushed loom
#

yea

rocky falcon
#

Settings.plugins[name].enabled = false
i think

#

theres probably more logic based on patches but that should work if im not going crazy

vast karma
#

Wouldn't that not run the stop function?

rocky falcon
#
 function toggleEnabled() {
        const wasEnabled = isEnabled();

        // If we're enabling a plugin, make sure all deps are enabled recursively.
        if (!wasEnabled) {
            const { restartNeeded, failures } = startDependenciesRecursive(plugin);
            if (failures.length) {
                logger.error(`Failed to start dependencies for ${plugin.name}: ${failures.join(", ")}`);
                showNotice("Failed to start dependencies: " + failures.join(", "), "Close", () => null);
                return;
            } else if (restartNeeded) {
                // If any dependencies have patches, don't start the plugin yet.
                settings.enabled = true;
                onRestartNeeded(plugin.name);
                return;
            }
        }

        // if the plugin has patches, dont use stopPlugin/startPlugin. Wait for restart to apply changes.
        if (plugin.patches?.length) {
            settings.enabled = !wasEnabled;
            onRestartNeeded(plugin.name);
            return;
        }

        // If the plugin is enabled, but hasn't been started, then we can just toggle it off.
        if (wasEnabled && !plugin.started) {
            settings.enabled = !wasEnabled;
            return;
        }

        const result = wasEnabled ? stopPlugin(plugin) : startPlugin(plugin);

        if (!result) {
            settings.enabled = false;

            const msg = `Error while ${wasEnabled ? "stopping" : "starting"} plugin ${plugin.name}`;
            logger.error(msg);
            showErrorToast(msg);
            return;
        }

        settings.enabled = !wasEnabled;
    }
#

thats the whole thing

hushed loom
unkempt kindle
#

is there no component or api thing that lets me add something like the (edited) text next to messages?

#

the closest thing i could find is a message accessory which adds text below

vast karma
#

If there's no api, just patch it

unkempt kindle
#

that's the part im still not really good at, but thanks

green vessel
#

Not really big support, but wanted to find where i can just ask or get documents if vencord plugins are able to run external files

i tried to search and dint found anything, and i saw that on this server you dont provide support about it, just wanted to know if it was possible, otherwise
if you cant answer, is there somewhere i can ask on the server on an other server, i dont want to break the rules of the server or smth...

empty sundial
#

achieved via native modules, which run in a separate process using node

green vessel
#

using nodejs to start python code

#

ironical but ye..

#

ill try make this, any good repo for base plugin code?

#

i found one, but just want to know if y'all have good examples too

#

for the future

unkempt kindle
green vessel
#

thats nice

#

ill check this

#

thanks for the info

unkempt kindle
green vessel
#

is it good?

empty sundial
#

What are you planning on doing

empty sundial
green vessel
rocky falcon
green vessel
#

its discord legal, and its just discord user agent apps

green vessel
unkempt kindle
#

you basically want an in-app button to start up your bot?

green vessel
#

exactly

#

it can be a command or a button

#

button would be fun.

unkempt kindle
#

best option would probably be to just run a file
but you can also spin up an http server when your computer startsup and that server will startup the bot when you make a request

#

the first option is better though

green vessel
#

i made a script on my desktop to auto start it

#

i just want to add it to my discord, if possible, why not?

empty sundial
#

Very interesting

green vessel
#

summer here is hard for my room

#

i have many things running in the room

#

(BIG)Projector, computer, homeserver, screens, ac , 3 ups , xbox 1, 4 monitors, a soundsystem (home theater) with subwoofer a ps3, a ethernet switch a hdd dock and a powebard for charging our phones and testing computers i repair

#

aint it contradictory?

#
X [ERROR] [plugin ban-imports] Cannot import node inbuilt modules in browser code. You need to use a native.ts file

    src/plugins/KeparAssistantExtras/native.ts:1:21:
      1import { exec } from "child_process";
        ╵                      ~~~~~~~~~~~~~~~```
empty sundial
#

full code?

vast karma
#

Might have to do with how you're accessing the native.ts

#

If you're (erroneously) importing it I can imagine it'd give errors like that

empty sundial
#

yep thats what i was thinking too

#

didnt want to jump the gun though

dull magnet
green vessel
empty sundial
# green vessel

check out another plugin that uses native to see how it works, you do not require native from your index.ts/x

#

i.e. openinapp

green vessel
#

otherwise:

import { ApplicationCommandInputType, sendBotMessage } from "@api/Commands";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";

export default definePlugin({
    name: "AssistantStarter",
    description: "Command to start the assistant batch file",
    authors: [Devs.Arjix],
    dependencies: ["CommandsAPI"],
    commands: [
        {
            name: "startassistant",
            description: "Starts the assistant by running a batch file",
            inputType: ApplicationCommandInputType.BOT,
            execute: async (opts, ctx) => {
                if (typeof window !== 'undefined') {
                    sendBotMessage(ctx.channel.id, { content: "This command can only be run in a Node.js environment." });
                    return;
                }

                try {
                    // Use require instead of import, which only gets evaluated in Node.js environment
                    const { exec } = require("child_process");
                    
                    exec('C:\\Users\\Kepar\\OneDrive\\Bureau\\Start Kepar Assistant.bat', (error, stdout, stderr) => {
                        if (error) {
                            sendBotMessage(ctx.channel.id, { content: `Error starting assistant: ${error.message}` });
                            return;
                        }
                        if (stderr) {
                            sendBotMessage(ctx.channel.id, { content: `Assistant started with warnings: ${stderr}` });
                            return;
                        }
                        sendBotMessage(ctx.channel.id, { content: `Assistant started successfully:\n${stdout}` });
                    });
                } catch (error) {
                    sendBotMessage(ctx.channel.id, { content: `Error: ${error.message}` });
                }
            },
        },
    ]
});

F:\DEV\Vencord>pnpm build

> vencord@1.9.8 build F:\DEV\Vencord
> node --require=./scripts/suppressExperimentalWarnings.js scripts/build/build.mjs


  dist\preload.js      2.3kb
  dist\preload.js.map  9.3kb

Done in 23ms

  dist\vencordDesktopPreload.js      2.2kb
  dist\vencordDesktopPreload.js.map  9.2kb

Done in 37ms
X [ERROR]
   dist\patcher.js[plugin ban-imports]             40.0kb
  Cannot import node inbuilt modules in browser code. You need to use a native.ts file

    src/plugins/KeparAssistantExtras/index.ts:23:45:
      23 │                     const { exec } = require("child_process");
         ╵                                              dist\~~~~~~~~~~~~~~~patcher.js.LEGAL.txt    964b


dist\X [patcher.js.map
  ERROR]215.4kb

Done in 212msdist\vencordDesktopMain.js
 35.2kb
  [plugin ban-imports]dist\ vencordDesktopMain.js.LEGAL.txtCannot import node inbuilt modules in browser code. You need to use a native.ts file

    src/plugins/KeparAssistantExtras/index.ts:23:45:
964b       23 │                     const { exec } = require(
  "child_process"dist\);
         ╵                                              ~~~~~~~~~~~~~~~vencordDesktopMain.js.map

        197.1kb

Done in 299ms
1 error
Build failed
Build failed with 1 error:
src/plugins/KeparAssistantExtras/index.ts:23:45: ERROR: [plugin: ban-imports] Cannot import node inbuilt modules in browser code. You need to use a native.ts file
1 error
 ELIFECYCLE  Command failed with exit code 1.

F:\DEV\Vencord>
empty sundial
#

anyway

#

why does the patch helper sometimes show this nice preview and other times not?

green vessel
#

huh?

empty sundial
#

not a question directed towards you

green vessel
#

oh alr

#

srry

empty sundial
#

build vencord with --dev

#

inject

#

then check vencord settings

boreal vessel
#

kk

#

does it add anything else

unkempt kindle
#

is this something i need?

const { isEnabled, showIcon } = settings.use(["isEnabled", "showIcon"]);```?
can this be replaced with ```js
settings.store.isEnabled
settings.store.showIcon```
#

and can I entirely replace settings with definePluginSettings with an options object? are they exactly the same?

hushed loom
#

are you trying to change your plugins settings?

unkempt kindle
#

yes, they are changed within the code

#
settings.store.isEnabled = !settings.store.isEnabled```
hushed loom
#

definePluginSettings returns a settings object

hushed loom
unkempt kindle
#

so that's what it does

#

thanks

#

i'll keep that then

#

im not sure what level of disgustingness an official vencord plugin can have in its source code

humble flax
#

Hey Folks Wave
Im looking to start getting into writing a Script to automaticly Convert Better Discord Plugins into Vencord plugins.
However, I cant even manage to setup my Dev Env XD
For some reason, the DevCompanien dosnt seem to work. When Starting Discord and VsCode I dont get a connection, and when I retry, (via the Vencord toolkit -> DevCompanion -> Reconnect), I get a WebSocket error in the Console:
js index.tsx:94 WebSocket connection to 'ws://localhost:8485/' failed:
Any idea why?

boreal vessel
#

nvm that was resolved mb

humble flax
#

I also tried to reinstall Discord, incase its some wierd Discord issue, but no luck :/
I also tried it on my Ubuntu-24.04 VM, but no dice there either

#

It might be a problem with my VScode, since I dont see a open port via Netstat

empty sundial
#

dev companion is helpful but not necessary by far

#

not sure how great a tool to convert betterdiscord plugins into vencord plugins is gonna be, betterdiscord plugins should be very different from vencord ones

boreal vessel
#

they are*

#

and it wouldnt work bc there are so many things youd have to translate

rocky falcon
#

use ai /j

boreal vessel
#

thats probs gonna be their plan

rocky falcon
#

😭

#

fuck off smiley bot

boreal vessel
#

who knows maybe they could use ai to write the code too!

boreal vessel
#

cuz math

rocky falcon
#

oh right, thanks

boreal vessel
#

np

rocky falcon
#

😭

#

get FUCKED

boreal vessel
#

LOL

#

w

humble flax
dull magnet
#

no

#

you can't

boreal vessel
#

oh yeah i havent ever learned this

#

vee what is your thoughts on betterdiscord

#

do u dislike it cause rivals

#

or feel bad for it cuz of how shit a platform it is

humble flax
#

Guess I'm gonnna try to convert my favortis by hand then lmao

humble flax
#

Hello, its me again
So, Im currently in the process of rewriting BetterCords "SplitLargeMessages" for Vencord, as a unofficial plugin, as its a selfbot.
For that I am using the PreSendListener to "catch" the message before its being send. However, the "Your message is longer then the allowed 2000 Chars" modal seems to still be triggered before.
Anyone got a idea why or if I can even circumvent this? (Cause I'm thinking probably not, but Im stil hopefull XD)
My Code

boreal vessel
#

i <3 bettercord

humble flax
#

Message intercepted. LOL

#

(Also it seems like the "disable" isnt implemented yet... Ups.. XD)

boreal vessel
boreal vessel
#

we dont exactly

#

allow selfbots

#

r11

humble flax
# boreal vessel ?

For testing I had the "Message intercepted" when the message wasnt over the 2k chars.
And for some reason, when I disable the plugin in the settings, it isnt actually disabled lmao

humble flax
boreal vessel
#

@dull magnet whats your thoughts on this

rocky falcon
#

solution: require multiple enter key presses

humble flax
boreal vessel
#

oh so like it sends the first 2k then the next 2k etc

#

yeah that would def work

#

if it just cuts out the first 2k letters after

#

for the 2000 characters youll need to add a patch for it @humble flax

humble flax
boreal vessel
#

pins

humble flax
#

Or is it simple regex?

#

Thx

humble flax
# boreal vessel pins

Maybe I'm blind (or more likly just stupid), but I cant find anything regarding patches in the pins here.

balmy sky
#

The plugin is entirely useless though

humble flax
# balmy sky

Fair enough XD
I reguarly send emails on Discord tho, and they tend to be longer. And in a file format theyren't searchable

#

So I can see why its not nessecary in most usecases, but for me its quite handy

boreal vessel
#

oh god

humble flax
#

Yes its quite.... Something. XD

flint bronze
#

just curious

#

why do you need to send email content inside of discord so much

humble flax
# flint bronze ...what?

Yes... I am the head my Uni's unofficial Discord server and I (manually) forward most of the emails we get, for one to archive them but secondly so that everyone gets them, even if they dont check thier mail often.

#

I know I could automate this with a bot, but I want that extra level of security, since some mails might be private...

flint bronze
#

secondly so that everyone gets them, even if they dont check thier mail often.
sounds a lot like nobody bothers to set up their email client, and that their uni email account gets spammed to death with automated junk?

humble flax
#

Jep, thats about right

flint bronze
#

95% of my non-personal account email I recieve is automated junk

humble flax
#

Like atleast 5 emails a day for some random bachelor colloquium that noone cares about lmao

flint bronze
hoary pilot
#

my email is git forges and spotify trying to sell me overpriced premium

humble flax
#

The worse thing is, the spam filter the uni uses is quite good (no "real" spam so far), rather its the Teachers spamming us XD

flint bronze
#

my email gets spammed by hoyoverse game marketing (i made the mistake called try these games)

boreal vessel
#

i unsub from any mailing list i get added too

#

this has been my email for the past week ish (the oracle thing wasnt there it was just empty)

humble flax
#

Looks like a dream!

jagged briar
flint bronze
novel canyon
#

hello silly folks, i'm invading now
anyways, i'm here to get feedback on one of these patches (specifically the first one):

        {
            find: "Messages.USER_ACTIVITY_PLAYING",
            replacement: [
                // Hide the "badge" timers that count the time since the activity starts
                {
                    match: /\(0,.{0,30}activity:(\i),className:\i\.badges.*?}\)/g,
                    replace: "($self.settings.store.hideActivityTimerBadges?null:$&),$self.getTimeBar($1)",
                },
                // Hide the large title on listening activities, to make them look more like Spotify (also visible from hovering over the large icon)
                {
                    match: /(\i).type===(\i\.\i)\.WATCHING/,
                    replace: "$1.type===$2.LISTENING||$&",
                    predicate: () => settings.store.hideActivityDetailText
                }
            ]
        }

i'm unsure if doing settings checks like this is acceptable? (or if there's a better method i'm not aware of)
i'm updating the timebarallactivities plugin to work with the new activity cards they pushed out, and i need to hide parts of the match conditionally (rather than turning off the whole match with a predicate, since having two almost identical patches felt wrong)

#

(also thanks vee for the access ^w^)

flint bronze
#

seems fine to me?

cedar olive
#

yeah it's fine

flint bronze
#

also comes with the benefit that you can toggle it at runtime trolley

novel canyon
#

alright kewl!
the runtime change doese work well too

#

discord got sneaky and left the old renderTimebar function in without ripping it out so the patches on the original plugin never failed >.>

flint bronze
#

reminder, make sure that hideActivityDetailText has restartNeeded: true

novel canyon
#

it does already have that flag right now though :>

flint bronze
#

is it used in any other predicates

novel canyon
#

these settings are only used here on those matches

#

this update is practically complete outside of moving it from the temporary userplugin i jammed it in and the questions i had on those

#

i do also have to ask what happens with the devs array if the entire plugin is replaced
do i leave the original dev there as well or just replace them? (they're no longer in the server)
i'm aware you might not be able to answer that

cedar olive
#

leave it

novel canyon
empty sundial
#

How would i get the current discod theme? as in either "light" or "dark"?

bronze dove
#
import { getTheme, Theme } from "@utils/discord";
getTheme() === Theme.Light ? "light" : "dark"
empty sundial
#

Ty!

fallen sandal
#

arent there two others + all the nitro themes

vast karma
#

What do you need to know the theme in js for

#

That oughta be all in css

empty sundial
empty sundial
fallen sandal
empty sundial
#

now all profiles look like this on my client :3

fallen sandal
#

isnt that the same as exploding nitro profiles

empty sundial
#

yah

#

thats kinda the point

empty sundial
balmy sky
#

What insane selectors are you using lmao

#

That is NOT Normal

empty sundial
#

normal ones

#

keep in mind that this plugin has many patches kinda everywhere patching out a bunch of different components

#

im at 17 patches now

boreal vessel
#

thats horrible

#

what happens in profile editor

empty sundial
boreal vessel
#

k

boreal vessel
empty sundial
#

nothing

boreal vessel
#

k

empty sundial
humble flax
#

Hey there
I'm currently trying to write a patch that is triggerd when a user is sending a message, but before any of the Discord text length checks get triggered. (I.e. "Your message is longer then the allowed 2k chars.")
This is my current patch:

patches: [
        {
            find: "onSubmit:", // Locate the module or property containing the 'onSubmit' method
            replacement: [
                {
                    // Match the original 'onSubmit' handler
                    match: /onSubmit:\s*function\(\w+\)\s*{[^}]*}/,

                    // Replace with custom handling logic
                    replace: `
                        onSubmit: function(e2) {
                            console.log("Message Splitter Plugin: Intercepted message submission");
                            const messageContent = e2.methodArguments[0].value;
                            if (messageContent.length > 2000) {
                                e2.stopOriginalMethodCall(); // Prevent the original method from executing
                                return handleLongMessage(messageContent); // Call external function to handle long messages
                            } else {
                                return e2.callOriginalMethodAfterwards(); // Call the original method if the message is within the limit
                            }
                        }
                    `,
                },
            ],
        },
    ],

The patch was inspired by BetterCords SplitLargeMessage plugin, but so far no dice. When I send any message, the "debug" console.log isnt triggerd, and I am unsure why.
Note that I am new to the whole patch system, and I am not exactly sure how to find the correct handler, as when I set a breakpoint on the "onSubmit" handler, it gets triggerd whenever I click anything inside of Discord

balmy sky
#

HORROR

#

Start by not writing your entire function in a string

hushed loom
#

replace: "$self.myFunc(arguments)"

rocky falcon
#

lol

hushed loom
#

myFunc(args) {
return;
}

humble flax
# balmy sky Start by not writing your entire function in a string

Yeah, right now its not the cleanest, but the more complicated functino (i.e. handleLongMessage), is already seperate. I tried to have as much as possible in the replace as, in my mind, it gets "injected" directly in the already existing JS. But it will get fixxed later ™️

balmy sky
#

A wise person once said "if your patch code is multi line it probably shouldn't be in the patch"

humble flax
hushed loom
#

write your own code there

humble flax
#

Ah, as I said. I'm new with the whole patching, and the docs (apart from the pins here) arnt mentioning any patches. (There is a pull request right now, but it hasnt been merged yet)

humble flax
rocky falcon
#

what?

dull magnet
#

ai can't write vencord plugins

rocky falcon
hushed loom
#
export const definePlugin({
patches: [
{
  find: "myFind",
replacement: {
    match: /myMatch/,
    replace: "$self.myFunc"
}
}
],
myFunc(args) {
return;
}
}
);
humble flax
# dull magnet did you use ai

I used ai to explain some patches I found (i.e. MessageTags plugin and the mentioned BetterCOrd plugin), but not to write the regex itself

hushed loom
#

(ignore terrible formatting)

rocky falcon
#

also, fix the find

hushed loom
humble flax
# rocky falcon also, fix the find

I tried several finds, but so far was unlucky.
I already looked via the React Componets inspector, but as I said, when I set a breakpoint on the onSubmit handler, it triggers on every interaction with DC.

humble flax
#

So I tried to be a smart ass, and failed XD
While digging around, i found this function:

function o() {
                return (0,
                r.e7)([i.default], ()=>a.ZP.canUseIncreasedMessageLength(i.default.getCurrentUser())) ? s.en1 : s.J6R
            }

I tried to be a big brain, and just patch the a.ZP.canUseIncreasedMessageLength(i.default.getCurrentUser()) to true.
Like so:

find: "a.ZP.canUseIncreasedMessageLength",
            replacement: {
                match: /a\.ZP\.canUseIncreasedMessageLength\(i\.default\.getCurrentUser\(\)\)/g,
                replace: "true"

            }

And, when I wrongly match the canUseIncreasedMessage[...], so it crashes DC I can see the patched Webpack in Vencords folder. But when I correctly match it, it just gets overwritten.
Is there a safety feature from Discord (or even Vencord) that I'm missing? (Propably Sentry imo)

#

(Also its a great way to let DC freeze up constantly lmao)

boreal vessel
#

this will break when discord updates

#

use \i\.\i\i\.canUseIncreasedMessageLength instead of a\.ZP\.canUseIncreasedMessageLength and \i.\i\i.canUseIncreasedMessageLength instead of a.ZP.canUseIncreasedMessageLength

balmy sky
humble flax
#

But maybe im looking in the wrong place?

humble flax
# balmy sky Or just patch canUseIncreasedMessageLength

So I picked up your idea again, cause I noticed that when i tried, i didnt have mnpm build --watch running 🙃 ...
I have the following patch (I know it might not work for future updates, but for now I just want it to work for now and fix it later ™️)

{
            find: /canUseIncreasedMessageLength:function\([^)]*\){[^}]*}/,
            replacement: {
                match: /return\(0[^)]+\)\([^,],[^)]+\)/,
                replace: "return (true);console.log(here);",
            }
        }

But when I try to run the plugin I get a:

Patch by Message Splitter Plugin errored (Module id is 74538): /return\s*\(\s*0\s*,\s*[^)]+\)\(\s*[^,]+\s*,\s*[^)]+\)/s
 SyntaxError: Unexpected token ')" error

I tried putting the match function in double quotes (I know that wont work, but I was desperate 🤣 ), but then I get a:

Patch by Message Splitter Plugin had no effect (Module id is 74538): /returns*(s*0s*,s*[^)]+)(s*[^,]+s*,s*[^)]+)/

Does that simply meant that its not possible to patch the function, or am I missing something obvious (again...)

vast karma
#

Delete all those \s*

humble flax
#

Also, if it was successful, where would I see it? Cause so far, whenever I return to my breakpoints, the code is the same

vast karma
#

They make it unreadable

humble flax
vast karma
#

Check with patch helper that it patches what you expect it to

humble flax
vast karma
#

Looks like ```js
{let r=ef(e,t,n);return (0,L.og)(r,e.interval,e.intervalCount)}
{let r=ef(e,t,n);return (true);console.log(here);}

#

Other than the console.log never being reachable that looks correct

#

Does compile button say ok?

humble flax
humble flax
#

I propbaly need to refine the find part

bronze dove
#

find is supposed to find the module not the function

humble flax
#

Ah, I see. That makes more sense..
So in my case it should be find: WebpackModule74538? Cause that feels wrong

bronze dove
#

no remove the regex from the find

vast karma
#
find: "canUseIncreasedMessageLength:function",
replacement: {
  match: /(?<=canUseIncreasedMessageLength:)(?=function)/,
  replace: "(()=>true)??"
}
humble flax
#

Ah, okay got you.
Thx

#

Okay, that seems to work a lot better. Thanks!
However, I still get the

Patch by Settings had no effect (Module id is 394644): /({(?=.+?function ([A-Za-z_$][\w$]*).{0,120}([A-Za-z_$][\w$]*)=[A-Za-z_$][\w$]*\.useMemo.{0,30}return [A-Za-z_$][\w$]*\.useMemo\(\(\)=>[A-Za-z_$][\w$]*\(\3).+?function\(\){return )\2(?=})/

error.
Which seems wierd since there is regex mentined that is not inside of the match. (Again, I am very new to patches, so please bear with me.)

vast karma
#

That regex is a monster

#

Wait are failed matches printed with \i expanded?

vast karma
#

I wouldn't know, I don't write failing patches

empty sundial
#

wtf

bronze dove
humble flax
#

Oh

#

true

#

my bad
I was so focused on looking for errors, i didnt look for what the cause was 🤣

vast karma
humble flax
humble tulip
humble flax
vast karma
#

Well yeah

#

Removing the clientside restriction doesn't change the server

cedar olive
humble flax
# vast karma Well yeah

True.
Maybe staying up for 48 hrs to throug this "quick" ™️ plugin together wasnt the smartes idea XD

vast karma
#

Admirable, but inadvisable

humble tulip
#

Just one more reload

empty sundial
#

sorry but ive never seen someone write throw so wrong before

humble flax
#

Atleast now I know how to look for the right hooks, and how to properly write a patch, so theres that.

cedar olive
#

I mean in the console log yes it's easy but it would just be replacing the expanded version to the old

vast karma
#

Just monkeypatch .toString() on the expanded regex 🤣

cedar olive
tough otter
#

Is there a way I can open links in my discord itself (vencord)?
I've seen in vesktop thats possible even though its in beta phase. I don't wanna install vesktop because it has a rpc bug for me.

boreal vessel
empty sundial
#

this isnt support guys !

tough otter
boreal vessel
#

...

tropic ice
#

change it to discord://-/channels/1015060230222131221/1032770730703716362/1279160927341645844

tough otter
#

I guess you didn't understand what I meant, try using vesktop once.

tropic ice
#

huh

tough otter
tropic ice
#

so like https://google.com opens in discord?

tough otter
tough otter
tropic ice
#

oh weird

humble tulip
#

Would it not be easier to try and fix the RPC bug stopping you from using vesktop?

tough otter
humble tulip
#

I see

tropic ice
#

Is there something I need to do to fix this?

north flame
#

Rub Roy

#

Ruh roh*

azure fossil
#

is there an easy way to see if some CSS selector match anything unwanted in discord without running the command constantly ?
like for now what i do is this and navigate around discord

let intervalId = setInterval(() => {console.log(document.querySelectorAll(':has(> [class^=collapseButton])'));}, 1000);

obv i change my css selector

vast karma
#

Just set a background: red !important; on it

azure fossil
azure fossil
#

i enabled it if you're fine with the space it takes
i disable it usually cause i find them unecessarily too big
feel free to delete this message

swift delta
azure fossil
#

thanks XD

tough otter
#

Is there a plugin to fix channelids?
Example #1032770730703716362 changes to #🧩-plugin-development aka [#🧩-plugin-development](/guild/1015060230222131221/channel/1032770730703716362/)

flint bronze
#

It's called TextReplace, and is typing the <> that hard?

tough otter
dull magnet
#

this is the second time you're posting support questions here...

flint bronze
#

guh i should've redirected to support initially blobhuskcozy

hushed loom
hoary pilot
#

is there a sane way to make submenus, considering this is my current code

<Menu.MenuGroup label="Commands">
                {SelectedGuildStore.getGuildId() === GUILD_ID &&
                    <>
                        <Menu.MenuItem
                            id="mute-1h"
                            color="#ff0000"
                            label="Mute for 1 hour"
                            action={() => {
                                showPrefefinedDurationModal("1h", user.id);
                            }}
                            icon={SafetyIcon}
                        />
                        // ...
                }
</Menu.MenuGroup>
#

so it would be in commands -> then my options

flint bronze
#

@hoary pilot it's literally just children of MenuItem to make a submenu

hoary pilot
#

insane

flint bronze
#

change your MenuGroup to a MenuItem and give it an id

hoary pilot
#

my little baby...

#

insane

flint bronze
#

WHY DONT YOU USE STATUS VARIABLE

#

STOP HARDCODING 😭

rocky falcon
hoary pilot
# flint bronze WHY DONT YOU USE STATUS VARIABLE
#user-context-vc-staff--mute-1h[class*="focused"] {
    background-color: var(--menu-item-danger-hover-bg);
    color: white;
}

#user-context-vc-staff--mute-2h {
    color: var(--status-danger);
}

#user-context-vc-staff--mute-2h[class*="focused"] {
    background-color: var(--menu-item-danger-hover-bg);
    color: white;
}

#user-context-vc-staff--mute-custom {
    color: var(--status-danger);
}

#user-context-vc-staff--mute-custom[class*="focused"] {
    background-color: var(--menu-item-danger-hover-bg);
    color: white;
}

you love

flint bronze
#

hope is lost

#

or is it

unkempt dove
#

is there an easy function to check if a user is able to see a channel (or better, get a list of users who can see a channel)

balmy sky
#

What's the best way to update a component when something changes in plugin settings? (via direct value changing, not ui)

balmy sky
hushed loom
#

what?

hushed loom
#

not useSettings

fiery granite
#

Hello 🙂
Where can i get the "notify" thing like "Script Activated" and the button Okay in blue ?

rose fiber
#

look at other plugins with that

fiery granite
proud parrotBOT
vast karma
#

Did you see the links in the message you literally replied to

fiery granite
#

i just don't understand this code

vast karma
#

Then the answer to "are there examples" should be obvious

rose fiber
fiery granite
fiery granite
rose fiber
#

look at the structure of the modal there, how to open it and then just look at how it works, experiment with it a bit, and when you get a problem doing that, ask for help again

fiery granite
rose fiber
#

second link

fiery granite
#

i just see how he is formated

rose fiber
rocky falcon
#

time ta go through every single thing marked as too niche in #🗳-plugin-requests and put them all in one plugin /hj

#

i wonder how that would even work

#

theres probably some things that mesh together

cedar olive
#

not modals

#

look at FakeNitro code and how it creates alerts

rose fiber
#

oh

dull magnet
#

directing people to fakenitro code

#

death sentence

humble tulip
#

I made a plugin to display embeds on a message where the sender surrounded the link in < >
I dunno if it'd be allowed though since getting the embed data is an api request so I don't know if it falls under self bot stuff, although I don't think it constitutes api abuse at all suffoPeepoShrug

#

Also might confuse people that would (understandably) think this is what the current UnsuppressEmbeds plugin does

hushed loom
humble tulip
#

It lets you undo this moderator action

#

But that's just if you already suppressed embeds on a message that had them

hushed loom
#

terrible name

hushed loom
humble tulip
#

That's cool, conveniently the endpoint takes an array of urls too so even if there's multiple in the message it's still one request

dull magnet
humble tulip
#

I think it's less that UnsuppressEmbeds is a bad name and more that there's no good name for whatever <this> is

#

Besides also suppressing embeds

rocky falcon
#

show hidden embeds

humble tulip
#

Perfect

swift delta
rocky falcon
swift delta
#

no spaces in names is better

#

ong

#

don’t caps the s either

#

blocking would go crazy rn

rocky falcon
hoary pilot
vast karma
#

ShOwHiDdEnEmBeDs 🧽

rocky falcon
#

👀🙈Embeds

swift spear
flint bronze
#

also can you send a link to the code?

humble tulip
humble tulip
#

I changed it to not just be <links> but any link that doesn't have a matching embed on the message, so you can use it to retry failed embeds (looking at Spotify smh) or in a channel where the person didn't have embed perms

#

And put the button in the context menu for each link rather than on the message popover

empty sundial
#

How would i debug native functions? Apparently something is erroring and im not sure what exactly

dull magnet
#

run discord from terminal

empty sundial
#

oh.. okay yeah that makes a lot of sense

#

thanks!

quaint cipher
#

can a patch predicate depend on other plugin being enabled?

patches: [
  {
    find: "this.isCopiedStreakGodlike",
    replacement: {
        match: /VencordOriginal:(\i),/,
        replace: "VencordOriginal:$self.wrap($1),"
    },
    predicate: () => isPluginEnabled("SpotifyControls")
  },
],

my current attempt however i dont think it likes calling isPluginEnabled there

#

ah well i figured it out

predicate: () => Settings.plugins.SpotifyControls.enabled
fallen sandal
amber basin
#

use Vencord.plugins.isPluginEnabled global

#

or you will get circular import

novel canyon
#

heyooo, wondering if anyone knows how to forcibly update the server list/guilds bar from a plugin
adding pinning pindms categories to the server list, and i need to trigger it to rerender somehow, otherwise it only updates when the selected channel changes

#

i am seeing that the array i'm screwing with comes from the PrivateChannelReadStateStore, so if there's a way to force a refresh on that it'd probably do it

novel canyon
#

scratch that, found out i can emitChange() on the store to trigger it :3

empty sundial
#

Can i somehow send IPC Events from native and react to them in the frontend? Im running a couple of system commands in native and id love to have an info label so the user knows what exactly is going on and isnt confused by "nothing happening"

flint bronze
empty sundial
flint bronze
#

as in, for react components

#

its just a thing to easily make a react hook without a full store, idk how much other people recommend it

#

regarding getting data back to renderer, the first argument in native should be a webcontents iirc

#

hm

#

theres a plugin ipc thing

#

i've never actually used that

#

idk what i'm saying right now

#

someone probably said to use executejavascript on the webcontents to send stuff back async

#

at one point

#

i cant remember

humble tulip
#

Would this be a reasonable way to allow masked link pasting if shift is held or is there something I don't know about that would make this dumb for whatever reason?

#

It works fine but you never know

empty sundial
#

i wouldnt put it on the window

#

make it a property of the plugin object, in the replace you can then just do $self.shiftKeyDown

humble tulip
#

Oh yeah, good point

#

Thanks

vast karma
#

But ctrl-shift-v is a completely different key shortcut, isn't it?

humble tulip
#

This is just proof of concept

#

A friend asked for the functionality

humble tulip
# vast karma But ctrl-shift-v is a completely different key shortcut, isn't it?

Looking into it more it doesn't feel feasible to use anything but shift because this isn't a paste hotkey I'm registering, just a modifier to check when discord is determining whether to mask the paste
Ctrl+shift+v is just paste as plaintext which doesn't make a difference in discord as far as I know anyway and this also works for shift clicking the paste context menu button

#

Otherwise I think I'd have to be pasting the text and doing the masking manually or something and I don't think that's feasible

#

But I could be thinking about it wrong

humble tulip
#

It doesn't matter much because I doubt this is going anywhere but preference?

humble tulip
flint bronze
#

?remindme 5pm take a look at this plugin

fathom pivotBOT
#

Alright @flint bronze, in 3 hours, 36 minutes and 29 seconds: take a look at this plugin

fathom pivotBOT
#

@flint bronze, <t:1725585811:R>: take a look at this plugin

cedar olive
#

take a look at this plugin

hushed loom
#

take a look at this plugin

steady knot
azure fossil
steady knot
#

yeah my textreplace is bad

fathom pivotBOT
#

@flint bronze, <t:1725598978:R>: take a look at this plugin

quaint cipher
#

is this an OK way to get a module's ID from a findByProps call idk if this is dumb

let results = Vencord.Webpack.search(findByProps("InboxIcon").InboxIcon.toString())
let [id, moduleContent] = Object.entries(results)[0]
cedar olive
#

use waitFor

#

one of the callback parameters should be the id iirc

muted ibex
#

I'm looking at Vencord Docs for info on how to create plugins, but I can't find anything on how to reverse engineer Discord/use APIs and stuff to actually do something.

#

Does anyone have any idea where to get started?

cedar olive
#

lets start by asking what do you want to do

cedar olive
#

I've only had one time I needed the id and it was for a very tricky case

quaint cipher
# cedar olive may I ask what do you need the id for, I wanna know your use case

I'm testing stuff with finding what other modules a module requires


function findDependents(moduleID) {
    let match = Vencord.Util.canonicalizeMatch(RegExp(`(\\i)=n\\(${moduleID}\\)`));
    return Object.entries(Vencord.Webpack.wreq.m).filter(([moduleID, module]) => module.toString().match(match));
}

I could not access the full module content with the findByProps i need to use wreq.m[moduleId] for it
srry for shit wording im tired rn

cedar olive
#

ah, I see

vast karma
#

Remember that require() might not be called n, and other functions might be

cedar olive
quaint cipher
#

damn thanks

cedar olive
#

no need to escape the escape haha

vast karma
#

Escape the haha

cedar olive
#

😭

humble tulip
cedar olive
#

haha thats so cool

balmy sky
#

+908312908321 if it's automatic

#

(with an embed count limit)

swift delta
humble tulip
#

It gets rate limited quite quickly anyway

cedar olive
#

is it unfurl endpoint

humble tulip
#

Yeah

muted ibex
#

Thing is I don't really know.

#

When learning something new about coding, I first want to look at the big picture, get an idea of how to get the most basic things done, and only then do I think of what I could do with that knowledge.

#

For Vencord, I have some vague ideas of things I'd want, but nothing clear.

hushed loom
#

im prob stupid, but can vesktop use native plugins

dull magnet
#

ofc

humble tulip
#

100%

#

At the moment is also has options to swap out twitter embeds for vxtwitter, instagram -> ddinstagram etc but I'll remove that if I ever PR it or anything since those domains could end up becoming anything in future

flint bronze
humble tulip
#

I did think about letting people define their own replacements but I didn't know if it was overcomplicating things

hushed loom
#

how do you find out where a modal was opened from

#

been trying to find with devtools for ~30 mins but havent had any luck

amber basin
#

you could always breakpoint the open function

#

but id go the trusty way of looking for i18n strings and seeing where they are used

hushed loom
#

always forget about that

hushed loom
inner pawn
#

I found:

Vencord.Webpack.findStoreLazy("StickersStore")

Is there a better function I can be using for a js snippet for access to stickersstore ?

#

And I would need an override to make a button like that right ?

#

Obviously not with the weird group dm mspaint text

#

After clicking on that i could do something similar to the layout of friends

hushed loom
#

is this a known discord type?