#🧩-plugin-development

1 messages · Page 52 of 1

north moss
#

Makes sense why it runs the way it does

#

An abstraction on an already abstract language lol

flint bronze
#

It's still decently usable.....

balmy sky
#

We are so fucking back

#

Pr time ratspin

flint bronze
#

yeah

north moss
#

Through the chrome dev tools? I'm assuming theres different ones for the react stuff

flint bronze
#

If you're using Vesktop the React DevTools should be preinstalled

north moss
#

Should I use that one instead?

flint bronze
#

Vesktop is much easier to use for Vencord dev

north moss
#

Ohhh ok

flint bronze
#

you only need to change the dist dir in settings once then pnpm watch in the project dir then reload to reload your changes

#

instead of build/watch, inject then restart the whole client

north moss
#

Nice!

#

I just saw there's a portable version, that's cool as hell

flint bronze
#

also it actually supports screensharing on linux with sound, something discord never did themselves

north moss
#

That's really cool

balmy sky
flint bronze
#

show me

balmy sky
flint bronze
#

is this your own fork

balmy sky
#

Yeah i made my own version

flint bronze
#

you should contribute it to upstream and make it replace the updater menu

#

maybe

#

idk

balmy sky
#

Eh

#

Idk

flint bronze
balmy sky
#

That is NOT an open color github what the fuck

#

🛑🛑 OPEN 🛑🛑

simple folio
#

its supposed to be green

balmy sky
#

Yeah idk why

#

It's weird

#

I can't tell if this is cursed or fine

simple folio
#

its probably just the theme you're using but that dropdown doesn't have any depth

balmy sky
#

Yeah that's just my theme lmao

#

It's really fucked up sometimes bruh

north moss
#

Is it because it's pre-embedded into the program?

flint bronze
north moss
flint bronze
#

nop

#

vesktop best for all parts of plugin dev

#

this is what you want to change

north moss
north moss
flint bronze
#

you should not be pointing your dist at your injected vencord

#

point vesktop at the dist generated in your Vencord git repository

balmy sky
#

I've been on vencord all this time 💀

#

Amazing

flint bronze
#

i said that wrong didnt i

#

i think the way I am doing it is right (PLEASE correct me if there is a more formal way of doing it)

balmy sky
#

I have no idea lmao

#

I don't use vesktop much

#

I miss my precious keybinds 💔

north moss
#

@flint bronze Sorry if my questions seem naive, it's because I am not a super experienced developer, and this is the first time I've worked on a large collaborated project

#

I've figured a decent amount myself so far so I don't put the burdens of my inexperience on you guys

balmy sky
#

You're fine

north moss
#

Ty !

balmy sky
#

As long as it's not in support and you're not having problems with actually installing the dev build then ur good silicat

north moss
#

Haha yeah

#

Just figuring out how to log to the console was quite exciting lol

#

Can someone send me a screenshot of where the react tools are?

balmy sky
#

Components

#

You may have to enable it somewhere i forgor

north moss
#

Haha wait nvm

north moss
#

I couldn't see them, but I found the toggle just after I asked

flint bronze
north moss
flint bronze
north moss
#

Haha yeahh

flint bronze
#

it's a bit hard to explain but it's a lot of ctrl+shift+f in sources and look for keywords

north moss
#

I'm just trying to make sense of what I'm seeing

#

I'm learning react as we speak lol

flint bronze
#

you might want to look at the parent elements of whatever you've selected

flint bronze
north moss
#

Lol

#

This is great

#

I might need vodka to figure this out

flint bronze
#

are you sure drunk coding will be easier

#

i highly doubt it

balmy sky
#

We are so back

#

I took like 30 minutes to port it from using settings to store the sticker ids, to datastore

north moss
flint bronze
#

dont worry

north moss
#

Omg I just found out how to find the react source

#

1 step closer

#

Now, I have to read it

balmy sky
#

Why the fuck did i burst out laughing from this 💀

balmy sky
#

HOW DOES A BUG LIKE THSI EVEN HAPPEN

flint bronze
#

Probably react's pre-emptive stufff

balmy sky
#

Yeah

#

I'm having issues with force re rendering the component

#

Since if you unblock a sticker, it won't disappear til you reload

#

So it's really weird

#

Guh yeah i have no idea how to do this

flint bronze
#

Good luck trolley

#

can someone explode my plugin change pls

flint bronze
#

thanks for the snippet link in there

junior cove
flint bronze
flint bronze
#

I think i'm doing something very fucking wrong

balmy sky
balmy sky
flint bronze
#

Tried to implement it with some kind of bitfield

balmy sky
#

Wait so are you using the select optiontype

flint bronze
#

Yeah. Is there a better way to do this?

balmy sky
#

It's kinda hard to assess the situation but i'm pretty sure you're not doing it right

#

Could you share more of your code

flint bronze
balmy sky
#

Christ

#

It's probably not worth the effort lmao

#

At the cost of just adding an extra ||

potent fox
#

why bother some better way

flint bronze
#

this is probably the cleanest way of doing it trolley

potent fox
#

why did you husk your own message trolldayruined

flint bronze
#

needed to inspect the reaction

north flame
#

now completely self reliant, no more special npm packages!!!

#

(The string in the attachment is the message below it)

dull magnet
#

any reason you do chunking?

#

is that necessary?

north flame
#

yeah, maximum string length bc of the key sizes

#

at 2048 I can have max 190 per chunk

dull magnet
#

why not use a larger key size?

#

2048 is hardly secure anymore

north flame
north flame
#

much much better

#

and I can make the chunk size be 446 chars now!

quasi sentinel
#
void Main()
{
    print(Text::ParseInt("hijklmno")); // returns 0, should instead raise an exception
    print(Text::ParseFloat("hijklmno")); // returns 0.0
    print(Text::ParseHexColor("hijklmno")); // returns vec4(1.32549, 1.21176, 1.47059, 1.60392)   
}
#

