#🧩-plugin-development

1 messages · Page 63 of 1

balmy sky
#

Does that make it better

flint bronze
#

@balmy sky will strap a motorbike engine to a wheelchair

balmy sky
#

I wanted to do a snail but they didn't have one

#

So i settled for frog

rocky falcon
#

lol

rocky falcon
#

anyone know where a good Blocked icon exists? or will i have to make it myself

swift spear
balmy sky
hushed loom
#

is it possible to edit the current text in the chat box

#

havent been able to figure out how

rocky falcon
balmy sky
hushed loom
balmy sky
#

I just tested, it appends it

#

OH

#

Wait no nevermind

#

I'm stupid

hushed loom
balmy sky
#

I just thought of a solution then realised i am absolutely retarded

rocky falcon
#

alr guys, time to get added to the devs const and get that sweet badge! /s

clear parcel
#

how do you force the dev companion plugin and/or the vscode plugin to reconnect

#

i swear i have to reopen both like 300 times to get them to connect sometimes

dull magnet
#

it adds a button in the channel button bar

clear parcel
#

guh

#

can i pr a slash command for it

dull magnet
#

insane

clear parcel
#

i dont like the toolbox 😭

dull magnet
#

why not just use the toolbox lmao

dull magnet
clear parcel
#

cuz it messes with my devtools muscle memory

dull magnet
#

whaaa

#

explain

clear parcel
#

actually wait

#

nevermind

dull magnet
#

yeah it's not on the far right lol

clear parcel
#

yeah i'm retarded

#

ok tyyy

dull magnet
#

tbh i wanted to do much more with the toolbox but the fact that it's a plugin makes it limited cause that makes it hard for other plugins to effectively use since it might not be enabled

clear parcel
#

WHY IS IT STILL NOT CONNECTING

#

i'm gonna cry

#

it even said ws connected

dull magnet
#

fear

#

do you have multiple vscode open

clear parcel
#

oh my god

dull magnet
clear parcel
#

does it not connect to the one

#

with vencord open

#

i have... a few

dull magnet
#

currently it just starts a websocket

#

the first one you opened wins

#

could definitely improve it maybe

clear parcel
#

just a button on the bottom bar that forces it to connect would be enough

#

idk how to work with vscode plugins though

dull magnet
#

the vscode plugin is the ws server

#

vencord connects to it

rocky falcon
dull magnet
#

so i decided to do it this way

#

also other way round is a bit problematic for security

#

companion has RCE inbuilt to be able to test function replacements

if it were the other way round (vencord running the websocket server), any website you visit in your browser could connect to the websocket and run code inside your discord

hushed loom
#

vencord rce!

amber mantle
#

vencord rce!!!!! wtf!!

#

ven stole all my data (AGAIN)

ebon saddle
#

Hey, any idea where to post an “issue” that's technically not a bug, but rather lack of a feature of a certain plugin? Not really a plugin request either…
Wanted to suggest adding local overrides to PronounDB plugin so that you could save pronouns of people that don't have them anywhere

rocky falcon
#

plugin requests i think

honest stump
hushed loom
honest stump
hushed loom
#

Since pronoun db is also managing pronouns from an external source

balmy sky
#

Yop

#

It would be confusing to have 2 plugins both interacting with pronouns

honest stump
#

pronoun db falls back to discord though if the user has no pronouns

hushed loom
#

What is the user wants to overwrite pronouns pulled from the API

dull magnet
#

anyway pronoundb might be removed / rewritten to remove most of it

#

i don't think there is any reason to still use the pronoundb api

balmy sky
dull magnet
#

it's older than the pronouns feature silly

flint bronze
#

i explicitly dont use the plugin because it relies on a 3rd party api that isnt needed

#

lol

dull magnet
#

yeah especially cause it tells the api every user you interact with

flint bronze
#

doesnt it have a stupid ratelimit too?

#

such an API should be expected to recieve 50+ requests at once from the same user, just very infrequently

balmy sky
rocky falcon
#

everyone sounds stupid sometimes, just say whatever lol

balmy sky
#

Leading on from that advice, i am most likely about to unleash the most horrifying shit upon this channe l

#

I've been working on a plugin called profilepresets that allows you save your profiles to set again later, it's in a semi functional state (you can save a profile, open the modal, load it again) but as soon as you restart the client the modal crashes. I figured out it's because for some reason the user objects in the datastore aren't maintaining the getAvatarUrl function across sessions (or correctly, at least). I can work out the other kinks probably but i have no idea how to correctly store a custom user object with no other references

#

The code is here (sorta spaghetti rn sorry)

kind pike
#

solution: never restart your client and always keep it open no matter what

#

(this is a joke, i am not liable for any damages that this may cause you)

cedar marsh
#

where would I put a function I want to share between plugins?

rocky falcon
#

depends, what is it?

cedar marsh
#

getStyles and createStyleSheet of clientTheme

dull magnet
#

you can export it from ur plugin file

#

and just import it from the other plugin

#

or if you think it's useful to other plugins in general, you can put it in utils

cedar marsh
#
let [h, s, l] = match.map(Number);
l /= 100;

Since I only reassign l, eslint is mad at me for eslint/prefer-const

Is this is a situation where it is acceptable to add a // eslint-disable-next-line prefer-const?

#

full context:

const variableRegex = /(--primary-\d{3})-hsl:(\d+).*?(\d+\.?\d*)%.*?(\d+\.?\d*)%/g;
function getColorHexCodes(styles: string) {
    const colorVars = Array.from(styles.matchAll(variableRegex), v => v.slice(1));
    return colorVars.map(match => {
        const variable = match.shift();
        // convert HSL to hex https://stackoverflow.com/a/75003992/8133370
        // eslint-disable-next-line prefer-const
        let [h, s, l] = match.map(Number);
        l /= 100;
        const a = s * Math.min(l, 1 - l) / 100;
        const f = n => {
            const k = (n + h / 30) % 12;
            const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
            return Math.round(255 * color).toString(16).padStart(2, "0");
        };
        return { variable, hex: `#${f(0)}${f(8)}${f(4)}` };
    });
}
#

oh I should probably just break out hsl to hex conversion into a function

#

yeah this is prettier

