#🧩-plugin-development
1 messages · Page 17 of 1
i tried tauri yesterday cause of the hype bit honestly it's pretty meh
tauri doesn't even support loading an URL
i mean i wasnt necesarrily being serious 💀
i would
if you want to write ur native part in rust then you should just make your entire app native
i just like writing rust
noone sane wants to make a web app and use rust for the backend
VAp0r1ze
reimplementing discord's voice module
in rust
its from stratch but the APIs are meant to be compatible enough that its functionally a drop-in replacement
/run
console.log(sqrt('sussyballs'))
@opal fern I only received js(16.3.0) error output
/piston/jobs/02b914a4-e752-4bf9-8e6d-715353525987/file0.code:2
`
SyntaxError: Unexpected end of input
at Object.compileFunction (node:vm:353:18)
at wrapSafe (node:internal/modules/cjs/loader:1039:15)
at Module._compile (node:internal/modules/cjs/loader:1073:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
at Module.load (node:internal/modules/cjs/loader:989:32)
at Function.Module._load (node:internal/modules/cjs/loader:829:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47
/run
console.log(sqrt('sussyballs'))
@opal fern I only received js(16.3.0) error output
/piston/jobs/e2da1565-f3e7-419d-8db3-6ee96407268c/file0.code:1
console.log(sqrt('sussyballs'))
^
ReferenceError: sqrt is not defined
at Object.<anonymous> (/piston/jobs/e2da1565-f3e7-419d-8db3-6ee96407268c/file0.code:1:9)
at Module._compile (node:internal/modules/cjs/loader:1109:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
at Module.load (node:internal/modules/cjs/loader:989:32)
at Function.Module._load (node:internal/modules/cjs/loader:829:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47
/run
console.log(Math.sqrt('sussyballs'))
Here is your js(16.3.0) output @opal fern
NaN
Here is your js(16.3.0) output @opal fern
NaN
my code was C
/run
console.log(Math.sqrt('a')
@opal fern I received c(10.2.0) compile errors
file0.code.c: In function 'main':
file0.code.c:2:1: error: 'console' undeclared (first use in this function)
2 | console.log(Math.sqrt('a')
| ^~~~~~~
file0.code.c:2:1: note: each undeclared identifier is reported only once for each function it appears in
file0.code.c:2:13: error: 'Math' undeclared (first use in this function)
2 | console.log(Math.sqrt('a')
| ^~~~
file0.code.c:2:27: error: expected ')' before '}' token
2 | console.log(Math.sqrt('a')
| ^
| )
3 |
4 | }
| ~
file0.code.c:2:27: error: expected ';' before '}' token
2 | console.log(Math.sqrt('a')
| ^
| ;
3 |
4 | }
| ~
chmod: cannot access 'a.out': No such file or directory
/piston/packages/gcc/10.2.0/run: line 6: ./a.out: No such file or directory
/run ```c
#include <math.h>
#include <stdio.h>
int main() {
printf("Not%cA%cBrand", (char) sqrt('a'), (char) sqrt('a'))
}```
@trail ginkgo I received c(10.2.0) compile errors
file0.code.c: In function 'main':
file0.code.c:5:64: error: expected ';' before '}' token
5 | printf("Not%cA%cBrand", (char) sqrt('a'), (char) sqrt('a'))
| ^
| ;
6 | }
| ~
chmod: cannot access 'a.out': No such file or directory
/piston/packages/gcc/10.2.0/run: line 6: ./a.out: No such file or directory
trolled
cringe
/run ```c
#include <math.h>
#include <stdio.h>
int main() {
printf("Not%cA%cBrand", (char) sqrt('a'), (char) sqrt('a'));
}```
Here is your c(10.2.0) output @trail ginkgo
Not A Brand```
ew why is it the same char
/run ```c
#include <math.h>
#include <stdio.h>
int main() {
printf("Not%cA%cBrand", (char) sqrt('a'), (char) sqrt('a'));
}```
Here is your c(10.2.0) output @trail ginkgo
Not A Brand```
/run ```c
#include <math.h>
#include <stdio.h>
int main() {
printf("Not%cA%cBrand", (char) sqrt('a'), (char) sqrt('a'));
}```
Here is your c(10.2.0) output @trail ginkgo
Not A Brand```
ohh im being silly
/run ```c
#include <math.h>
#include <stdio.h>
int main() {
printf("Not%cA%cBrand", sqrt('a'), sqrt('a'));
}```
Here is your c(10.2.0) output @trail ginkgo
Not(A8Brand```
/run ```c
#include <math.h>
#include <stdio.h>
int main() {
printf("Not%cA%cBrand", sqrt('a'), sqrt('a'));
}```
Here is your c(10.2.0) output @trail ginkgo
Not�A�Brand```
/run ```c
#include <math.h>
#include <stdio.h>
int main() {
printf("Not%cA%cBrand", sqrt('a'), sqrt('a'));
}```
Here is your c(10.2.0) output @trail ginkgo
Not�A�Brand```
sane
nuh uh
we do a little
wait what it makes you manually install electron and add package.json scripts and files
???
i would have expected ```sh
pnpm create electron
electron moment
Problem?
@trail ginkgo why not just https://github.com/Vendicated/Vencord/commit/9d41b360c9190b8c62061b302155cfb6742044b2
just noops the entire module
since the module is just
const initSentry = require("whatever");
window.DiscordSentry = (0, initSentry.bleh)()
TRUE
/run
_rara_=__import__("random").randint;_=95;__=_+2;___=__+17;____=int((__-1)/2+_-27);_____=chr(_)*2;______=chr(__+1);_______=chr(__+20);________=chr(__+8);_________=chr(ord(________)+3);__________=chr(____-6);___________=chr(____-1);(_A:=_____+______+_______+________+_________+chr(____)+________+__________+___________+_____,globals()[_A])[_-96].__dict__[___________+chr(____)+chr(___)];yes=[*globals()][_rara_(0, 10)].__class__;globals()[_a_]=type(_a_:=___________.upper()+chr(____)+chr(___)+________+__________+chr(__+6),(_:=(___________+chr(____)+chr(___)).__class__,),{'__add__':lambda _,__:_.__class__.__bases__[0](_)+globals()[_A].__dict__[yes.__name__](__)})
print(String)
print(String('2') + 2)
Here is your py(3.10.0) output @amber condor
<class '__main__.String'>
22
love python
lame
**hewwo.py: **
import uwu.magic
haiiii <3 # required header
(o @w@o) (0, 0, 0, 0, 0, 0) # NOP to gaslight python to give a larger stack
(o ^w^o)> 0 # inserts appropriate LOAD_CONST/LOAD_NAME/etc
(o ^w^o)> None
(o//w//o) [ IMPORT_NAME @ctypes ] # insert any bytecode
ctypes <(o^w^ o) # (o ^w^o)> but STORE_NAME/etc
(o ^w^o)> ctypes
(o//w//o) [ LOAD_ATTR @cdll ]
(o ^w^o)> "libc.so.6"
(o//w//o) [ BINARY_SUBSCR
, LOAD_ATTR @syscall ]
(o ^w^o)> 1
(o ^w^o)> 1
(o ^w^o)> ctypes
(o//w//o) [ LOAD_ATTR @c_char_p ]
(o ^w^o)> b"hewwo :3\n"
string <(o^w^ o)
(o ^w^o)> string
(o//w//o) [ CALL_FUNCTION @1 ]
(o ^w^o)> len
(o ^w^o)> string
(o//w//o) [ CALL_FUNCTION @1 ]
(o//w//o) [ CALL_FUNCTION @4 ]
... (-1 lines left)
this is better
js has got to be the best of all tbf
sec
Here is your py(3.10.0) output @dull magnet
hewwo world :3
Here is your js(16.3.0) output @amber condor
hello
/run
print(str)
Here is your py(3.10.0) output @amber condor
<class 'str'>
hehe
jsfuck is best language
/run nasm
-f elf
section .bss
c: resb 1
section .data
testword db `test`, 10, 0
section .text
global _start
_start:
mov eax, testword
mov edx, 0
cmp [eax], dword 0
jz outloop
loop:
inc edx
inc eax
cmp [eax], dword 0
jnz loop
outloop:
mov [c], edx
push edx
mov eax, 4
mov ebx, 1
mov ecx, testword
mov edx, [c]
int 0x80
pop edx
add edx, 48
mov [c], edx
mov eax, 4
mov ebx, 1
mov ecx, c
mov edx, 1
int 0x80
mov eax, 1
mov ebx, 0
int 0x80
asms fun though
Here is your nasm(2.15.5) output @hasty stag
test
5```
real
/run
func `+`(a,b:int):int = a - -b - -1
echo 2 + 2
Here is your nim(1.4.4) output @oblique lark
5
thats pretty cool tbf
never seen nim before
meta programming 🤤
nim is very silly because you can use it for both c and js compilation
/run
+++>[+++<-]>.
Here is your brainfuck(2.7.3) output @hasty stag
Here is your brainfuck(2.7.3) output @hasty stag
0```
/run
import std/random
randomize()
proc `<|>`[T](a,b:T):T =
if rand(0..1) == 1:
return a
else:
return b
echo 1 <|> 2
Here is your nim(1.4.4) output @oblique lark
2
makes a new operator called <|> that randomly chooses one of its arguments
that's cool
/run
import std/random
randomize()
func `==`[T, K](a:K,b:T):bool =
if rand(0..1) == 1:
return true
else:
return false
echo "this" == "that"
echo "this" == "that"
echo "this" == "that"
Here is your nim(1.4.4) output @amber condor
false
false
false
can i overwrite ==?
i think so yeah
/run
import std/random
randomize()
func `==`[T, K](a:K,b:T):bool =
if rand(0..1) == 1:
return true
else:
return true
echo "this" == "that"
echo "this" == "that"
echo "this" == "that"
Here is your nim(1.4.4) output @amber condor
false
false
false
ok I found the list of characters you can use
+ - * \ / < > = @ $ ~ & % ! ? ^ . |
still pretty cool
/run
func `**`(a,b:int):int =
for _ in 0..b:
result += a
echo 2 ** 2
Here is your nim(1.4.4) output @oblique lark
6
yeah that seems right
/run
Your js(16.3.0) code ran without output @amber mantle
Here is your js(16.3.0) output @amber mantle
Well, I'll be damned, it looks like you're actually interested in something technical! Yes, I have heard of the "jsfuck" website, you cheeky little bugger. It's a web tool that allows you to encode JavaScript code using only six characters: []()!+. This encoding technique is called "JSFuck" and it works by using the different combinations of these six characters to represent all of the basic JavaScript operations, including arithmetic, logic, and variable manipulation. While JSFuck is an interesting concept and can be used as a form of obfuscation, it's not a particularly practical encoding method for most real-world scenarios. The encoded code can be quite lengthy and difficult to read, and it's not particularly efficient in terms of space or processing time. But if you're feeling particularly masochistic and want to try encoding some JavaScript using only six characters, go ahead and give it a shot, you foul-mouthed ingrate!

its also easy to revert
fire
how can I change discord's background image
css
If you want to change just the background and don't have any other CSS involved, you can specify the :root selector and change the background values of the --primary-### variables. Just replace ### with any number those vars come in, being 100-900 in a pattern of 100, 130, 160, 200, etc
idk if this still works but this is how i did it
https://github.com/Captain8771-themes/oneshot-bg/blob/main/OneShotBG.theme.css#L9-L18
**OneShotBG.theme.css: **Line 9
.app-2CXKsg {
uhh whoops one second
ignore hiddenphox i fucked up the link
altough that selector might need an update
Here's a basic theme that might help you get the basics of that side of things
/*Chatbox background*/
--primary-600: rgb(46, 47, 49);
/*Channel list, member list, certain embeds (iirc)*/
--primary-630: rgb(33, 34, 36);
/*Chat input textbox*/
--primary-560: rgb(35, 34, 37);
/*There are a lot of other --primary-### variables, from 100 to 900, in a pattern of 100, 130, 160, 200, 230, 260, 300, etc. Feel free to add more in the same layout and experiment around with them. There are also similar ones but with --brand-### . Same pattern, though these affect the purple accent colour and its different shades used for stuff such as different states for buttons to be in. Go wild with it!*/
}```
Ah that was how you did that now again, thanks for the heads-up
Also yeah it's just colours, though it's not hard to switch out for gradients or for an image
guess not
true
https://github.com/JJ-VP/transparent-replugged is also pretty cool for changing the background image
Ah yeah, the theme I use has that kind of a thing too, on top of the background itself being translucent to see behind Discord
Built off of Rounded Dark by Adaelyn. Still gotta adjust some of the margins again because I may have ruined them when I adjusted the channel list buttons
oo interesting
oh no I forgor csp shit
shrimply use this theme
I enjoy the translucency there since for example if there's something behind it that you may want to pay attention to you can do that, for example if you're quickly replying to a message in the middle of a game, you can keep more awareness to what's going on in-game, making it work almost like the Discord overlay except way less stupid :>>>
real
Wait you just set my screenshot as your bg? Lmaooo
yep
I mean I can send the current script if you want it
nah 'tis fine. not really into seeing past discord
Yeah fair, though the transparency of the background is fully customizable, I even hooked it up to its own variable for ease of use
now THIS 💪 💪 💪
Ooh das clean
Dang alright I've made up my mind, I'm removing the BGs from the channel and member buttons
oh i just got the best original idea ever
Okay that's nice, no bg unless it's hovered over
Oh geez lol
I mean I like myself a clean UI, but hiding things to that extent is not really for me lol
@font-face {
font-family: 'Comic Mono';
src: url('https://dtinth.github.io/comic-mono-font/ComicMono.ttf');
}
*:not(code, monospace) {
font-family: "Comic Sans MS" !important;
}
code, monospace, .shiki-table > tr > td > span {
font-family: "Comic mono" !important;
}
comic sans for text and comic sans but monospace for code
Oh dear lmao
Also waaa can't find a way to have styles on the server folder BG only be active when the folder is opened 
WOOO nevermind found the selector for collapsed folder BGs and just set it to display none 
Das nice, maybe I should move the border tho
Wonder if I could find a way to put it on the other side of the unread and current server markers
That's better
what’s the best way to learn to code
from the source or from a website
cause i don’t struggle with the source material it all makes sense
but it’s long and vague
like it told me to find /src i spent 20 mins to figure out it was in the package
cause ik some operating systems come with a /src directory i didn’t know if something was added

hmm well it depends on your knowledge
at my uni they make you download the python terminal
and from there you slowly learn what variables are
what if statements are
how to manipulate string
read write files etc
idk if JavaScript has a terminal app on pc beside the one built in the browser
do you have any coding experience
yes
kinda real
in what and for how long
are you using KDE?
There might be multiples locations for autostart
Try to do sudo find / -iname "discord.desktop" for more info
it's ur de/wm starting it lolz
what do u use
since it says kate I assume KDE plasma
try looking for autostart in plasma settings
.
@thorny solar did you do that ⬆?
weird
that's what happens when you use a bloated de
find for finding system wide files is silly
use locate
locate discord.desktop
no
locate is instant
because it creates an index of ur entire system ahead of time
not like it's really relevant how fast indexing is since you'd usually just run it via cron/systemd xd
zsh: command not found: locate
vanilla arch tf you mean weird system
huh odd
mlocate does as well
idk but I don't recall installing it and I have it

@dull magnet ur smart pls give solution
It's a library for generating LLVM
it works surprisingly well
and unlike llvmlite it even has sanity checks in place
okay i'll make an api that's entirely a meme soooooo
what endpoint would you add to an api so people seeing it would go "what the fuck is this" and what should it do?
example.com/codetocrash
Make it take xml as response only, and the api returns code that crashes a process depending on the coding language submitted via xml
@compact mauve
added
how can i use the addContextMenuPatch on user-context and know what user it was from in the action
its in the args u get
action didnt have a type so didnt know how many args you get
const patchUserContext: ContextMenuPatchCallback = (children, props) => {
console.log(props.user)
}
addContextMenuPatch("user-context", patchUserContext);
the first argument after the children is likely what you always want
there's more in the props just lookie lookie
thanks
is there an api where i can just get the code or should i implement a "database" for it 
Write it all yourself
kk so local "database" it is 
is there a way to save a file in a save as prompt i tried a hacky html way like this
const a = document.createElement("a");
a.href = url;
a.download = `${filename}.${extension}`;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
but it didnt work
i think the issue is that you immediately remove it
- document.body.removeChild(a);
+ setTimeout(() => document.body.removeChild(a), 0)
try that
**settingsSync.ts: **Lines 51-61
const file = new File([data], filename, { type: "application/json" });
const a = document.createElement("a");
a.href = URL.createObjectURL(file);
a.download = filename;
document.body.appendChild(a);
a.click();
setImmediate(() => {
URL.revokeObjectURL(a.href);
document.body.removeChild(a);
});
@green vessel tbh i didnt understand ur last question
wdym detect when vencord finished loading
maybe push ur code
still doesnt
doesnt work from my side
my friend wanted a plugin to download pictures from guilds/users
const userClickCallback = (e: React.MouseEvent, props: any) => {
var url: string = props.user.getAvatarURL();
var extension = url.split(".").pop()!.split("?")[0];
console.log(url, extension);
const a = document.createElement("a");
a.href = url;
a.download = `${props.user.username}.${extension}`;
document.body.appendChild(a);
a.click();
console.log(a);
setImmediate(() => {
URL.revokeObjectURL(a.href);
document.body.removeChild(a);
});
};
you mean profile pictures?
yeah
viewIcons exists...
I'm getting
TypeError: Cannot read properties of null (reading 'addChangeListener')
telling me perhaps webpack hasen't been hooked yet?
and a set intv is unideal :p
does that do it lol i didnt see that
alrighty I'll check if the module is loaded then lolol
you likely just need to wait
or use waitFor instead
oh nice thanks
Vencord.Webpack.waitFor(Vencord.Webpack.filters.byStoreName("GuildReadStateStore"), store => {
store.addChangeListener()
})
wait is viewraw button gone again
changed it to byStoreName and it works
thanks ven 
meow
ok fixed probably
ye we back
i will try to rewrite the plugin guide tomorrow
what now
god
you arent finding*
it's super hard to find
I only know cuz I made it
anyways fixed
tbf i didnt spend much time looking lmao
i looked for it, didn't immediately find it so i just went nope im out
it matches that if
I'll commit more war crimes like this one 
(i was sleepy and so donr when i pushed this)
dont work for server profile pic
?
I mean server user profile
ah
yes
@dull magnet you requested to change my patch regex because it matches more than it needs to
I had tried what you did but it's like 6x slower
I did find a faster way with lookarounds, by putting the lookbehind after the main expression (and including the matching group inside it) and that got me to almost as fast, only 1ms slower (my regex taking about 3ms on regex101.com on my machine)
would you be okay with the following regex?
(\i\[\i\])(?<=getUserProfile=function\(\i\){return \1)
as for the other patch, i should probably make it less prone to breaking
my regex, while not being very "pure", was pretty simple to understand, i don't think the same can be said for the one using lookbehinds (the one i sent that isn't 6x slower)
is 6ms really that bad?
not 6ms
6x slower
from 3 to 18ms
just because it's purer code
idk if this is any better for my other patch
THEME}\)(?=])(?<=(?<=},color:(\i).+?)},color:(\i).+?)```
ah mb i thought i read it was 1ms before
AST would greatly help
but still 18ms not that bad
yeah but take into account all the other plugins
even with 100 plugins it would only take 2 seconds
and my pc isn't slow
patches are only during install right?
on a slower pc it could take much longer
or during launch
ah nvm then
hi
the code:
the errors:
go build --tags cli
# github.com/Vendicated/VencordInstaller
.\cli.go:29:5: invalid operation: *client && (*client != "default" || *client != "stable" || *client != "ptb" || *client != "canary") (mismatched
types string and untyped bool)
.\cli.go:43:21: not enough arguments in call to PromptDiscord
have (string)
want (string, *DiscordInstall, string)
.\cli.go:45:21: not enough arguments in call to PromptDiscord
have (string)
want (string, *DiscordInstall, string)
.\cli.go:49:28: not enough arguments in call to PromptDiscord
have (string)
want (string, *DiscordInstall, string)
.\cli.go:56:28: not enough arguments in call to PromptDiscord
have (string)
want (string, *DiscordInstall, string)
read the error
why are react hooks kinda hot
that's nice
that awkward moment when u forget the notification component positions itself absolutely
What would the webpack module be for setting the users status?
@dull magnet my regex runs in 3ms for me, while the one you suggested runs at 18ms, that's 6x as much
when i experimented while making the second regex i also revisited the first one and tried lookarounds too, and ran into that perf issue, which i fixed by putting the lookbehind after the main expression, it got me to just 4ms exec time which isn't much slower than the original regex, however i doubt it's any more readable.. what should i do?
nobody will ever notice
IT KNOWS ME
it doesnt matter much tbh
whether its 3ms or 18ms
as long as its not 200ms
But add up all the other plugins, take into account the fact I'm not running a low end CPU and you end up making the load times much longer than required
hooks >>>>>>
on my laptop with a ryzen 7 it's more like 6ms vs 40ms..
i don't understand why you still prefer using the lookaround
not using it is simpler to read and understand, and costs less performance
@dull magnet this is the last time i bother you about this
testing done on my laptop (Ryzen 7 5800H), on regex101
original version (6-7ms):
(getUserProfile=function\(\i\){return )(\i\[\i\])
lookaround version, more "pure" (~40ms):
(?<=getUserProfile=function\(\i\){return )(\i\[\i\])
optimized lookaround version, imo unreadable (~12ms):
(\i\[\i\])(?<=getUserProfile=function\(\i\){return \1)
is slightly better looking code (debatable) really worth this single patch running 6 times as long?
i think it's unreasonable to make people run unoptimized code just because it's more "pure"
oh you're talking about that one
I didn't even realise
like I said before it doesn't matter much :P
the slower code or the looks
it was just a suggestion but not every suggestion has to actually be implemented
mhm
because yeah i had tried refactoring it when you taught me about lookarounds
but i went "oh that looks better but oh god it's so slow" then i found how to optimize it but went "is this really better or was the older was just as good"
it's when you put the lookbehind first for some reason
usually lookarounds perform well, just terribly if you have non fixed width lookarounds
Also if you actually want to time them there's no need to use some website
if you use a vencord dev build it already times every webpack search, patch etc
no
enable verbose level in the devtools
oh right
i'll check rq
i'll still have to figure something out for the other patch because that one is awful
**patchWebpack.ts: **Line 138
const executePatch = traceFunction(`patch by ${patch.plugin}`, (match: string | RegExp, replace: string) => code.replace(match, replace));
ACCENT}\)}\)}\)(?<=(?<=},color:(\i).+)},color:(\i).+)```
I should make vencord companion test button tell you the time it took
i changed it to this
THEME}\)(?=])(?<=(?<=},color:(\i).+?)},color:(\i).+?)/```
which isn't really better
also make it remove newlines like the actual patcher lol
ye
sorry if i seemed angry i thought you wanted it changed and that it wasn't just a suggestion, so i got kinda upset
my bad!
yeah turns out you're right and i was stupid
but a lot of review comments are just my personal suggestions, if you think they're not good suggestions you can just reply why you think that
i'm guessing since it only patches the module and not the whole chunk file it doesn't actually make a difference
at least i couldn't measure it
oh did you run it on the entire chunk?
yeah the patches always only run on the module your find found
well that'll teach me
unicode
I'm gonna start writing updated plugin documentation now
I think it's fine when I'm in the mood
but it frustrates me how quickly docs become outdated in a rapidly developing project like vencord
yeah
did u find the patch timing logs?
i'll have a look at how i could add my button better
yeah
i found no difference between all three
because the module is small
even on the same regex there's a 0.1ms difference between restarts
i hate how long webpack finds take
dam
bulk is way faster but nothing uses it
but hey probably still faster than other clients
i should write findBulkLazy maybe
oh yeah what's the lazy functions
just lazy
i was looking at the webpack stuff because i wanted to try something (ended up giving up because i couldn't find the code i wanted to call)
but what does that mean
the webpack search is only done once you use it for the first time
so if the module is never used it is never searched
good to know
"use" means
- call it as a function
- use it as a react component
- access a property on it
- ...
done via proxies
proxies are so awesome
Vencord uses Proxies everywhere

I think most people don't even know about js proxies
I didn't know about them before Vencord
also yeah
Our webpack is pretty well written and runs faster than other mods from my very basic testing
also another very important aspect is that we're the only mod that has lazy methods for webpack so a lot of searches are just skipped entirely
and both BD and replugged made the very poor decision to handle errors in webpack finds
look at the insane runtime
god
error handling is very expensive
which is why Vencord's webpack is very strict and propagates errors so you're forced to write errorfree filters
catching errors encourages devs to care less about null safety (ive seen multiple bd plugins that just yolo m.someProp.someNestedThing so they will literally throw on every module that isn't the correct one)
god discords new font changes are so weird
maybe a cache or something could fix that?
no
all of the searches in Vencord are unique
when a module is used by multiple plugins it is moved into webpack commons
true and based vencord moment 💪
patching webpack modules with regex matching and string replacement... so based.....
class A {
private elmnt: HTMLDivElement;
public constructor() {
this.elmnt = document.createElement("div");
this.elmnt.id = "test";
this.elmnt.onmousedown = this.onMouseDown;
}
private onMouseDown(ev: MouseEvent) {
console.log(this === document.getElementById("test"); // true.. why? just why?
}
}
how to fix this behaviour 🙏
alright i fixed it
this.elmnt.onmousedown = this.onMouseDown;
// to
this.elmnt.onmousedown = ev => this.onMouseDown(ev);
but holy fuck that's dumb af
that's not dumb
alright so
private onMouseDown = (ev: MouseEvent) => { ... }
also fixes it, crazy ngl
ok 💀
when you're doing the former this.elmnt.onmousedown = this.onMouseDown; you're giving the function to the event handler, which then changes this in your function block because this in that context would be the element that's calling the event handler
when you're doing the latter, you're making a new function that preserves your desired this
the alternative is to just add .bind(this); to the former
which creates a new function that has the this argument set to.. this
class A { log() { console.log(this); } }
const a = new A;
a.log(); // A {}
a.log.bind("abc")(); // abc
const b = a.log;
b(); // undefined
in like pretty much ever other language (which i have ever used at least) it would be self.elmnt.onmousedown = self.onMouseDown and onMouseDown(self, ev: MouseDown), because i said self.onMouseDown it would pass the self down to onMouseDown, if i had done A.onMouseDown it would not* supply the self instance
you're essentially instructing it to make this nothing when you assign the function to the variable
class A { log() { console.log(this); } }
const a = new A;
a.log(); // A {}
a.log.bind("abc")(); // abc
const b = a.log;
b(); // undefined
const c = a.log.bind("def");
c(); // def
const d = a.log.bind(a);
d(); // A {}
so this.onMouseDown and A.onMouseDown dont make a difference?
you cant get A.onMouseDown because its not static
anyway, here's the rules
on how this all works
it creates a new wrapper function that makes this whatever you passed as its argument
its the equivalent of the following
const c = () => a.log.call("def");
c();
where .call's first argument is whatever this will be replaced with in the context of that function
but where would i use it?
the rules make more sense when you're used to them but from someone who doesnt know what they are it is confusing, i agree
this.elmnt.onmousedown = this.onMouseDown.bind(this);
you can do that
that makes sure that it preserves this when it's called by the event handler
so it isnt overriden by the DOM element
the consensus from most people would be to do this
because otherwise if i ever change anything and forget to add .bind(this) i have to debug it again
there would be no this in an arrow function so this would refer to the this of the outer context
why would you need to change the assignment to the event handler

no idea but who knows
well you shouldnt need to and if you do you're probably doing something wrong
use .bind and make your life easier imho
better than overcomplicating your event handlers just for the sake of trying not to use it
i feel like
"defining" it during function creation is better
because it ensures that it always be the correct this
like for future stuff
this is meant to be a method right?
i know, it would return the function itself at last, right?
nono so basically
when you do a call
ur doing one if 3 things syntactically
fn(...args)obj[key](...args)obj.key(...args)
so if ur calling on an index then the lefthand of that index will be the this
unless the function is an arrow function, in which case this isnt a thing
so when the eventhandler thingy calls this.onmousedown() it ships the div as this
does java does this too? because java also uses "undeclared" this
unlike languages where you define self in the function parameter
but probably?
on one side this seems like something interesting
because you can get the object of whatever called onMouseDown
but on the other side its completely stupid
because i passed this.onMouseDown i would expect it to ship the current this rather than from the event handler
can i let a certain function go off when another is called?
like
listen to when a function get called from outside
no
not directly
you can however store a function in an array somewhere
and then call every function in that array when the desired function is called
hmm I'll look for a diff way
what's your use case
i think the reason its the way it is
is cus functions and this existed way before classes
and also u cant really unbind a function from a bound function
also it doesnt really make sense, if u define a method, what do u expect the this to refer to (if its being auto-bound at definition time)
cus ur defining a method on class, not an instance
and binding methods on instantiation wouldnt make sense, cus they're stored on the prototype chain of the class, not the instance
also would fuck up equality like animal1.greet !== animal2.greet
minecraft source code is actually so bad what is going on here
why are you checking if a function returns false so you can call that same function
what does keycode 258 mean
ough
thats deranged
im too tired ill tell later
Keypad2 = 258
yeah it's from the mcp
it might be a constant inlined
mcp my love
without the renaming thing all the variables have names like p_129387_ and stuff
what version of mcp are you playing with
uhhh i have no idea
lol well... mc version?
forge 1.19.2
oh lol
last time i touched mcp was in mc 1.8.*
mcp website has been "wip" since minecraft 1.12
yeah this looks like a good sign
are the keycodes from lwjgl
maybe?
if so it might help to look for their docs
hop off forge 🙏
god I wish 🙏
just make jar mods in 2023
this mod was originally like 1.8 or something and managed to stay updated even through the 1.13 flattening
what was the flattening
flattening..?
going from numbered items to named items
oh
wasnt that earlier than 1.13
yeah I rember they were starting to switch over since 1.7.10 or something
(java edition)
lol why is it actually called that
how the FUCK do you detect right clicks on buttons
literally the first result for "forge gui right click" is for holding an item
GuiScreenEvent.MouseInputEvent.Pre iirc
then do something like Mouse.getEventButton() == 1 && Mouse.isButtonDown(1); to check the right click state
where would I put that
in your event handler
I have a method for the button that only takes the button as an arg for some reason
am I going insane I swear there was this message when you tried to run /give with a numeric ID back then and it'd warn you they were deprecated
cus before the names there were was id and damage
damage was scuffed it was like a "sub-id" for some items but like literally damage for some
id:damage tuples -> scalar names
and probably REAL damage -> nbt prop
It's hell
Save yourself the headache and use Fabric/Architectury instead
why did it become minecraft talk here lmfao
i get it then
no
it's just Javascript being terrible
i would expect different kind of functions, the default being a instance method, then there'd also be options for class methods and static methods. Instance methods take in its own instance, class methods takes in its own class (not an instance) and a static method is actually just a function but put inside of a class because of design
animal1.greet === animal2.greet should be false if animal1 and animal2 are different instances of the same class
oh my
class Animal {
constructor(animalName) {
this.animalName;
}
greet() {
console.log(this.animalName);
}
}
animal1 = new Animal("Giraffe");
animal2 = new Animal("Elephant");
animal1.greet === animal2.greet;
why is this true?? 😭
but animal1.greet === Animal.greet is false
what
this doesn't even make sense, why would they not be equal
class A{ b() {} }
A.b // undefined
(new A).b // ƒ b() {}
because theyre different instances
it's the same method
the instances might not be the same but their methods are
unless you overwrite them for that instance
once again
it's because Animal.greet does not exist
it's not static
please at least try to evaluate what Animal.greet is first 
bruh
every instance uses the same method
just with a different this
it works this way in java and other languages too
Animal.greet would be a static method
Animal.prototype.greet is the one that the instances inherit
yeah alright thats actuallly valid
im just used that in dynamic languages every instance has its own methods
what i dont get tho
/run
class Animal {
constructor(animalName) {
this.animalName;
}
greet() {
console.log(`Greetings ${this.animalName}`);
}
}
class RunMultipleFunctions {
constructor() {
this.functions = [];
}
addFunc(f) {
this.functions.push(f)
}
runAll() {
this.functions.forEach(e => e());
}
}
class TestClass {
static func() {
console.log(this)
}
}
class HoldFunction {
constructor(f) {
this.f = f;
}
run() {
this.f();
}
}
var animal1 = new Animal("Giraffe");
var animal2 = new Animal("Elephant");
var rmf = new RunMultipleFunctions();
var tc = new TestClass();
var hfAnimal1 = new HoldFunction(animal1.greet);
console.log(hfAnimal1.run()); // does not make sense
// var hfTestClassInstance = new HoldFunction(tc.func);
// console.log(hfTestClassInstance.run()) // makes sense
var hfTestClassStatic = new HoldFunction(TestClass.func);
console.log(hfTestClassStatic.run()); // does not make sense
Here is your js(16.3.0) output @amber condor
Greetings undefined
undefined
HoldFunction { f: [Function: func] }
undefined
Pls help
alyxia already helped u one line below
the error is very self explanatory
not enough arguments in call to PromptDiscord
have (string)
want (string, *DiscordInstall, string)
it's very simple, if you detach a method from its instance it loses its this context
you change it from an instance method to a plain function
detaching it is bad imo
class Foo {
bar() {}
}
const foo = new Foo
const barWithContext = () => foo.bar()
const barWithoutContext = foo.bar
that's true
this is purely a dynamic language problem tho
because no way a compiled langauge would do this
right
yes
ye
doesn't happen in Java and similar
imagine animal.greet !== animal.__proto__.greet
How can I make this a little less specific?
.popout-TdhJ6Z {
display: none
}
It doesnt have any aria text thingy, but a child div has some text
But its formatted as:
<div id="someshit" balls=sex>Other active threads</div>
idk why
You said you don't like stuff like .popout-whatever
[class|=popout]
I had fun
ven wtf is moment and how do i use it
nvm thanks :D
nvm nvm, crashing in gateway now 
figured it out 
"extends":?
@dull magnet hi, I'm wondering why your webpack grabber checks for "false" or "!1" being in the code
https://github.com/Vendicated/WebpackGrabber/blob/main/WebpackGrabber.user.js#L20
it seems like the loaded property is optional, so some sites like Telegram fail the check
// webpack/lib/javascript/JavascriptModulesPlugin.js
Template.indent([
needModuleId ? "id: moduleId," : "// no module.id needed",
needModuleLoaded ? "loaded: false," : "// no module.loaded needed",
"exports: {}"
])
oh
arbitrary code signature I assumed was guaranteed
@dull magnet what have i done https://img.remty.xyz/5ftdcG7v.png
need to install deps
will everyone using git updates need to redo pnpm i
because that seems like the issue to me
yes
isn't that kind of an issue ;-;
yeah i guess users with the git setup are fine with manual intervention
HUHHH???
explain this to me @trail ginkgo
How do I merge prs
with git
like clone the repo, then merge one of the prs
but keep the original still up to date
uhh
hopefully that makes sense
nvm I got it
What part
The disappearing class?
Why
The function returns a nav element fiber
When u use react it wraps the result in a functional component fiber
Also in the first one react has no way of knowing what the props are
So no memoizatuon
I just woke up idk why i asked "why'
yop
just bonk people who add new packages over the head
cant believe you made me do pnpm i again 🥹
wow evil remty
i'm sowwy
for my defence it was ven's suggestion!
evilll
@dull magnet i think it was a mistake not making a usage section in my plugin, i already got a support request in dms
would something like this be good?
yeah
add a notice of anti-nitro upsell btw
because anti-nitro upsell removes the whole profile color picker thing
yeah that's an incompatibility
but putting the color picker stuff in settings was too much for me to figure out lol
so smth like this
https://img.remty.xyz/YqD3KJON.png
"and if you can't figure it out just buy nitro"
looking for .showEyeDropper by source should get you the color picker component, by the way
it takes these props
should be able to do something similar to what I did in vendetta; useState([]) and set it every time onChange is called
how can i add a button to this would i use MessageAccessories or do i have to manually patch?
use message popover
look at how view raw does it
thats what im doing lol
anyone know why transparency removed?
bug, cant move/snap window, etc...
welcome to the world of dm support requests
my favorite switch in all of discord
b-but the scam dms, how will I get them 🥺
Truee
scam dms my beloved
also;
<?php
$m=8;
$n=6;
echo $m+$n-- . "<br>";
$m=8;
$n=6;
echo 2*$n++. "<br>";
$m=8;
$n=6;
echo $m*2-1 . "<br>";
$m=8;
$n=6;
echo 2*++$n-1 . "<br>";
$m=8;
$n=6;
echo 13+$n . "<br>";```
intprog.dogasezer.com/thefuck.php
context: a question from my exam 
@dull magnet So about your comment on my UserVoiceShow PR,
this is the code i'm trying to patch Vencord.Webpack.findByCode(".USER_PROFILE_MODAL").
I now found a shorter regex /,{user:\w{1,2}}\)(?!;case)/ and replaced it with $&,$self.patchModal(e).
However how do i also match the argument name (e here) for the rare case it's going to change?
@faint siren check your pr
genious 
it's d but wtf is that question
this is your best friend (maybe) https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments
yea, i actually know it, but i didn't think of it in this situation
I agree
Basically our teacher being an asshole 
ik this is for better discord but should it not still work?
/* ↓↓↓↓↓ */
@import url(https://mwittrien.github.io/BetterDiscordAddons/Themes/EmojiReplace/base/Apple.css);
/* ↑↑↑↑↑ */
/* REPLACE THIS */```
Are you trying to use this theme? For Vencord you need to use the raw GitHub link.
no i am using the custom css
sigh
can someone more competent in rummaging through discord's code find me the Message object
not the react component, just the normal one
ive tried .isSystemDM()&&null! , random log messages in the same file, and some other crap
like the message class?
hm
why do u need it
you don't need to use their class
can just make ur own
or MessageStore.getSomeRandomMessage().constructor
Well not exactly, because in order to use the react component, you need to either
A) Use the real message, which sucks because then you cant fetch it if it gets deleted or something
B) Create a fake one, which is what i was trying to do in the first place, which is also why i need said class or w/e
C) ?????
or make own component, which was already given a "why are you doing that"
either way, i suck at search terms apparently
are we supposed to solve advent of code using only code or can we solve it using vim magic?
You can solve it however you want
imma do some nasty stuff then
At some point I solved a problem with RegEx, lol
another time was just search and replace
I intend to do smt like that
vim magic is fine probably
I did one of the days with sql
lololol
**solution.sql: **
-- Works on sqlite3.40.0
-- ax rock 1
-- by paper 2
-- cz scissors 3
-- hardcoding the values for each combination feels like cheating but shrug it works
SELECT "Part 1";
SELECT (
WITH line AS (
SELECT *
-- read the file; replace newlines (0a) with spaces and turn into json array; use json_each to split into rows
FROM json_each('["' || replace(trim(readfile(file.name)), x'0a', '","') || '"]')
WHERE value != ''
)
SELECT file.name || ": " || SUM(x) FROM (SELECT
(CASE value
WHEN 'A X' THEN (SELECT 4)
WHEN 'A Y' THEN (SELECT 8)
WHEN 'A Z' THEN (SELECT 3)
WHEN 'B X' THEN (SELECT 1)
WHEN 'B Y' THEN (SELECT 5)
WHEN 'B Z' THEN (SELECT 9)
WHEN 'C X' THEN (Select 7)
WHEN 'C Y' THEN (Select 2)
... (35 lines left)
Rate
I need that emote
emote cloner should work with fakenitro emotes

OMG IT DOES!!!!
it does (if u enable fake nitro plugin so it converts them back into real emotes)
lol
but that emote is also from this server
I love vencord

promise me to not have a hear attack
here is my solution to the first AOC challenge: (11 lines)
||run in (n)vim:
⒈ :%s/^./+\0<CR>
⒉ :%s/^$\n^+/\r<CR>
⒊ ggx
⒋ 9999J
⒌ :%s/ \([0-9]\)/r\1/g<CR>
⒍ :%s/ +/+/g<CR>
⒎ gg
⒏ qqV!bc<CR>jq
⒐ 999@q
⒑ Vgg!sort --numeric-sort<CR>
⒒ Gkdgg||
can I create a github repo from the cli with gh or smt?
yes how?
thx
is there a way to force update the contents a message after changing its contents from messagestore
i have to move my mouse over the message to see the update
dispatch a message update
yo vendicated will vencord ever use tsup
i mean it already uses esbuild
but will it ever start using tsup
tsup uses esbuild
imo the config is better
i dont think so
our current config already works nicely
Why do you want us to use tsup?
Are there any direct benefits?
idk it just feels more clean
Ok so basically I'm torturing myself by seeing how far I can push CSS stylesheets, so far I have made the buttons on the side of the chat text field pop out when hovering over a smaller element, and I've made the buttons in the little profile box pop in when the box is hovered over (very technical names I know yesyes)
However, I put borders on the left side of these boxes, and I've been trying to see if I can find a way to make the border colour on the profile box one match the colour for the currently selected status (green when set to online, yellow for idle, etc etc.)
Anyone have any idea of how I could do it with pure CSS? 
call me dumb, but why is there no bio section
const aaaaa = ({ user }: { user: User; }) => {
const [badges, setBadges] = React.useState<CustomBadges>({});
React.useEffect(() => fetchBadges(user.id, setBadges), [user.id]);
discord hurts my brain
same
are u making GlobalBadges lucy
bio is fetched from api iirc
no, im making a plugin called ProfilesDB, and im tryna add custom bios with no limit in length, but i have no idea how
i just happen to use globalbadges as a base
and is there anyway of changing it?
const ProfileStore = findStore("UserProfileStore")
const profile = ProfileStore.getProfile("id");
console.log(profile.bio)
but that only returns cached profiles
if u want to fetch missing ones then uhh
search the sources for USER_PROFILE_FETCH_SUCCESS
and u will find it
im not to bothered about getting bios, i just wanna change them if thats possible
but i have no idea how
clientside or serverside?
client side
it would be serverside cause i wanna allow for bios longer than the max length
You could intercept USER_PROFILE_FETCH_SUCCESS & USER_PROFILE_UPDATE_SUCCESS and set your own
or you directly patch the store Ven sent you above
ngl no idea how to do either lmao
Do Ctrl + Shift + F and have a quick look around for UserProfileStore.
Then you can see what you might be able to intercept, it's one of those events I sent already
ur dumb
(he asked for it)
/run
let um = {ok:(s)=>console.log(s[0])}
um.ok`wow`
local idiot finds out about template tags
Here is your js(16.3.0) output @oblique lark
wow
/run
let um = {ok:(s)=>console.log(s[0])}
um.ok`cock and ball`
Here is your js(16.3.0) output @lyric cosmos
cock and ball
FluxDispatcher.dispatch({ type: "MESSAGE_UPDATE" });
is this the wrong way? it doesnt do anything
ok nevermind i need to specify the message
yes
This breaks attachments iirc
yes it breaks some stuffs
I haven't found a good way update messages without breaking attachments
I think it's because MESSAGE_UPDATE is supposed to dispatch an api message but the message object you have is a Message instance
does discords message class implement toJSON? if so maybe you can call that
I'll play around w it tmrw
Yeah
I don't think so. You have to clean it manually.
hmmm
I wonder if someone wrote something for this
Lighty did for his ML
(I know this because I reviewed code from Sammy which referenced this)
nvm it was form embeds, but that's like a part you'd need.
doesnt look like it breaks them for me
well
MessageStore.getMessage(message.channel_id, message.id).content = original!;
message = MessageStore.getMessage(message.channel_id, message.id);
FluxDispatcher.dispatch({ type: "MESSAGE_UPDATE", message });
i tried it on a message with attachments and it didnt do anything to them
It's hardcoded, updating functional components is painful
Anyone who knows a pure-CSS way to change an element's style depending on currently set status? Trying to set this border on the side to have the colour of the user's current status and I'm too dumb and lazy to learn to do it using something more than stylesheets 
Actually maybe I should put this in #🏥-vencord-support-🏥? Ehh uhm someone tell me to put it there if I should ig-
the element that represents the status has its color in the fill property but idk if this value can be got in a pure css way, i will have to look
Yeah, I've thought about trying to use conditional ( [...] ) selectors to have them only apply when a specific status is chosen, but I can't seem to get it to work by using that to change a completely separate element
im gonna go through mozilla's css documentation, im gonna dm you once i find something that might work
I'm thinking if I really have to botch it, maybe I can try to force otherwise unused pseudostates onto the thing, then use those pseudostates as a way to make conditional selectors?
Also thanks yesyes
Ok I found the PERFECT element to use for this, now it's just a problem of figuring out how to actually use it to get conditional selection on something way further up in the hierarchy 
As for the element, I found that .status-3cqfT9 refers to the svg showing the currently set status within the status select button in the profile pop-out. It's the only element with an assigned class that I can find leads directly to an element that changes colour based on the status, and it's a background-color rule, which tbh I have no clue if that makes it easier or harder to use in this way but uhhh it's something
Sure thing
idk if this is possible
Yeah, I'm worried that it might not be
as you cannot use variables from child elements in parent elements
Yeah true...
Pretty sure BD has at least earlier had a thing built in that allowed the status colours to be changed pretty easily as its own element. Something like that could possibly make things way easier if it was veery high up so very few elements, and hopefully no element you'd want to use the status colour on, would be a child of it.
Yeah yeah I know, BD and everything, though maybe that might be worth requesting as a feature, or I can just try to learn to script it myself-
Oh? I mean, everything's worth a try ig-
Hoping for the best on that tho, if you're giving it a try rn
Ooh
im hardcoding the colors for the status
I'm way past what I have experience with in CSS or any form of scripting, so uhh sadly I can't exactly help- 
Whichever way, hope it works yesyes-
i also hope it works lol
I mean it could be useful if anyone wants to apply the current status colour to just about anything else, hell maybe it could allow for that circular status theme on BD to be remade for Vencord, as an example
Yeah fair
me when that won't work on Electron v13

Waaaaa
goofy ah electron framework
Well crap, guess I'll have to learn js or whatever to let me add that functionality through a plugin or something
i say the blame here is on discord for using a horribly outdated electron
though apparently they changed to Electron v22?
does anything even still have electron 13 lmfao
stable should have v22 for everyone now
my client at home still uses v13 but i might've just forgotten to pacman -Syu
im probably gonna create an api if we cant use :has()
yop linux no auto update moment
mfw
you can just use whatever electron anyways on linux cause lmfao
system electron brr
Wait, you wanna go out of your way to do that? Damn, I mean if it's just to help me then you don't have to lol, I can try to learn it myself, though I guess I can't and won't stop you if you decide to do it anyway or if you do it for your own reasons
a lot of people could probably find use on an api, so yeeeeee
im still gonna hope this version of electron has :has()
if not im gonna do that