hi what the fuck

vast karma
#

What language is that?

#

Looks shit

quasi sentinel
#

angelscript

vast karma
#

Never heard of it, sounds shit

quasi sentinel
#

it is

vast karma
quasi sentinel
#

because there is no .IsNumeric or .IsHexadecimal property for strings, i have to do this shit:

bool IsNumeric(string _s)
{
    const array<string> NUMBERS = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};

    for (int i = 0; i <= _s.Length; i++)
    {
        for (int j = 0; j <= 10; j++)
        {
            if (_s[i] != NUMBERS[j])
            return false;
        }
    }
    
    return true;
}
dull magnet
#

wtf is that

#
bool IsDigit(char c) {
    return digit >= '0' && digit <= '9';
}```
potent fox
dull magnet
#

it will return false for everything

potent fox
#

unless "0"

vast karma
#

"0" isn't equal to every digit simultaneously

potent fox
#

oh right

proud cargo
vast karma
#

Discord itself uses non-const enums all over the place

#

Which is pretty helpful

proud cargo
#

its only helpful because its not intended

#

doesnt even freeze it lmao

potent fox
#

how much does it make difference

dull magnet
#

it doesn't

#

tbh idk why anyone would ever use Object.frezee

#

most useless function in javascript

vast karma
#

No that's print()

dull magnet
#

if you don't want an object to be changed just don't write to it

proud cargo
#

nah idk i freeze my stuff so i dont accidentally write to it

#

better safe than sorry

vast karma
#

I can see benefits of freeze, but nothing a good type system doesn't do better

dull magnet
proud cargo
#

ok?

dull magnet
#

don't you get an error if you try to write to a frozen object

vast karma
#

You get a compile error if you even try

proud cargo
dull magnet
#

tbh i can't even imagine a case where id accidently write to some random object

#

maybe if you typo if (foo.bar = "hi")

proud cargo
#

me neither but thats not really the point

dull magnet
#

but typescript can catch that

vast karma
#

Maybe if you're handing it into some untrusted function

proud cargo
#

freezing it costs me like nothing

dull magnet
#

js is not the right language to be doing that

vast karma
#

Discord is full of functions I don't trust

proud cargo
dull magnet
#

i don't need to trust them

#

because only approved code is merged

proud cargo
#

stop being so mean to me

#

i was making a point

vast karma
#

There will be no point-making in this household

dull magnet
proud cargo
#

idk just use const enums :/

dull magnet
#

let's be happy they don't

quasi sentinel
fathom sun
#

Hey, y'all! I have a problem that would like to solve using vencord.
I'm a moderator of a relative big gaming server and would like to automatically check if any of the members there are also part of another specifics servers (hacker servers) so I can know who I should ban or not. (No automatic ban, just retrieve their ids so I can ban them manually)
Would it be possible with vencord? Risky to do so?

iron moon
#

i dunno, sounds like api aboose

#

looking in servers you are not i reckon

#

is uh

fathom sun
iron moon
#

yeah i guess

fathom sun
#

for a normal discord bot, the bot would have to be added to the hacker servers, no?

iron moon
#

yeah the bot would have to be added

fathom sun
#

20k+ members, the vencord plugin would access the list members of my server through my account and go to their "servers in commom" page through my account to check

#

I don't mind creating a fake acc to use it if necessary

iron moon
#

what about your discord is targetable for hackers

#

just curious

fathom sun
#

not the server itself, its a gaming server focused on a specific game, and I want to keep it free com cheaters of that game

#

there's a bunch of hacker servers that sell cheaters for the game

iron moon
#

rust?

#

i swear if its roblox

fathom sun
#

nop, GTA V

iron moon
#

eh

#

five m?

fathom sun
#

nah, normal game

iron moon
#

heh?

#

thats rare

fathom sun
#

ye, and like to keep the community free of cheaters to the best of my capabilities

iron moon
#

wait s

fathom sun
#

but with 20k+ members its hard to check them all manually

iron moon
#

howd you even moderate?

#

if its just gta

fathom sun
iron moon
#

thats waaaay to much effort for just a gta server

#

i reckon you just

#

move to five m

#

its incredible more easier to moderate, and there are quite alot of discord intergrations

fathom sun
#

I mean, how I moderate is not really needed to the problem I wanna solve

iron moon
#

fair enough, was just letting you know

fathom sun
#

Apprectiate it but we won't move to fivem

iron moon
#

alright

#

well the only solution that is plausible without getting banned is a discord bot

#

because getting the members from another server and checking if they're in yours is kinda selfbot

fathom sun
#

yea, I don't mind creating a burner acc if needed

iron moon
#

dont get banned

fathom sun
#

?

dull magnet
#

it's not possible

#

you would need to spam the shit out of the discord api to get all mutual members and its just not feasible at all

fathom sun
#

ye, I was thinking of limiting the request per second and only checking the online members

dull magnet
#

unless you have moderator permissions there, it's not even possible to just fetch members

vast karma
#

Super trivial to circumvent too, just use an alt

dull magnet
#

so instead you would have to fetch the profile of every member of your server to get their mutual servers

#

which would mean one request per member, so in your case 20k requests?

#

that's not possible + we won't help with such api abuse

#

also just because they're member of that server doesn't mean they're cheaters.. you're a member there too after all

dreamy raven
#

Hi, i tried making my own plugin and i used the https://github.com/Vendicated/Vencord/blob/main/docs/2_PLUGINS.md i just edited the Values mentioned to change, but i get a error at pnpm test witht the following error:

1:1 error Missing header simple-header/header
16:4 error Newline required at end of file but not found eol-last

✖ 2 problems (2 errors, 0 warnings)
2 errors and 0 warnings potentially fixable with the --fix option.

ELIFECYCLE  Command failed with exit code 1.
 ELIFECYCLE  Test failed. See above for more details.

dull magnet
dreamy raven
#

the --fix is used with build or test or what?

dull magnet
fathom sun
#

we know what servers are sus and what servers are just for selling cheats. I could just use it on the online members only and limit the request per second, like I said. But oh well, I will just give up

dreamy raven
vast karma
#

It's pnpm lint --fix

dreamy raven
#

what does lint do?

vast karma
#

Run the linter

dreamy raven
vast karma
#

Yes, pnpm lint runs eslint

potent fox
#

but if it doesnt its really pointless 🥴

#

then only thing you would lose by using regular enum is few more bytes of transpiled code

dull magnet
#

maybe marginally at first but jit compiler will make these optimisations for you

proud cargo
#

v8 my beloved

frigid bay
#

p sure someones made that plugin for bd or replugged before

#

looking at how that works might help

#

cant help with learning the vencord api tho

vast karma
#

You don't read the localstorage directly, use the stores

proud cargo
#

what the fuck

dull magnet
#

isn't there an experiment that does this

#

the new notification settings

vast karma
#

Wasn't the experiment for disabling notifications without dnd? Or maybe it's separating the two in general

north flame
vast karma
#

data data data data

north flame
#

forgot to set options to [] for the data command

frosty otter
#

why are you making a end-to-end encryption plugin?

#

discord is pretty secure by default

vast karma
#

Your private key is [object EncryptKey], gonna haxx you now

north flame
#

You can send custom emojis, without Nitro

#

and it's not just attaching an image to the message

pure temple
#

huh

north flame
#

(It's because the decrypted messages aren't being sent from a real user, it's just the receive message function)

#

the emojis are bypassed bc they're encrypted and thus discord doesn't see it

vast karma
#

But it's no fun if it's not visible to vanilla clients

north flame
#

and the messages aren't visible to vanilla clients no matter what

flint bronze
#

@dull magnet@vast karma it was focus mode, which is implemented as a DND or Focus mode silences notifications

iron epoch
zenith sedge
#

How hard would it be to monitor people's voices in vcs and normalize the volume Clueless

vast karma
#

Probably pretty hard, isn't the audio handling in a wasm blob?

zenith sedge
#

I have no idea 😁

north flame
#

I have a pretty major update that I have yet to push

dull magnet
zenith sedge
#

dang

north flame
#

How can I check whether a user has a specific permission?

#

I had a look at PermissionsViewer but my tiny brain can't comprehend the magic

balmy sky
#

Couldn't name them off the top of my head though

cedar olive
#

but that will return false for DM channels so you need to handle those differently

#

depending on the permission it's safe to assume dm channel will have it because, for obvious reasons, dm channels always have permissions like embed links and stuff

north flame
#

I’ll just have the public key be appended to the join message

flint bronze
#

this is very much a shiddohwell

north flame
frosty otter
glass oracle
#

real time clock traffic

north flame
#

Lmao

north flame
#

I’d hate to not be able to mute somebody’s constant meme sounds

frosty otter
glass oracle
flint bronze
north flame
glass oracle
#

and you can mute a user too

outer jetty
#

Hi, I have an idea for a plugin for Vencord but as I've seen no one do it, is it possible to make a menu like the gif but for something else unless you have to recode the whole thing?

outer jetty
flint bronze
#

so, favouritemedia + gif categories which are in dev?

#

something like that, with your own backend provider for the content maybe?

flint bronze
#

cool facts: discord already uses tenor to provide the gif picker

outer jetty
flint bronze
frosty otter
vast karma
#

n.value > 0 || n?.multiplier > 1 isn't an expression that makes sense under any circumstances, is it?

proud cargo
#

what

grim hare
#

I think that makes sense however you're doing some gross type casting

vast karma
#

I mean that the ?. will never trigger because n.value will throw an error first

acoustic coyote
#

how about you just use rust

grim hare
#

ah yes that's true

acoustic coyote
#

see?

#

he agrees

vast karma
#

But I do for most everything else

acoustic coyote
grim hare
#

I don't agree, rust isn't a magic bullet for everything and people who think it is are kinda annoying blbctscrd

vast karma
#

I'm not claiming it is, but it's a nice language

#

Except for compile times

acoustic coyote
#

lol

acoustic coyote
frosty otter
stiff cargo
#

||but yeah it def is not||

#

scripting in rust 😬

dull magnet
#

tauri sucks ass

frosty otter
#

it's ok

dull magnet
#

it also takes security more seriously, by isolating the client environment from the outside world, and letting the developers manually enable features as needed for their specific app

this person obviously has no idea what they're talking about. electron also has this

frosty otter
#

but I'm too dumb to use rust

dull magnet
#

tauri has no performance improvements

#

the only benefit is smaller install size

proud cargo
#

tauri is also missing some features 😉

vast karma
#

It's still running a whole browser isn't it

dull magnet
#

memory and cpu usage will remain similar

because most of your app happens inside the browser. both tauri and electron use chromium

#

if you know what you're doing, the native backend (nodejs) will only be a very small portion of the performance usage so it's irrelevant

#

tauri has no upsiders other than smaller install size

but it has plenty of downsides such as:

  • lack of features/apis. electron is way more feature rich
  • smaller ecosystem
  • less popular
frosty otter
proud cargo
slender barn
#

I want to contribute to the project, is there any documentation?
I cannot find any in the repo and on the website

potent fox
#

stil better than electorn

proud cargo
#

its only like 70-100

small trail
#

how would i remove my theme but be able to keep the title and logo edit up here

#

its lagging my client

vast karma
#

Find the part of the theme that govern that part and remove everything else

small trail
#

nicenice, thanks

#

hmmm

#

i cant get the discord icon to change

#

oh

#

i managed it

#

nvm

north flame
#

I asked chatgpt to draw an svg of a hummer from the front

#

here's it's idea of a poodle

flint bronze
#

chatgpt moment

acoustic coyote
#

@remote kestrel

remote kestrel
tropic ice
#

Is there a way to get js bookmarklets in discord app?

#

(maybe not the best channel for this, but idrk where else)

tropic ice
flint bronze
#

why would you want that

#

just use devtools

rocky sable
#

Progaming

languid moat
#

Progaymingmeme_troll

left elm
#

Breh

north flame
#

Swift is the best language ever 💯

vast karma
#

Citation?

north flame
vast karma
#

I didn't know Odysseus had opinions on programming languages

copper jay
#

how do you get all members with a certain role

vast karma
#

Impossible unless you're a mod I think

copper jay
#

where is GuildStore documentation and stuff

copper jay
opal portal
opal portal
vast karma
#

The api docs won't be much useful

#

Since we're mucking with internals, not api

copper jay
balmy sky
vast karma
#

Discord Inc haven't shared them

vast karma
copper jay
#

those are examples of like how they work i think

dull magnet
#

it doesnt exist

copper jay
#

LOL

#

how do you

#

know wtf to do then

dull magnet
#

its proprietary code by discord obviously there isnt documentation

dull magnet
#

see how it works

#

see how discord uses them

copper jay
#

thats what ive been doing 😢

dull magnet
#

basic reverse engineering

copper jay
#

why nobody not writing no docs cmon

dull magnet
#

because there are tens of thousands of discord modules

#

why would anyone document them

copper jay
#

cause skids gotta skid

dull magnet
#

if you need documentation this isnt the right thing for you

balmy sky
#

Also it's closed source lmao

dull magnet
#

you can just check the methods it has to see if anything is interesting

#

then read the code of those funcs and search for usages across Discord's code

#

and boom you found out how they work

#

be happy that we have full names and not minified names

copper jay
vast karma
#

Or open the module where it's defined, the stores are easy to find

copper jay
#

where is that

balmy sky
#

Ctrl shift i

#

Sources

copper jay
#

im in sources

#

but it sall

fathom carbon
copper jay
balmy sky
#

Yeah that is the code

junior cove
#

Ctrl+shift+f

copper jay
#

is this supposed to be obfuscated 💀

vast karma
#

Yep

#

That's what modding proprietary software is like

copper jay
#

goated

vast karma
copper jay
#

ok im starting to get it

#

98

dull magnet
#

its just minified

#

obfuscation would look way worse

vast karma
vast karma
#

Wpexs?

dull magnet
#

funny typo

vast karma
#

I mean sure that works too, but it's way less convenient than being able to run a grep and open it in a proper text editor

#

Hm? Why does discombobulate crash on that module, it's not supposed to do that

vast karma
#

Okay figured it out, it's because babel's scope tracking fucking sucks

tropic ice
vast karma
#

Pretty trivial to make ```ts
import definePlugin from "@utils/types";
export default definePlugin({
name: ""Bookmarklets"",
description: "Does stuff idk",
authors: [],

toolboxActions: {
    "Example"() { window.location = "https://www.youtube.com/watch?v=dQw4w9WgXcQ" },
},

});