const variableRegex = /(--primary-\d{3})-hsl:(\d+).*?(\d+\.?\d*)%.*?(\d+\.?\d*)%/g;
interface VariableHex { variable: string, hex: string; }
function getVariableHexCodes(styles: string): VariableHex[] {
    return Array.from(styles.matchAll(variableRegex), match => {
        const variable = match[1];
        const [h, s, l] = match.slice(2).map(Number);
        return { variable, hex: hsl2hex(h, s, l) };
    });
}

function hsl2hex(h: number, s: number, l: number) {
    // https://stackoverflow.com/a/75003992/8133370
    l /= 100;
    const a = s * Math.min(l, 1 - l) / 100;
    const f = n => {
        const k = (n + h / 30) % 12;
        const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
        return Math.round(255 * color).toString(16).padStart(2, "0");
    };
    return `#${f(0)}${f(8)}${f(4)}`;
}
cedar marsh
#

@dull magnet do you think you would merge this plugin or should I stop working on it?

fixHardcodedColors

Discord often hardcodes colors despite having css variables for all it's colors.

For example, --primary-160 is #ebedef, but in the code, they have hardcoded the color hex instead of using the variable

.defaultLightModeCustomGradient_e77fa3 {
    background: linear-gradient(rgba(0,0,0,0) 20%, #ebedef 100%);
}

This causes issues for theme devs who want to make stuff by directly modifying color variables as they need to manually fix all these problems.

This is very prevalent when using ClientTheme and looking at "channels and roles"
Discord_tn6oWjipFv

This plugin addresses this issue by generating css to make the problematic code use color variables instead, for example:

.defaultLightModeCustomGradient_e77fa3 {
    background: linear-gradient(rgba(0,0,0,0) 20%, var(--primary-160) 100%);
}
cedar olive
#

how does it generate?

cedar marsh
# cedar olive how does it generate?
  1. get default hex codes of variables <#🧩-plugin-development message>
  2. get css that hardcodes color
const cssWithHexColorRegex = /(?:^|})[^{}]+?{[^}]*?#[a-f\d]{6}[^}]*?}/g;
// gets array of css strings that we may need to edit since they hardcode color
function getCssWithHexColors(styles: string) {
    return Array.from(styles.matchAll(cssWithHexColorRegex), match => match[0]);
}
  1. logic to generate fix css(what I need to work on, and will take some time)
#

Similar to lightModeFixes of clientTheme

dull magnet
#

btw it's funny how ClientTheme tells u it wont look good with nitro theme

#

i've been using ClientTheme + nitro theme for ages and its really good

cedar marsh
#

Its more just a "here be dragons", this is unsupported thing

dull magnet
#

even makes channels and roles less bad

cedar marsh
#

is that a yes or no on the proposed plugin

cedar olive
#

I would say yes, but that's me

cedar marsh
#

ok, thanks

dull magnet
#

depends a lot on how it's implemented

#

if it requires a manual map then no

#

cause that's no better than just the theme doing it manually

cedar marsh
marble egret
#

hey its me on a new account, and i have to say, yeah the best way for someone to learn is the hard way. I wished I just followed what you said.

kindred sentinel
marble egret
haughty maple
#

i think im officially ai now

marble egret
flint bronze
#

Did you do message author manipulation?

haughty maple
# flint bronze How did we get here?

basically send slash command, in the execute function you do
get current user
change user id to clyde
send bot message as that
return message to send
um yea and it goofs up discord

#

imma make a official vencord plugin that gives me certified dumbass tag

flint bronze
haughty maple
flint bronze
swift delta
pale cipher
#

I'm having an issue with building Vencord with my plugin.
This is the error I'm getting:

X [ERROR] X Could not resolve "fs"[
                                                                                                                                                                                     
    ../../../node_modules/bindings/bindings.js:6:17:                                                                                                                                 
ERROR      6 │ var fs = require(]'fs')
        ╵                   ~~~~

  The package "fs" wasn't found on the file system but is built into node. Are you trying to bundle
  for node? You can use "platform: 'node'" to do that, which will remove this error.

Could not resolve "path"

    ../../../node_modules/bindings/bindings.js:7:19:
      7 │   , path = require('path')
        ╵                    ~~~~~~

  The package "path" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

X [ERROR] Could not resolve "path"

    ../../../node_modules/bindings/bindings.js:7:19:
      7 │   , path = require('path')
        ╵                    ~~~~~~

  The package "path" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.

2 errors
2 errors
Build failed
Build failed with 2 errors:
../../../node_modules/bindings/bindings.js:6:17: ERROR: Could not resolve "fs"
../../../node_modules/bindings/bindings.js:7:19: ERROR: Could not resolve "path"
 ELIFECYCLE  Command failed with exit code 1.

I've attached my plugin as a ZIP as well, I can't figure out what's causing the error. (it was building fine previously and then suddenly stopped)

jagged briar
#

prob because your plugin imports a library that imports node bindings

#

im not sure you will be able to get it working unless you install this package from npm

#

idk how node bindings work tbh

pale cipher
#

oh oof

#

well i guess i could always try using an online api instead of running it locally if all else fails

tight canyon
pale cipher
tight canyon
dry patio
#

yk what a great birthday present would be…

rocky falcon
dry patio
#

java would be a better choice

#

tbh

rocky falcon
dry patio
#

why the hell would you do that to yourself

pale cipher
dull magnet
dry patio
#

the day i become a java supporter is the day i uninstall all my text editors

rocky falcon
dry patio
#

i’m on a mac

rocky falcon
dry patio
#

because i develop mods for mac/ios primarily

dry patio
#

plus windows kinda sucks

rocky falcon
dull magnet
#

when JavaOS

dry patio
#

i like it when there isn’t ads baked into my OS actually

#

🙏🙏

dull magnet
#

ig this is the closest to JavaOS https://en.wikipedia.org/wiki/SunOS

SunOS is a Unix-branded operating system developed by Sun Microsystems for their workstation and server computer systems. The SunOS name is usually only used to refer to versions 1.0 to 4.1.4, which were based on BSD, while versions 5.0 and later are based on UNIX System V Release 4 and are marketed under the brand name Solaris.

tight canyon
pale cipher
#

welp i finally got the library to load just for the .node file to be invalid

trail ether
#

banner

balmy sky
#

LOOK AT MY BADGE

cold canyon
balmy sky
#

💸

cedar olive
#

why would the user object you save contain the function

#

webpack search it and use, it should have no issues

pale cipher
#

this is probably a dumb question but how do i run a function from native in index? just importing it doesnt work (i assume because only native has access to child_process)

cedar olive
#

look at how any other plugin does it

#

xs overlay for example

#

pay attention to the native.ts file and the VencordNative in the plugin index

pale cipher
#

ok thank you!

dull magnet
#

omfg i hate discord

#

there's a GuildMemberStore.getNick() that i patched for EditUsers

#

but they don't use it in all places 😭

#

have to individually patch

pale cipher
#

ok well now ive run into an issue that i actually have 0 clue how to solve

#

when running the dectalk say executable, it checks the current working directory for the dictionary file

#

which causes issues because

#

even with the exe added to path, it still only works if its running in the folder that the .dic file is in

dull magnet
#

u cant use this in vencord

muted oak
#

Hi ! I want to apply regexs on messages coming from other users. I have seen the MessageEventAPI, but is it solely limited to modifying my own messages ?

muted oak
#

I have found fetchMessages in discord code, I know where I want to apply a patch, but can't see what my patch should look like (I have looked at the other plugins for reference but don't find the documentation that goes with it)

balmy sky
#

And directly modify the content value

muted oak
#

I want to modify all incoming messages (not necessarily new ones, at least old ones fetched via /api/v9/channels/.../messages?...)
I know where to apply a patch to do that, but just don't know how to apply such patch
Here is what I tried:

export default definePlugin({
    name: "test",
    description: "Just Regex",
    authors: [{ name: "me", id: 1234567890n }],
    patches: [
        {
            find: "fetchMessages",
            replacement: {
                match: /dispatch\(\{type:"LOAD_MESSAGES_SUCCESS",channelId:t,messages:i,/,
                replace: `dispatch({type:\"LOAD_MESSAGES_SUCCESS\",channelId:t,messages:$self.editMessages(i),`,
            }
        },
    ],

    editMessages: (messages) => {
        for (let i = 0; i < messages.length; i++) {
            messages[i].content = "aaaaaa";
        }
        return messages;
    }
});
dull magnet
#

patch messages

#

fetchMessages won't work for new messages

muted oak
#

Ok, but can you help me on how to make this patch work ? If I don't understand how to make this one I will have to come back to ask for help doing another one later :)

balmy sky
#

I probably misunderstood how it works

balmy sky
muted oak
balmy sky
#

Your find is most definitely wrong

#

Install the vencord vscode extension and find out

muted oak
balmy sky
#

A unique string only in that module

muted oak
#

thanks lol

wet turret
#

aaaaaa

hushed loom
#

aaaaaa

pale cipher
#

once i finish a plugin, if i want to request making it official, do i just make a pr or is there a process to it?

pale cipher
#

aight

cedar olive
pale cipher
#

wait should i still open an idea issue before making the pr? i already have the plugin finished and forgot to make an idea issue beforehand

dull magnet
#

what's ur plugin first of all

cedar marsh
pale cipher
# dull magnet what's ur plugin first of all

the dectalk thing ive been working on, theres this funny game from forever ago called Moonbase that had a text to speech system in the chat where there were some special features (such as singing using phoneme commands). the plugin makes it so that a codeblock with the language set to dt or dectalk will be read out loud using dectalk (with the option to block specific users from playing text), for example:
```dt
text goes here
```

#

its also the same tts stephen hawking used i think

muted oak
pale cipher
cedar marsh
#

I had an idea to cache generated css for ClientTheme so it has less startup impact after first load & loads fast enough to be seen by OpenASAR

  1. To determine when to invalidate cache, I want to get a hash of the current discord css.

Given a VERY LONG string (all of discord's styles). How can I easily create a unique hash

  1. Where would the best place be to store this hash and the cached generation?
jagged briar
pale cipher
cedar marsh
cedar olive
#

you don't need to hash anything

#

use the nonce attribute in the link tag

#

it's the hash

#

maybe not noncs I don't remember the name

#

but I'm pretty sure one of the attributes has the hash

cedar olive
#

show the link tag

cedar marsh
#

data-webpack?

cedar olive
#

perhaps only js have it

#

ah

#

it's only the js files

cedar marsh
#

then the filename hashes?

cedar olive
#

well, the filename is a hash already

#

it only changes when a css changes

cedar marsh
#

but thats 24 hashes

#

want only 1

flint bronze
cedar marsh
#
Array.from(document.querySelectorAll('link[rel="stylesheet"]'), l => l.href.split('assets/')[1].slice(0,-4)).join()
// => '12633.bb59c3b8d0e17096489a,eccca30b9f8cecceb373,e94fed16036953a1b895,b7b7e43d0be76323879a,c6103099b3369321403a,ec315abebf510e77a71a,7b7b8e5ab588ef74e40a,04eba1cfc690e2fac514,5036700d0d0029228856,cf7e832361691285fe2c,9ef8c5a89f56faa56a18,c97afa9c2993948ba941,2917679ca8a08c390036,74e75d5f20452e9d7351,286d1627aec0689ba794,0a62d6f7693ecd74dd11,fc74d95ca9874ee58956,b0b773096ae44e83c71a,1bc414bb2603adeb3f28,7e1422710f9496074580,d59be290c033fabab5b8,9f6d02e1e991650bbbd7,26a29d37d813f69c96c5,5bbcd7dfbc6f2ea7e0f6'
cedar olive
#

actually it's wayy more than 24 hashes

#

discord lazy loads css chunks now

cedar marsh
flint bronze
#

horror

cedar olive
#

they always did with js files they just tweaked it for css too

flint bronze
#

i am convinced that discord only has lazy loading because their codebase is bloated and shit

cedar marsh
cedar olive
#

do you have console shortcuts f53?

cedar marsh
#

I can

cedar olive
#

as the important css it needs is probably always loaded

#

for fix hardcodedcolors maybe

#

but it's not impossible to workaround and listen for new css

cedar marsh
cedar olive
#

hmm

cedar olive
cedar olive
#

that's the amount of css files discord lazy loads

dull magnet
#

every website with substential code should lazy load if possible

cedar olive
#

yeah it's very standard

flint bronze
#

yes I agree with that

#

yet at the same time how in the fuck is a chat app this bloated

cedar olive
#

it's really not

#

it has lots and lots of features

cedar marsh
cedar olive
#

sure it has weird code in some places, but it's not really bloated

cedar marsh
cedar olive
#

you need to listen for when new css is added

cedar marsh
cedar olive
#

probably a dom observer

dull magnet
#

OMG IM GONNA KILL THE WEB CHUNK

#

GRRRRRRRRRRRRR

cedar olive
#

don't do it it's my beloved webpack

#

what happened

dull magnet
#

freeeezee

cedar olive
#

right...

flint bronze
cedar olive
#

you can split only that chunk if you want

dull magnet
#

bro what

#

how does discord have 14mb of js in their entry chunk

cedar olive
flint bronze
muted oak
#

In a patch, what are $1, $2, ... It may be related to the changing obfuscated names in discord that we want to remove (a, e, ...)
Is it about this ?

(sorry to interrupt btw)

dull magnet
#

regex groups

cedar olive
#

listen up

#

what if

#

we chunk discord chunks

#

100 modules every vencord chunk

#

a source file every 100 modules

#

unless it's patched of course

cedar olive
flint bronze
flint bronze
cedar olive
#

now how would I do this with patching using proxy...

cedar olive
#

we only need to do this for the initial chunk

#

lazy loaded chunks are generally small

#

which makes this easy

dull magnet
#

ahahaah

#

i made it extract all modules

#

it loads slower

cedar olive
#

I told you haha

#

we need to chunk it

flint bronze
#

i have a stupid question

cedar olive
#

hm?

flint bronze
#

do either of you know how big all of discord's client JS is in total

dull magnet
flint bronze
#

purely out of curiosity

cedar olive
#

I dont

flint bronze
cedar olive
#

but I know how many modules discord has in total

#

21k

dull magnet
#

its still going

flint bronze
#

only 21k?

cedar olive
#

yes...

balmy sky
cedar olive
flint bronze
dull magnet
#

every module being its own file is soooo useful tho

#

tf is this module

balmy sky
flint bronze
dull magnet
#

long ass string

flint bronze
cedar marsh
#

Yall said using fetch is a bad idea but currently clientTheme does for css?

...
for (const styleLinkNode of styleLinkNodes) {
    const cssLink = styleLinkNode.getAttribute("href");
    if (!cssLink) continue;

    const res = await fetch(cssLink);
    out += await res.text();
}
...

Should I switch to something else?

dull magnet
#

oh god it's highlightjs

#

holy fuck

#

almost 1mb just for code highlighting

#

i didn't know it's so bloated

hushed loom
#

mfw when dev branch of vencord crashes

dull magnet
#

issue of skill

#

how does it crash

hushed loom
#

works fine off main

#

dev just broke

dull magnet
#

whats this

#

click

hushed loom
cedar olive
#

I made it execute the predicate in the addPatch method

#

oh

#

which means vencord object is still initializing

#

cool

dull magnet
#

how does that happen

#

cant repro

#

oh

#

why does it use the global

#

oh cause

#

old

cedar olive
#

yeah it shouldnt use the global

#

I will just force push fixing that

dull magnet
#

nah a shit ton of plugins still use the global

#

it shoudlnt cause any issues

#

doesnt for me

#

oh nvm i can

cedar olive
#

its fine

#

pretty much nothing

dull magnet
cedar olive
#

in fact only one xd

dull magnet
cedar olive
#

yeah

dull magnet
#

how did patchhelper not catch it?

dull magnet
#

lemme just finish up editusers and we can throw it in with it

cedar olive
#

aight

dull magnet
cedar olive
#

uh did we run patch helper on dev?

muted oak
dull magnet
#

cause it removes the predicates

cedar olive
#

that too lmao

dull magnet
# muted oak I don't find anything related to `$1,$2,$&`, is it vencord specific too ?
MDN Web Docs

The replace() method of String values returns a new string with one, some, or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function called for each match. If pattern is a string, only the first occurrence will be replaced. The original string is left unchanged.

muted oak
#

I was missing the parenthesis to make \(\i\) become a group.. thanks !

cedar olive
dull magnet
#

it's too niche sorry

#

btw browsers have tts inbuilt

#

speechSynthesis.speak(new SpeechSynthesisUtterance("meow"))

pale cipher
runic talon
#

isn't dectalk proprietary

hushed loom
#

speechSynthesis.speak(new SpeechSynthesisUtterance("vencord vendor venniecord"))

lapis fable
runic talon
#

what's wrong with niche plugins anyways

lapis fable
honest stump
#

moyai shouldve been that in my opinion

runic talon
#

do it

honest stump
#

i could

dull magnet
#

you are still welcome to distribute it yourself

runic talon
#

with third-party plugins being extremely annoying for users, it's pretty much impossible

#

unless we start doing a Bukkit

honest stump
#

third party plugin library trolley

hushed loom
#

whats a bukkit blbctscrd

runic talon
#

and we have Vencord editions of Spigot, Paper, Tuinity, Yatopia etc.

#

so, infinite forking

#

pain

lapis fable
#

were adding betterdiscord plugins to vencord

runic talon
#

"this is Vencord but we added 5 plugins"

#

"this is Vencord but we added 14 plugins (but not the one from the 5 plugins in the other one that you really need)"

hushed loom
#

tbh its just eaiser to maintain your own build of vencord

#

thats what i do

runic talon
#

not for people who want to use your plugin

#

I do a dev install too

#

but it's beyond most people

lapis fable
#

make plugins modular?

runic talon
#

was discussed a thousand of times probably, and the answer is no

hushed loom
#

eh, that just makes more issues

lapis fable
#

ok but why is it called plugin then

runic talon
#

because it plugs into Discord

#

it does, infact, not plug into Vencord (because it's in it already)

lapis fable
#

its connected to discord already

#

theres nothing to plugin then??

runic talon
#

nope

#

it's not

#

until you enable a plugin it doesn't affect Discord in any way

#

it's not loaded at all

dull magnet
#

use betterdiscord or smth or make your own fork

runic talon
#

I don't see why including everything (if it's not just CSS wrapped in a plugin, and is otherwise up to quality standards) would make a mess

#

it might make a mess from the plugin menu? in that case make a better plugin menu

viral roost
#

vencord compile to .plugin.js soon

cedar olive
#

vencord is stable because plugins are handled officially

#

as soon as you enable the ability to install more plugins easily, users are gonna start experimenting broken plugins which last months or forever

runic talon
#

harder to provide support
disable lesser known plugins that cause problems on updates, have their devs fix them instead in a certain time window, if they don't - remove

#

the quality argument I don't get

#

we have a plugin that's a cat that follows a cursor (real)

cedar olive
#

oops didnt meant to reply

runic talon
#

have a clear separation between "community" and "official" ¯_(ツ)_/¯

cedar olive
#

it's not easy lmao

#

people are always gonna blame vencord itself

runic talon
#

skill issue on their part

balmy sky
#

The current setup works fine

#

With community content there is always going to be issues that people will blame the project itself for

dull magnet
#

not everything has to be modular. from day 1, vencord has always aspired to "just work", which is only possibly by keeping it first party and strictly vetting contributions

if you don't like that, there are better alternatives for you, like betterdiscord

#

it's not changing so there's no point discussing it

cedar marsh
#

.theme-dark .container_f1fd9c,.theme-dark .header_f1fd9c has a background color of #2c2e33
converting --primary-645-hsl to rgb gives #2b2d31
These two are nearly identical, with VERY minor changes (r: -1, g: -1, b: -2)

This makes my current implementation of fixHardcodedColors break because I don't currently have margin for error in the implementation.

#

my main question is how the fuck I would implement a margin for error

hushed loom
#

idk how your plugin works, buy could you just ignore something if its within like 10 total points of error

#

sum the differences and if its under some number

cedar marsh
hushed loom
cedar marsh
cedar marsh
cedar marsh
#

@hushed loom

hushed loom
#

ill look at it in a moment, i think i found a really odd vencord bug

hushed loom
#

@cedar marsh do you have some example css and a place where i can see an obvouse difference

#

(not that good with css, just need somehting to test a fix)

cedar marsh
#

channels & roles is what inspired me to do this

#

I think I almost have a solution cooked up

cedar marsh
#

I fixed

balmy sky
#

Hey, i'm trying to patch the icon on the home button but i can't find the right component for the life of me. I've only managed to patch all of the clyde component (not sure if it's used anywhere else so it might be fine)

            find: "M19.73 4.87a18.2 18.2 0 0 0-4.6-1.44c-.21.4-.4.8-.58",
            replacement: {
                match: /let{size:\i="md",width:\i,/,
                replace: "if($self.IsAnyoneTyping()) return $self.TypingIcon(); $&"
            }
jagged briar
cedar olive
#

try to see if that is what you want

haughty maple
balmy sky
#

Seems hard to understand, why not just "Allows you to open more connections in browser" or something of that nature

hushed loom
#

is it possible to get the png of an emoji by its id

#

it could also be through a cache

balmy sky
#

So

hushed loom
balmy sky
#

Gfd

haughty maple
pale cipher
#

not entirely sure where to ask this since theres no installer development channel (trying to build the installer) but trying to run
go get package github.com/AllenDang/imgui-go
is giving an error
go: malformed module path "package": missing dot in first path element

dull magnet
#

why are u running that

#

readme tells u how to build..

pale cipher
#

yeah but some packages were showing as missing after running go mod tidy so for some reason so i tried installing them manually

drowsy mulch
#

I am asking here, so is it possible to write a js, that can i execute in the dev tools. It should deauthorize all apps for me.

iron epoch
drowsy mulch
#

Mhhh, it sounds a bit hard for me. I am not really into coding. I'll figure out another way.

bronze dove
drowsy mulch
#

Oh thanks :)

bronze dove
#

and open the apps in settings so they get initialized

drowsy mulch
quiet trench
#

Are there any docs for writing plugins? If so, can someone send?

dull magnet
queen sedge
#

yooo they made the roles in profile popouts expandable in canary, showallroles shaking in its boots

dull magnet
#

how?

#

im on canary and dont have it+

#

oh it's an experiment lol

quiet trench
dull magnet
jagged briar
#

Change the panning on a user

queen sedge
wet turret
honest stump
#

can I somehow nuke csp for userscript users

#

i doubt its possible

#

it explodes all image related requests

#

however non-image related requests work fine

dull magnet
#

no

#

you can't

#

you can fetch images with fetch()

#

and then convert to blob or smth

honest stump
#

horror

#

well thatll work

#

thanks

lavish charm
#

How would I go about making a plugin?

amber basin
lavish charm
#

thanks

clear parcel
jagged briar
#

fair enough

clear parcel
#

tho looking at the code

#

actually i lied

#

@jagged briar ```js
findByProps("setLocalPan").setLocalPan(userId, left, right)

#

for rpc functions if you search the command in src you can usually easily find their handler

#

which you can see here

frosty otter
#

hey there, is there a way of modifying the electron properties of the main discord window inside of a plugin? (transparent, always on top, etc.)

sand ember
#

what are you trying to do?

rocky falcon
dull magnet
#

look at native.ts file

signal hemlock
#

how can i get a guild member's flags

#

if they're not in UserStore

dull magnet
signal hemlock
#

oh i see

#

it's not in the types so i was kinda confused

#

how about forcing a fetch of a user

#

specifically the profile

frosty otter
north flame
#

How do I set a user's status (DND, invisible, etc.)

rocky falcon
#

UPDATE_HANG_STATUS_CUSTOM i think

north flame
#

hang status is for VCs, right?

rocky falcon
#

not sure lol

balmy sky
oak sundial
#

I know you can add a presend listener but is there any way to prevent a message from sending?

#

without invalidating the message by removing its content and stuff, i'd rather not send bad requests to discord

dull magnet
#

yes

#

return { cancel: true }

oak sundial
#

neat, is it possible to change whats in the text box too?

rocky falcon
#

not certain if theres a way to change already existing content

hushed loom
oak sundial
#

I'm guessing no success then?

hushed loom
#

ill let you know if i find anything

rocky falcon
#

me quoque

hushed loom
#

@oak sundial i was able to clear the text

#

you can prob do something with clearing then appending

rocky falcon
#

how

#

teach me your ways

oak sundial
#

how did you do it?

rocky falcon
hushed loom
#

this could prob get pr'd to vencord, i might do that later

#
ComponentDispatch.dispatchToLastSubscribed("CLEAR_TEXT")
#

i dont know how to get the current contents of the text box

wide obsidian
#

look at the handler for those events and see how they work

#

then adapt

hushed loom
#

@oak sundial it seems you can also get the current contents of a channel with this
(there could be better ways)

DraftStore.getDraft(channelId, draftType)
oak sundial
#

interesting

tropic ice
#

would it be possible to make something similar to this #1032200195582197831 message, except use most recent reaction?
would vencord have to store the recent reactions itself?

hushed loom
tropic ice
#

ok cool
idk how to do that lmao

not very familiar with vencord codebase nor javascript/typescript

hushed loom
#

you can sub to flux events in your definePlugin

heavy ore
iron epoch
#

noBlockedMessages

shrewd tundraBOT
gloomy terrace
heavy ore
#

like you can see on this pictures one is Vencord and the other one is better discord

gloomy terrace
iron epoch
#

I fear to say there is a clientSideBlock in #1032200195582197831. I don't have time to answer questions

gloomy terrace
#

It's the last response to the issue I just linked approvestare

swift delta
#

vs dev

#

?

#

why didn’t that work?

gloomy terrace
#

¯_(ツ)_/¯

swift delta
#

vf dev

#

?

gloomy terrace
#

Maybe it doesn't to work in a channel where people are supposed to already have a dev install

swift delta
#

would make sense

balmy sky
#

There's still a few things I haven't added

tropic ice
#
[data-list-id="chat-messages"]>[class*=groupStart_]:has([class*=blockedMessageText_]) {
  display: none;
}
#

oops forgot to reply

tropic ice
#

oh but that clientsideblock plugin is probably better

flint bronze
#

I want to build a plugin to edit this, and the join a server menu inside of it, should these be separate plugins?

balmy sky
flint bronze
#

Not really and I already decided no

balmy sky
#

Fair

flint bronze
#

did i cook (so far)

frosty otter
iron epoch
green vessel
#

Hi, how can i utilise the native.ts file i have just created? it uses the node:fs module but when i call it directly i get this error


  The package "node:fs" wasn't found on the file system but is built into node. Are you trying to
  bundle for node? You can use "platform: 'node'" to do that, which will remove this error.```
However i saw from public plugins that this line is used:

```ts
const Native = VencordNative.pluginHelpers.PluginName as PluginNative<typeof import("./native")>;
``` but then also realised, apparently my plugin also doesnt appear there but nly plugins. What is there that im doing wrong?
viral roost
green vessel
#

This is in this folder

amber mantle
#

also what plugin are you making HuhHah

dull magnet
#

use vscode not webstorm

green vessel
amber mantle
#

i didn't even notice it was webstorm

green vessel
#

i am not paying for it, its that my school pays it otherwise i wouldnt

green vessel
pale cipher
#

how can i edit a message by id?

hushed loom
pale cipher
#

yeah

hushed loom
pale cipher
#

ah thank you

pale cipher
#

welp ive run into a new issue, cant figure out how to get authentication

hoary pilot
pale cipher
#

oh ok, thank you!

hushed loom
#

does anyone have an idea or even a starting point on how to get the current position of the curser in the text box (the little I-beam thing)

green vessel
#

Chat how's this? (Sry ik this channel for plugins but there isn't any channel to showcase theme so..)

green vessel
flint bronze
#

I like it btw

green vessel
#

It's not on my channel list

green vessel
#

Is posting links here allowed?

flint bronze
#

which isnt in your profile

#

yes

green vessel
green vessel
unkempt dove
#

how does vencord standardly capture variables like eS or eN that are subject to change?

unkempt dove
#

ty

worthy rose
#

So, I wanna write a plugin that splits message tags on the DOM by an arbitrary RegEx pattern. Do y'all think this is an useful idea? Also, would it be appropriate to be a brand new plugin or a feature merged within an existing plugin?

dull magnet
#

on the DOM?

worthy rose
dull magnet
#

"message tags"?

worthy rose
#

lemme give you an example

worthy rose
# worthy rose lemme give you an example

The message content tag has an inner span, which essentially could be split onto many span tags given an arbitrary pattern. For example /\s+/g would split this message into four spans lemme take an example

dull magnet
#

ooooohhhh

#

and what exactly do you need this for?

#

themes?

worthy rose
tight canyon
#

Discord already splits messages into small chunks, which was a pain for me
What is the point of changing this behavior completely? Discord does this, so it can apply all markdown rules as needed

worthy rose
#

It doesn't split it in a way that's nice to theme

tight canyon
#

And how exactly do you want to change it?
In example above discord creates a new chunk with '(' for example, which is important for links

Vencord is the ultimate Discord tool with 100+ plugins, including SpotifyControls, Translate, and Free Emotes/Stickers

hushed bloomBOT
tight canyon
#

Discord uses this regex /^[\s\S]+?(?=[^0-9A-Za-z\s\u00c0-\uffff]|\n\n| {2,}\n|\w+:\S|[0-9]+\.|$)/ for a normal text, which is not hard to modify, but changing it might break something

regal spear
#

If I have a file object, does anyone know how I can attach that file to the user's text box, like when users upload files to their messages?

dull magnet
#

look at petpet

regal spear
balmy sky
#

How can i get the most recent message (specifically who sent it) from a channel id?

#

Oh i think lastMessageId in the channel object will work

balmy sky
rocky falcon
#

well why would ya be checking the id of an unloaded channel?

balmy sky
rocky falcon
#

just ooc

#

cant you just like, load the channel if its a set id? idk, ive never tried to do that.

#

like, where are you getting the channel ID from?

balmy sky
#

I'm getting the id from getDMIdFromUser

#

Might have butchered that method name

#

There's definitely a better way to do it other than just force loading the channel

hushed loom
#

im trying to patch the onContextMenu of emojis in statuses to pass props i need for a context menu patch, but i cant find where it calls the context menu

#

from react devtools, all i could find was this

#

which just seems to hide this

#

getting the name of an emoji by ID would also work

nocturne apex
#

@green vessel

balmy sky
flint bronze
#

can someone hop in vc for a sec I need to harvest flux events

cedar marsh
#

TimezoneDB but it just determines timezone from /(?:GM|UT)C(?:\+|-)\d{1,2}/gmi in profile

flint bronze
#

its fine I figured out everything is still fucking VOICE_STATE_UPDATES

flint bronze
#

can someone help me test now?

hushed loom
#

sure

flint bronze
#

join vc

#

thats all I need

#

now disconnect and reconnect

#

perfect

#

thanks

cedar marsh
#

So true

#

The plugin could automatically update timezone in profile every time you open the app

dull magnet
cedar marsh
#

Then you need a lib to parse or hardcoded table

#

I got basically no sleep and am up way earlier than normal so this is probably all a really bad idea

cedar marsh
dull magnet
#

because it's stupid when real timezones exist

rocky falcon
#

UTC offsets > "real timezones" any day.

cedar marsh
dull magnet
#

Europe/Berlin

cedar marsh
dull magnet
#

why tf would you use some shitty library

#

you don't need any library

cedar marsh
#

How do you then

#

Because I can't find a way you would decode without

#

Everything I see says you need a lib to get info from those timezones.

dull magnet
#

?

cedar marsh
#

So the goal is to see the local time of every user when you open their profile

#

If a user specifies a timezone in profile, it gets the timezone, does math to get what their local time is, display it live in profile

dull magnet
#

you'll probably want this

cedar marsh
#

Ahh

#

I literally couldn't find anyone mentioning that as a thing

oak sundial
#

Is there a nice way to provide an overlay over messages that meet a specific criteria? I want to colour the bgs of messages that contain certain words etc etc

#

I know message logger does some funky stuff but not sure how I can apply this outside of that

hushed loom
oak sundial
#

this seems just a little bit painful

hushed loom
amber basin
#

use react devtools to select a component, click the view code button, and find where youd insert your own code. then, turn off the beautifier in the bottom left to view the unformatted code, then make a regex to match and replace that

#

adding elements is usually patching children on a jsx call

steady knot
#

why don't we have any indian people here to make a youtube video how-to

amber basin
#

look at anything that adds stuff?

#

first thing to come to mind that should be simple is vencordtoolbox

#

look at how it patches the top right icons

#

or gameactivitytoggle

amber mantle
#

i was gonna look for that anyway

rocky falcon
#

is there any reason i shouldnt send a message to a channel that isnt focused?

amber basin
#

why would you be

rocky falcon
#

im letting the user edit specific bot messages, then using a pre-edit listener, sending a command to edit the message.
the idea is to simulate vanilla discord message-editing as closely as possible, and the current method, sends a message, which is quickly deleted.
but the message doesnt have to be in the same channel, so if i send a message in another channel (eg. a channel specified in the plugin settings), it wont have the drawback of moving the chat up and down for a message to be sent and deleted.

mb if thats overly verbose

hushed loom
amber basin
#

as long as you make the bot delete the command to edit it, that should be fine

#

one request per user action

hushed loom
rocky falcon
amber basin
rocky falcon
amber basin
#

however they do thebot

#

ohhhh

#

yeah

amber basin
#

havent used pk in ages, why dont you make it dm the bot the command?

#

instead of manually specifying channel id

rocky falcon
#

thats... actually really smart, thanks lol

amber basin
#

ofc !

hushed loom
#

is there a way in discord i should add a keybind or should i just add an event listener

flint bronze
signal goblet
#

@hushed loom for your emotecloner pr why are you saving that let?

signal goblet
hushed loom
#

give lines of code

#

lemme check

signal goblet
#

Granted I'm not on PC rn but
It should be fine without the let in general (needs testing)

signal goblet
hushed loom
#

it should be known that most of my plugins are ideas that come to me in a random craze at one am while i am on very little sleep

signal goblet
#

I feel that

#

That's why I was in unity for 12 hrs today

#

I'll look to see if I can do a better patch for you tmrw

signal goblet
#

If you want I should say

hushed loom
#

keeping the let is very much needed

signal goblet
#

I see

signal goblet
#

Cool

#

Alr

signal goblet
hushed loom
signal goblet
#

Version of handleContenxtMenu

#

Or is it just remove that second line

#

I'm tired and not thinking

hushed loom
signal goblet
hushed loom
signal goblet
#

Cool

#

This makes literally no sense

#
find: "renderPrioritySpeaker",
replacement: {
       match: /(handleContenxtMenu",\i=>\{)/
       replace: "$1 this.props.user.HangStatus=this.props.hangStatusActivity;"
}
hushed loom
#

how does it not make any sense

signal goblet
signal goblet
#

I hate using .*? In prod code

hushed loom
#

okay

signal goblet
#

(also me using it because I don't want to match something properly)

signal goblet
# hushed loom okay

All this was is that patch looked unclean for some reason but that let just wasn't needed it could either be just moved down normally or no () around it and $2 as let if it's truly needed (less typing ig idk)

balmy sky
#

Someone already did that

flint bronze
#

When

#

Where

#

Who

balmy sky
#

I forgot when but someone definitely did that

#

You had to host a server for it

#

I don't think the project is continued so it wouldn't be a bad idea to remake it

#

I'd use it

flint bronze
#

i love checking my github notifications

dull magnet
#

I don't think it's available in electron

#

it usually works by sending the audio to a google server

#

nope

#

Firefox doesn't support it at all

#

it's probably kinda hard to do locally

#

cause you need an engine

#

like google doesn't really gain anything from making it a server, if anything it just costs them money to run the api

#

so there has to be a reason it's via api

unkempt dove
#

steal usder data

#

🚎

unkempt dove
north flame
#

Can’t wait for the chrome ai window api to become mainstream!!!

#

There’s only a couple days before Firefox adds it!

honest stump
#

chrome ai what window now

#

dont tell me theyre pulling the same as bing

#

and adding ai everywhere

#

horror

balmy sky
#

God fucking damnit

chrome folio
#

who asked for that

#

"man I really need AI in my browser"

rose fiber
hoary pilot
flint bronze
#

Elaborate how

hoary pilot
#

if you're reading something and want to summarize

flint bronze
#

I only considered shitty chatbot support agent that doesnt know wtf its talking about

flint bronze
honest stump
flint bronze
balmy sky
dull magnet
#

no it's cool

#

better than every website using their own ai

balmy sky
#

Depends what it entails actually

flint bronze
iron epoch
balmy sky
#

Give ai access to dom

#

"Hey google, make this site look good"

amber basin
#

hey google, patch webpack

rocky falcon
#

is there any way to DM a user, without moving them up in your dm list?

flint bronze
#

you'd have to reorganise the DMs by sending a message or something like that

balmy sky
#

I mean TECHNICALLY yes?

#

You could patch the member list to locally store the order and only change it when you want to

#

But that would probably be too much effort for something that small

flint bronze
hushed loom
hexed plank
#

@dull magnet Recently CtrlEnterSend has broken twice. This time we need to revert 7749206 to fix the problem. Actually Discord has been switching back and forth between those two places to handle message submission logic for multiple times (4 times as I personally experienced). In every version, both patches can be applied without a problem, so would it benefit if we simply include both patches although only one of them is at effect? This way the plugin should break less often.

dull magnet
#

yes do it then

rocky falcon
balmy sky
#

Xy problem

rocky falcon
balmy sky
#

Sounds dodgy

rocky falcon
jagged briar
#

i dont see a reason for that to exist and sounds a little like self-botting depending on the action the user has to do

rocky falcon
jagged briar
#

Fair enough

#

What is the action that causes the dm to be sent

rocky falcon
#

accepting an edit on a message not sent by the user

#

look at the previous conversation I had here, if ya need more info on specifics

teal hound
flint bronze
teal hound
#

uh what does that do again

flint bronze
#

funny things

teal hound
#

i did it

#

i cant tell what happened

flint bronze
#

thats right

#

nothing

#

nothing noticable

flint bronze
#

i will not be held responsible if you get caught cheating

hushed loom
flint bronze
#

what

hushed loom
flint bronze
#

thought so

#

idk what it actually changes though

#

i bombed my snapchat account a few years back

balmy sky
#

I only have snapchat to fuck with my transphobic ex every once in a while

unkempt dove
#

what

#

on

swift delta
vale spear
#

i love maintaining my pr

#

i just fixed an issue where the verification checkmark would be its default color and mismatch with the text when the text color is black

honest stump
#

terrible wording

teal hound
#

i need that stuff dude my classmates are weird

balmy sky
chrome folio
#

does someone know where discord handles what should happen on certain kind of links (like clicking on oauth2 link, that it opens in-app)
or how I can modify a oauth2 modal (which can be opened by any link in the chat)

#

i can't rly find it

hushed loom
#

Also look at always trust

chrome folio
dull magnet
#

what are u trying to do

chrome folio
#

i made the chrome extensions for oauth2 scope rewrites and I essentially want to do the same for vencord now lol

dull magnet
#

look how reviewdb opens oauth modal

#

and you will find the component for it

#

u should be able to just patch it

chrome folio
#

yeah I look at how the cloud integration does it

#

i mean I have probably 3 ways I could do this,

  1. just modify the links in messages of oauth2 urls to remove scopes
  2. make oauth2 links open the plugins' modal, where scopes are removed
  3. mess with the oauth2 modal which discord opens already and remove scopes
chrome folio
#

ok I found this list of oauth2 scopes, how can I use that in a plugin now (sorry never used lazy finding or stuff)

hushed loom
chrome folio
#

ok I thought that it would be a better idea to just use the list discord provides but alright

chrome folio
#

well yes, but I usually use enums if they already exist lol

unkempt hemlock
#

not sure if this is intentional, but clicking on an user profile pic with ViewIcons plugin now opens the profile pic instead of opening the user's profile

rocky falcon
#

isn't that the point of the plugin?

unkempt hemlock
#

specifically, I mean the mini-profile, not the full one

fresh marsh
#

Is there a way to access the live value of another setting (like before hitting save), without having it set a global value onChange?

molten oxide
#

Does anyone know how the SpotifySocket (findByProps("getActiveSocketAndDevice")) work that is used by SpotifyControls?

dull magnet
#

not so vague

#

what is your goal

molten oxide
#

And therfore i think it is necessary to understand how to SpotifySocket works

dull magnet
#

you cant

unkempt hemlock
#

@dull magnet thanks for the plugin! #plugin-news message

suggestion: add option to show avatars after the name (on the right)

dull magnet
#

le css

unkempt hemlock
# dull magnet le css

but it comes from a plugin, so IDK if it's "appropriate" to just tinker with CSS, maybe an option would fit more naturally?

stoic seal
#

I was working on a plugin, went to build it and got this error:


X [ERROR] Could not resolve "react"

    src/plugins/profanityFilter/index.tsx:10:69:
      10 │ import React, { createElement, ReactNode, useEffect, useState } from "react";
         ╵                                                                      ~~~~~~~

  You can mark the path "react" as external to exclude it from the bundle, which will remove this
  error.

am I stupid or somthing?

chrome elbow
stoic seal
hoary pilot
#

might help you too

flint bronze
#

adding a thing to ThemeAttributes, does anyone need any other ways to detect things that can't be (easily) detected with pure CSS

#

i'm injecting into the classes here

molten oxide
# dull magnet you cant

Wait what do you mean with that.
That i cant understand how that works or to create a modified version for ytm

amber basin
#

spotifysocket is built into discord

#

youd have to make your own inhouse version for ytm

#

and i dont know if their apis allow controling the player

frosty otter
flint bronze
molten oxide
flint bronze
#

my opinion is you should be using system apis

#

it's been requested and suggested before

frosty otter
#

git submodule abuser

flint bronze
frosty otter
#

still use the normal client most of the time

#

but it is still useful

flint bronze
#

interesting

frosty otter
#

but the code is absolute horror

#

like just look at this

flint bronze
#

this is why modern web frameworks exist

frosty otter
flint bronze
#

Web Components would be great if you could preload attributes onto elements before attaching them to the DOM

frosty otter
flint bronze
#

discord should remove FocusRing

flint bronze
#

i think i regret making typingindicators who is typing

#

not because it's a bad feature (it isn't) it's just it makes me feel like I need to write a comment on stuff more than I used to

hushed loom
#

is there any plugin that adds keybinds to discord

amber mantle
#

im sure there were prs but no

tropic ice
hushed loom
tropic ice
#

oh

#

i think i saw somewhere that best practice is to just use listener events?

flint bronze
#

did i cook

#

why does this exist the metadata Literally Isnt Passed To The Server

#

its just sent separately as an analytics event

balmy sky
hushed loom
flint bronze
honest stump