vast karma
#

Like any userplugin

tropic ice
#

so I'd have to build vencord myself?

#

I've never built vencord myself
Am I supposed to use vscode?

#

ok found the sync - edits vid

vast karma
#

PR accepted

tropic ice
#

bc that's how bookmarklets are formatted

javascript: (() => {
    alert("example");
})();
vast karma
#

That'd be syntactically valid, but unnecessary

tropic ice
#

oh

#

well that example doesn't rick roll me

#

yay this does work

vast karma
#

My most humble apologies for not being able to supply a satisfactory rickrolling experience. I hope you will find it in your heart to someday forgive this most capricious oversight.

tropic ice
#

hmmm

#

would there be a way to make it so I can edit the bookmarklets without having to rebuild an d restart discord every time

vast karma
#

Dunno, probably

cedar olive
#

that's already javascript you dont need to do that

vast karma
#

Mutating toolboxActions at runtime works fine, so you'd just have to make a nice ui for it

cedar olive
#

this is not a bookmark.

tropic ice
tropic ice
#

How can I copy to clipboard?
navigator.clipboard.writeText() isn't working

dull magnet
#

it should work

#

don't just say "isn't working" elaborate on how it isn't working

tropic ice
#

Uncaught (in promise) DOMException: Write permission denied.

dull magnet
#

well there you have it

#

are you on browser

tropic ice
#

no discord app

dull magnet
#

you need an explicit user action to copy to clipboard

tropic ice
#

how do I grant that?

dull magnet
#

but you can also try Clipboard.copy from webpack commons

vast karma
#

Is clicking a toolbox button not an explicit user action?

dull magnet
#

if your action is a toolbox action, that's an explicit user action

tropic ice
#

also i don't really need to copy to clipboard
if it put it in the text input box (where i'm typing) that would actually be even better

dull magnet
#

don't do that

#

look how QuickMention does it

tropic ice
#

oops

tropic ice
#

well this works nicely!

vast karma
#

Very important business there

tropic ice
#

yes

#

How bad is my code

"Fibonacci"() {
            var selection = window.getSelection();
            if (!selection) return;
            var input = eval(selection.toString());
            if (isNaN(input)) return;
            var eps = Math.pow(10, -10);
            var phi = (1 + Math.sqrt(5)) / 2;
            var index = Math.round(Math.log(input * Math.sqrt(5) + eps) / Math.log(phi));
            var result = Math.round((Math.pow(0.5 * (1 + Math.sqrt(5)), index + 1) - Math.pow(0.5 * (1 - Math.sqrt(5)), index + 1)) / Math.sqrt(5));
            insertTextIntoChatInputBox(result.toString());
        }```
vast karma
#

eval? Burn

#

Use Number(selection.toString()) instead

tropic ice
vast karma
#

Ah

#

Just... be careful about what you apply it to, I guess

tropic ice
#

yeah

#

is there any better way to do it?

tropic ice
vast karma
#

There's plenty of libraries for evaluating mathematical expressions (I assume), but you'd have to fetch those scripts first and that's a pain

#

Bare eval is also bad for performance since it messes with local variable scope; I think (0, eval)(...) is a somewhat obtuse way to avoid that

tropic ice
#

waht

#

what does that do

vast karma
#

Compare ```js
function foo() { let a = 4; eval("a = 8"); return a}
foo() // 8
function foo2() { let a = 4; (0,eval)("a = 8"); return a}
foo2() // 4

tropic ice
#

so it makes a variable called a without the (0,eval)?

#

well

#

in this context

vast karma
#

eval(...) gets access to the function's local variables

tropic ice
#

would it make a var for 4181+610+(2*987)+4181?

vast karma
#

This requires the variables to actually exist, which prevents the jit from doing a lot of optimizations

oblique lark
#

comma operator my beloved

vast karma
#

And from how js bundling works, I'm pretty sure that'll make it so that quite a bit of vencord's code is not optimized

vast karma
oblique lark
#

yeah i was being sarcastic i don't know why it exists

north flame
#

How can I intercept a userdata request?

#

like what would the patch be

vast karma
#

What userdata

north flame
#

I've tried all the things I can find

vast karma
#

That's more of a lua term

north flame
vast karma
#

Especially when minification writes things like return x=8,foo()&&alert("hi"),2+x; instead of a sane x = 8; if(foo()) alert("hi"); return 2+x;

oblique lark
vast karma
north flame
tropic ice
dull magnet
#

evil

oblique lark
#

just use the Number constructor???

tropic ice
#

does that work for expressions?

dull magnet
vast karma
#

Number() parses numbers, not expressions

dull magnet
#

it can't minimise anything that eval might have access to

tropic ice
oblique lark
#

wait what the fuck i just read this fully

#

why would you eval for a math equation

dull magnet
#

just use (0, eval)(string)

#

just do it, don't worry about it

tropic ice
vast karma
#

Indirect eval has most of the security issues but less of the performance

#

But it's not like something like this would ever be merged so just yolo it

dull magnet
#

also probably needless to say no plugin using eval for smth like this will be approved

but it's fine for personal use

tropic ice
vast karma
dull magnet
#

now the next question why in the world do you need to calculate fibonacci numbers

north flame
#

fun

vast karma
#

It's elaborated farther up in the thread

#

It's a very noble purpose

vast karma
#

Petition to rename eval to yolo

north flame
dull magnet
vast karma
#
-var
+const
tropic ice
dull magnet
#

var is part of the fun

#

sorry venbot

#

venbot didn't like that

tropic ice
#

why does venbot react to that lmao

dull magnet
#

because ar is an alias for addrole

#

and v is the prefix

#

var image sender @tropic ice

tropic ice
#

huh

oblique lark
#

var is more global than const anyways

vast karma
#

Yes and global variables are not good

tropic ice
fathom carbon
oblique lark
tropic ice
#

omg

cedar olive
#

wait can venbot give a role higher than the one using the command has DFDSFD

vast karma
# fathom carbon why

The more local your shit is the less risk of some other part of the program fucking your shit up

tropic ice
#

it's a role

cedar olive
#

nice nice

vast karma
#

Who is in @me role

cedar olive
#

var the almighty @cedar olive

tropic ice
#

idk but seems like it's donor role

cedar olive
#

they don't want me to be the almighty

#

venbot is angry with me

vast karma
#

Too lazy to photoshop in an arrow, find it yourself

tropic ice
#

top right

tropic ice
vast karma
#

List of what

north flame
#

Circling back, what would be the function to patch to change a user's globalname locally?

vast karma
#

Easiest would be to change it in rendering for a specific component, but I assume you want something more global than that

#

The transformUser function (same module as UserStore) seems like a good candidate if you ask me

north flame
#

It's not patching, even though patch helper says it should json { find: "transformUser:", replacement: { match: /return g/, replace: "$self.check(g);$&" } }

vast karma
#

That's a terrible patch

#

Are you sure it's even patching the right place

#

Because it sure won't be patching the right place in a week even if it somehow is now

north flame
#

right place

vast karma
#

Yeah that's definitely not the right place

north flame
#

oh lmao

vast karma
#

Patching the exports table is generally not useful

#

You want to patch the function itself

north flame
#

it's the only transformUser I can find

vast karma
#

Yeah but you'll want to transform the actual function, not the export table

#

What's that check function do?

#

If it does a console.log it should show up exactly once pretty early during loading

#

...Wait of course it's not, that function is never imported anywhere else so that's never called in the first place

north flame
#

currently it just logs g

#

it would*

vast karma
#

The export table isn't used when calling the function from the same module

north flame
#

gtg

vast karma
#

What is that require.d(exports, { ... }) indirection for anyway? Prevent monkeypatching?

green vessel
#

Hello, thought this would be more related to here, are there any docuementation explaining how to make vencord plugins?

vast karma
#

Did you check the docs folder

green vessel
#

A yes i see it, thank you

cedar olive
#

it assigns the second object to the first

#

why it exists? I don't know I haven't looked for an explanation of that in webpack

stuck falcon
#

I think they would need a more sophisticated system than that one to prevent monkey patching, lmao

cedar olive
#

even then I don't think they can

stuck falcon
#

Yeah

#

It's JavaScript anyway, it could be bypassed easily

vast karma
#

If they tried you could just patch that prevention out

stuck falcon
#

^

cedar olive
#

yes you could

north flame
#

I'm trying to like patch this: json { find: "_.Endpoints.USER(e)", replacement: { match: /getUser\(e\);/, replace: "$&console.log(t);" } }

#

it's not logging t though

#

here it is all patched up

cedar olive
#

because that method is likely not called a lot

#

most user stuff comes from gateway

dull magnet
dull magnet
#

because that's the only correct way to implement es modules

#

modules can reassign their exports at any time and importers will have their imports update in real time

#

the only way to achieve this is via getters that return variables

north flame
dull magnet
#

consider instead patching the place(s) it is rendered in

#

try to understand how the chat and similar places obtain it

#

patch that instead

#

there's one plugin that changes the way usernames are rendered in chat. that might also be of interest

flint bronze
#

anyway

north flame
#

Alr

flint bronze
#

Does anyone know a the proper way to get s sum of all mentions, and render it?

north flame
#

Did discord update the mobile app so you can’t swipe out of channels now?

#

So annoying

flint bronze
#

I think its some quick tab thing they added, I use tablet layout mobile discord so I wouldn't know

oblique lark
#

mobile discord gets worse by the day

stone lintel
#

There trying to make somewhat better

tropic ice
#

\

#

oops

north flame
#

Before I try and continue this, can somebody let me know if this is a fruitless idea, I.E. it’ll be denied immediately

#

And also the fact that it’ll have to compile at runtime wowie

cedar olive
#

yes it will be denied

#

Ven has already worked on 3rd party plugins and discarded the idea

gloomy terrace
flint bronze
north flame
#

Idea discarded

tropic ice
# tropic ice How bad is my code ```js "Fibonacci"() { var selection = window.getS...

how much worse is this

var selection = window.getSelection();
if (!selection) return;
var fibminus2 = 0n;
var fibminus1 = 1n;
var fib = 1n;
var fixedSelection = selection.toString().split('\n');
var input = BigInt(eval(fixedSelection[0]));
for (let i = 3; fib < input; i++) {
    fib = fibminus2 + fibminus1;
    fibminus2 = fibminus1;
    fibminus1 = fib;
}
fib = fibminus2 + fibminus1;
insertTextIntoChatInputBox(fib.toString());```
#

also is there a way to replace the chatinputbox if there's something already in there

#

and .split('/n' is so it works if i triple click a msg

balmy sky
#

I'm trying to patch the module that has the newleaf message, but it seems like there's 2 of them? is there a way that i can patch both of them

#

I know you can set all to true in the patch to "apply to multiple modules" but it doesn't appear to do anything in the patch tester, or in the actual client

vast karma
#

Wouldn't that patch get the lang files?

#

There's one for every language

balmy sky
#

Oh that makes sense

#

Is it a better idea to just patch the code that displays the message instead of patching the message then?

vast karma
#

Absolutely

cedar olive
#

if it's only used in one place yeah

#

or even if not actually

#

you can set the patch to all too

balmy sky
#

Alright, thanks silicat

#

YEAHHH IT WORKS 💀

gloomy terrace
balmy sky
#

Is there a way i can export all datastore data to a file so i can port it between devices/installations?

vast karma
#

Dunno, probably some way to export localstorage in devtools

frosty otter
green vessel
flint bronze
#

when will discord fix activities being partial pixel sized

green vessel
tropic ice
#

is there a way to add something to the right click context menu/buttons panel thing that only shows up if the msg meets a requirement (like being all numbers)

proud parrotBOT
vast karma
#

I would assume returning nullish works to hide the button

tropic ice
#

idk what that means
i'm very new to js

#

or ts

#

idrk

#

i can't tell the difference

jagged briar
tropic ice
#

so both null and unefined are nullish?

tropic ice
#

although doesn't seem that much easier than build

jagged briar
#

it is so much easier wdym

#

just crtl+r discord everytime you make a change

tropic ice
#

pretty simple expressions

vast karma
#

Download some fancy library from somewhere

#

We discussed that yesterday

tropic ice
#

what would I do if i were to make a pr'ed plugin (prob won't actually make) that evaluates math expressions
bc I don't think downloading a fancy library would be good for a pr

vast karma
#

Either add it as a dependency or load it at runtime

tropic ice
#

Is there a way to work with highlighted text built into addContextMenuPatch() or do I use window.getSelection()?

#

If nothing is highlighted, i want to use message.content, but if something is highlighted, i want to use that

#

this is only working for highlighted text

#

Also how do I stop pnpm watch
Can I just close the console

vast karma
#

^C, as always

tropic ice
#

huh

#

i'm extremely new to this

#

oh press ctrl c?

vast karma
#

Ctrl-c (sigint) is how you close just about any terminal program

tropic ice
#

ok

north flame
#

*(Reposting so it doesn't get buried in the previous convo) *
How can I update a user's custom status?

jagged briar
#

also it sounds like your about to make a selfbot

dull magnet
#

they're making a local user edit plugin

#

i don't mean to be mean but you should honestly just quit because you seem to have no clue what you're doing and asking for help very poorly (xyprobleming) at every minor step

#

that's just not productive because you're not even learning anything from it

#

try to do your own research and use tools like react devtools or searching the sources for keywords to find out how to do these things yourself

spring dew
#

hey guys, the plugin requests, is it handled by the third party plugin people aswell? or is it solely the vencord dev team?

#

my plugin request has been there for 3 weeks now, i don't think its being open and closed in order 😢

green vessel
#

If the devs think it's a good ideas they'll make it, like how they made member count toggleable but that needs to be merged

chrome elbow
#

plugin request is like lottery

green vessel
#

Fr

dull magnet
#

if you want it this badly, make it yourself or pay someone to make it for you

spring dew
green vessel
#

im pretty sure there is a way

#

dont ask me how i have no idea

spring dew
#

Okay haha, sorry to you guys for being a pain, I'll do some research!

vast karma
#

You can pay people for anything

#

As long as you find the right person and it's not illegal

green vessel
spring dew
#

It's just a plugin that makes every users webcam and video shares pop out separately

#

I don't think would be illegal @vast karma

#

Also Vee sorry for replying, I just read you bio saying don't reply for support

fathom carbon
#

like without mods

balmy sky
#

You can pop out the full vc menu

#

But not seperate cameras

fathom carbon
#

ah

spring dew
#

Yeah , it happens all at once which sucks

frosty otter
#

is it possible to open new windows from a plugin?

north flame
frosty otter
dull magnet
#

anyway you should use discords popup api

frosty otter
#

too lazy 😴

frosty otter
#

searched but couldn't find

frosty otter
balmy sky
#

Run code command?

#

Yeah i was about to say lmao

#

Console

north flame
frosty otter
north flame
#

ruh roh

frosty otter
frosty otter
#

ESBuild warned me

#

but doing window.eval() dind't work

balmy sky
frosty otter
#

because opening dev tools has a big impact on performance for me

balmy sky
#

Pc with 2.4 mb of ram 🙏

frosty otter
#

no

#

but it is not fun, that everything lags if I just want to run a tiny snippet

north flame
#

that's not normal

balmy sky
#

Yeah

#

That's weird asf

frosty otter
#

for the find property?

north flame
#

I always forget to disable the devtools, bc I have a 21:9 monitor, so it doesn't take up too much real estate 😆

frosty otter
balmy sky
#

But ctrl shift f

vast karma
frosty otter
north flame
#

Accidentally doing while (true) in Firefox was not fun

frosty otter
#

how do i know what to put in the find property

vast karma
#

Find some string that is unique

frosty otter
#

but where?

#

in the chunks?

vast karma
#

Messages.SOMETHING and the exports block are often good choices

balmy sky
frosty otter
#

so an parent function/object/class

vast karma
#

Just has to be something in the same module, but something that is relevant is best both for documentation purposes and resilience against refactoring

balmy sky
#

Heavy on the resilience against refactoring

frosty otter
#

ok

#

thx

vast karma
#

Also important to not include any minified variable names, since they change with every discord build

north flame
#

I can't seem to find a specific channel change/load function (like ChannelStore.setChannel(id)), so are we just supposed to use location.assign()?

dull magnet
#

look in webpack commons

north flame
#

alr

vast karma
#

Pretty sure you're supposed to use NavigationRouter

flint bronze
#

^^^^

#

Use NavigationRouter

north flame
#

.transitionTo("guildId/channelId")?

#

testing

cedar olive
#

look at keepCurrentChannel source code

#

to see how to use

dull magnet
#

you really need to stop asking everything

#

learn how to find things yourself

vast karma
#

Either find a plugin that does something similar and copy that, or find something in discord itself and dig out how it does it

dull magnet
#

also if you look one function below you'll literally find a function called "transitionToGuild" which takes a guildId, a channelId, and a messageId

green vessel
#

💀

frosty otter
#

In the patching docs stands I should press CTRL + SHIFT + F to search all bundles. In the DevTools or where?

frosty otter
#

in a chunk datamining repo?

vast karma
#

In devtools usually, yes

frosty otter
#

I am trying to replace the default avatar in the shop, but I can't get it to work

glass oracle
#

bad find:

frosty otter
#

but I can't find a string that is "near the function"

#

or a variable that contains the URL for the default avatar

frosty otter
cedar olive
#
{
    find: ".getIsProductNew(",
    replacement: {
        match: /(?<=\.avatarContainer,.+?src:).+?(?=,)/,
        replace: '"your new url"'
    }
}
#

I made it for you

#

it changes this

#

or if you want to change in all places

frosty otter
#

ohhhhhhhh

#

thank you

#

looks like I was just a few functions away

cedar olive
#
{
    find: "f6c7b8245d3a54cf98b2",
    all: true,
    replacement: {
        match: /\i\.p\+"f6c7b8245d3a54cf98b2\.png"/,
        replace: '"new url"'
    }
}
#

try this if you want to change in all places the placeholder is used

glass oracle
#

\i.p+ seems more suitable

cedar olive
#

you are right

#

it's unlikely for that to change

glass oracle
vast karma
frosty otter
glass oracle
#

cant even specialize

warped nacelle
#

I am trying to make a plugin that removes zalgo text from messages, I have a regex I want to use, how would I remove that from text (mainly usernames and messages). I dont currently know if I can do it through the patches: tag, because that seems like it is only for core components.

viral roost
#

a patch can patch anything as long as you can find the component through a constant string

warped nacelle
#

Ah, any way to run it through a regex? I dont want to manually add each zalgo character.

frosty otter
#

couldn't you just use the text replace plugin?

#

or does it only work on message contents 🤔

warped nacelle
balmy sky
#

Patch the message component, redirect the content to a function in the plugin then filter it there

dull magnet
warped nacelle
dull magnet
#

javascript has unicode normalisation built in

#

you want NFKC iirc

#

it won't catch something like russian letters iirc because well those are normal letters too

warped nacelle
proud parrotBOT
warped nacelle
#

so I made this :(

clean(str: string) {
        return str.normalize("NFKC");
    },
    patches: [
        {
            find: ".Messages.MESSAGE_EDITED,",
            replacement: {
                match: /let\{className:\w+,message:\w+[^}]*\}=(\w+)/,
                replace: "$self.clean($1.message.content)"
            }
        }
    ]```
and it just crashes my discord whenever I open any sort of chat, it seems like it is assigning to the wrong place. (I was using references from InvisibleChat for message replacement)
dull magnet
#

you're removing all that code you're matching

#

and replacing it with something that does nothing

vast karma
#

Use patch helper

warped nacelle
#

Yeah I think I am going to just leave it here, I can't seem to get anything to work automatically, I may go the invisiblechat route of requiring a separate button press

stone lintel
#

i trying to make a bot for discord in python but i cant get it to import form the responses

#

help pls

jagged briar
#

We don’t have access to your computer

#

Show us the code

stone lintel
#

ok

#

forgot

#

import token
from typing import Final
import os
from dotenv import load_dotenv
from discord import Intents, Client, Message
from responses import get_response

bot token thingy

load_dotenv()
token: final[str] = os.getenv('DISCORD_TOKEN')

intents: intents = intents.default()
intents.message.content = True

#message dead chat
async def send_message(message: Message, user_message: str) -> str

dull magnet
#

join discord.py discord or some other programming discord

stone lintel
#

alt

opal portal
#

paste here and use python syntax highlighting

#

you didn't even send your full code and i can see like 3 mistakes

stone lintel
#

Ok I’ll check it out

#

Thanks

opal portal
#

intents: intents = intents.default()
intents is not capitalized
intents.message.content
message_content*
token: final[str] = os.getenv('DISCORD_TOKEN')
final is not defined

stone lintel
#

I’ll fix those

opal portal
#

paste your code first

opal portal
stone lintel
#

Ik

opal portal
#

waiting

stone lintel
#

One sec

stone lintel
dull magnet
#

like i said please take it elsewhere

#

like it says in the channel topic, this channel is not for beginner questions. there are better places for that

stone lintel
#

Sorry I forgot

opal portal
#

u didn't even finish the code

#

you must have generated this or something

stone lintel
#

Nope

opal portal
#

this is like 1/4 of the code that you need

stone lintel
#

Then I’ll just code the rest

opal portal
#

but what am i supposed to help you with

#

the code doesn't work because it's unfinished

dull magnet
fallen vapor
#

I got chatgpt to finish it for you.

#

you're welcome

stone lintel
#

K

#

Thanks

opal portal
fallen vapor
#

wow, what prompt did you say to get chatgpt to simplify it that well?

glass oracle
#

stop using chatgpt

#

ai was a mistake

jagged matrix
#

I’d hate if they start making pizza with AI. That’d ruin my business.

fallen vapor
#

!catloot @jagged matrix

flint bronze
#

what

glass oracle
#

I DO NOT NEED AI IN MY FOOD
mfs will put fucking cyanide in apple juice

jagged matrix
#

If they so dare touch pizza.

fallen vapor
# flint bronze

im sorry, I was trying to make a joke. The joke being that Mudkip simplified the code by hand, but I pretended as if he asked chatgpt to do it. It was probably quite unfunny to anyone but me.

flint bronze
#

||now that's called "sarcasm"||

remote kestrel
#

im wondering if there's a mathematical way to get the selected color based on position in a color circle rather than the more straightforward way of capturing the pixel data underneath the cursor

glass oracle
#

find distance between the center and the coordinate (for lightness)
find angle made by center and the coordinate (for hue)

remote kestrel
#

hmm

#

how reliable would that be

#

like

#

would that match up with the actual displayed color

glass oracle
#

it would if done correctly

remote kestrel
#

i wonder if I can get the color at a position in the gradient

glass oracle
#

you could also draw the color wheel itself with those equations

remote kestrel
#

how

glass oracle
#

canvas and webgl/webgpu

remote kestrel
#

I'm doing this with compose

#

Skia canvas

#

uhh I hope there's a method that I can use to get a color from a gradient

#

maybe I'm overlooking

glass oracle
#
       // x, y
origin = [2, 2]; // center of the color wheel
cursor = [4, 4]; // position of picked color
maxdist = 8 // max possible distance

sqr = (n) => n * n;
// distance = sqrt( (x2-x1)^2 + (y2-y1)^2 )
lightness = Math.sqrt(sqr(cursor[0] - origin[0]) + sqr(cursor[1] - origin[1])) / maxdist;
// angle = arctan2( (y2-y1), (x2-x1) )
hue = Math.atan2((cursor[1] - origin[1]), (cursor[0] - origin[0]));

[hue, 1, lightness] // h (radian) s (0-1) l (0-1)

this is how you would get the HSL values from 2 points in your gradient

remote kestrel
#

oh

glass oracle
#

you'd need to adjust the hue variable to fit your gradient

remote kestrel
#

interesting

glass oracle
#

the example coords give this

remote kestrel
#

i see

#

are color circles normally hsl or hsv

glass oracle
#

oh this one's hsv

#

i may have misnamed

#

i usually see hsv

quiet pawn
#

How can I be like this?

remote kestrel
#

ohh hue is 0-360

#

which would make sense for circle

#

the gradient I have now is hard coded colors

quiet pawn
#

How do I do this? @remote kestrel

remote kestrel
#

you can't

quiet pawn
#

How can I work like you?

flint bronze
quaint cipher
#

is this bad ?

const Thing: React.ComponentType<React.HTMLAttributes<HTMLTableSectionElement> & {
    transparent?: boolean,
    toolbar?: React.ReactNode,
}> & {
    Icon: React.FunctionComponent<{
        className?: string;
        iconClassName?: string;
        children?: React.ReactNode;
        selected?: boolean;
        disabled?: boolean;
        showBadge?: boolean;
        color?: string; // SVG color (e.g. "currentColor") -- passed as prop to the icon component
        foreground?: string; // passed as prop to the icon component
        background?: string; // passed as prop to the icon component
        icon: React.ComponentType<any>;
        onContextMenu?: () => any;
        onClick?: () => any;
        tooltip?: string | null;
        tooltipColor?: unknown;
        tooltipPosition?: unknown | "top" | "bottom";
        tooltipDisabled?: boolean;
        hideOnClick?: boolean;
        role?: string; // (?)
        "aria-label"?: string;
        "aria-hidden"?: boolean;
        "aria-checked"?: boolean;
        "aria-expanded"?: boolean;
        "aria-haspopup"?: boolean;
    }>;
    Title: React.FunctionComponent<{
        className?: string;
        wrapperClassName?: string;
        onContextMenu?: () => any;
        onClick?: () => any;
        id?: unknown;
        muted?: boolean;
        level?: unknown;
        children?: React.ReactNode;
    }>;
    Caret: React.FunctionComponent<{
        direction?: "right" | "left";
    }>;
    Divider: React.FunctionComponent<{
        className?: string;
    }>;
} = findByPropsLazy("default", "Divider", "Icon").default as any;
#

Idk if ther was a better way

flint bronze
#

What the fuck

#

That's ALL just type information

quaint cipher
#

is there any possible way i can find out what to name it from code or do i have to come up with something 😭

#

it just says default