#🧩-plugin-development
1 messages · Page 8 of 1
yeah no worries m8
Has anyone tried implementing this into a vencord plugin yet? https://github.com/edisionnano/Screenshare-with-audio-on-Discord-with-Linux
i think it would work for desktop too
It would
it seems like a fix for all chromium
i just realized how though
because desktop uses mediaengine
while the web discord uses the chrome api
so what if we just trick desktop that its browser
aka the BetterDiscord emulator plugin, but for just screensharing
i mean if u use armcord
I dont want a different client to screenshare
real
That already exist
with vencord able to be installed
because its just a qt app with web discord and patches applied
I dont think you can
as in delete mediaengine
sure u can just find where its export is defined and patch it
yah thats what im trying to do
but iim too stupid to figure it out since the new discord repack shit
i can try
please do
yeye
me when i scroll for 5 years just to find a single letter with a = n(219i320194) next to it
seems about right
looks like its module 149556
that does the determining of if mediaengine should be Native or not
very easy patch
{
find: '.AS.WEBRTC].find',
replacement: {
match: /\[(\w+)\.\AS\.NATIVE,\1\.AS\.WEBRTC\]/,
replace: '[$1.AS.WEBRTC]',
},
}```
@visual berry lmk if that works
Ok well i need someone to help me test
Breaks mics
We need to grant discord the input device permission
lmao
death
os btw
Linux
lit
yea u will probably need to modify the desktop client for this
at which point u might as well use an already made one
hm
This is just electron looking for the chrome permission to use the mic
@trail ginkgo we technically have control over the entire electron app and how its started via the patcher
Ima try and grant the permissions there and see what happens
Vencord
Its weird because this error doesnt happen with the betterdiscord emulator plugin
hi, react devtools shows "Locaing React Element tree........."
ive been waiting for like half an hour
yop
already did
tried standalone rdt, added the script tag, rdt did not show a connection
close ur devtools when u reload discord
wait for discord to fully load
then open devtools and go to react components tab
if that doesn't work then no clue 
'kay
Does vencord not work with electron > 13?
How would i apply that with a custom build?
install with installer, symlink your dist folder to the config folder
or install with installer then go to your discord folder and edit app.asar/index.js to require the correct file
?? wha
@trail ginkgo now i know why its not working
you are patching the wrong thing
you are patching the supported check and not actually making it use webrtc
Błąd
So its trying to use native but since its patched out it claims it to not be supported
Thats why the error is being thrown
wha
Trying to get desktop discord to use webrtc instead of native mediaengine
Because if we can do that then we can make it so linux can have screenshare audio
The patch given changes this:
and removes the NATIVE part
aka NATIVE is now not supported
lmao
I don't think so?
can discord web share with audio
Yes
Yes
on chrome it uses the chrome screenshare thing which supports audio
idk about Firefox
Basically the issue for desktop is this:
However we can force desktop to think its web
and then use the normal webrtc
which then in turn we can use the script provided here to do our patch
which then allows us to use a device called "virtmic" which gets passed into the screenshare audio and not the mic audio
no
damn
discord block getUserMedia in their fork, and getDisplayMedia doesn't exist in Electron
"simple"
pretty simple
no
- it is not that simple
- there are tradeoffs
- pretty sure that's impossible via just a vencord plugin, would need extra shit
- what is the point of desktop at that point
why tf
read what i linked lol!
screenshot versions
electron 20
it doesn't say much?
just says disabled
I'm asking why did they disable it
it does tho
We don't use it and without proper user interaction / consent enforcement it is nothing but a liability.
yeah i know with not discord electron
I dont care if it doesnt work with discord electron
i looked into this like over a year ago lmao
i just want it to work
what navigator func do you need tho
getUserMedia
im working on it for the most part
just confused what you need help with lol
I dont really understand vencord patching
nor knowing how to find and replace exactly what i need
i thought you found what to find and replace
this?
Thats the wrong thing
oh lol
and that was found by @trail ginkgo
i tried patching it like a year ago and gave up soo
Basically that just makes it so it breaks audio and video on discord because it makes NATIVE unsupported
glhf
oh i missed that
http 401
that means the userscript doesn't send a user agent I think
guh why is violentmonkey stupit
Does anyone know how I can potentially stop getting assfucked by this? ik it has something to do with the server itself
Access-Control-Allow-Origin: * if you want to allow all domains
or like Access-Control-Allow-Origin: https://discord.com
The server is not mine***
oh
proxy it with a cloudflare worker or something 
smth like this ig
tell the admin to fix cors
not gonna bother
Went with what megu said, and made a cloudflare worker
JUST DISABLE CORS ON VENCORD ENTIRELY
WHAT DOES IT PREVENT ANYWAY
I disabled cors
can you tell me WHY
if I wanted to make something malicious
couldnt I just add
CORS HEADERS
IN WHICH CASE
it is useful
it's the other way round stupid
it's to protect other sites
if cors weren't a thing I could make iframe to bank.com/payments
and then maybe somehow abuse that
cant they do it right now
it could do everything to other sites
browsers respect CORS for a reason :>
okay so
also in app like discord
it gets all data from discord servers
there are no ads or something
and even if there is since in all browser cors is a thing
you are on example.com
you make a request to paypal.com/api/give/me/your/money
the browser first sends a "preflight" request to get the CORS headers
if the CORS header doesn't allow access to paypal.com from example.com, the browser won't send the actual request
there shouldnt be a ad that is malicious
^
cors prevents random sites to make requests to other sites
if the CORS header does allow example.com, the browser will then send the actual request
although tbh i dont see how any malicous plugin could be added to vencord so it wont be an issue ever
User plugins
that is understandable
but since we are using discord I think we can safely disable that
nop
we are on example.com
meow
nyan
here is a semi working version of a character counter plugin if anyone wants to finish it
the current issue is the counter appears on top of the emoji button if the text box only has a single line (like when empty)
/*
* Vencord, a modification for Discord's desktop app
* Copyright (c) 2022 Vendicated and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
export default definePlugin({
name: "CharacterCounter",
description: "Makes Discord character counter always enabled.",
authors: [Devs.Nuckyz],
patches: [
{
find: ".Messages.CHARACTER_COUNT_OVER_LIMIT",
replacement: {
match: /\.AnalyticsLocationProvider;return.+?\?(.+?).\?null:/,
replace: (_, restOfFunction) => ""
+ `.AnalyticsLocationProvider;return true?${restOfFunction}false?null:`
}
}
],
});
custom banner plugin that
- fetches from USRBG
- allows easy(-er) uploading to USRBG
make it indistinguishable from nitro plugin, maybe only swap the small hover badge from nitro to some other icon
aliucord badge exists, knowing the community a vencord badge is probably happening
yeah just meant the badge
https://github.com/Vendicated/Vencord/pull/234
This do be ready (I think) 
btw if u are destructuring an array u can skip an element
(talking about newpluginsError)
oh
sorry i didnt specify how, it'd be like this [a, , c]
fixed, ty
What's the best way of creating a PR that uses a component added in another, still unmerged, PR? To just use the second PR's branch as a base and create the PR with all commits?
yes
Alright, I'll do that then
u can checkout that pr and then add ur stuff
and wait til their pr is merged, rebase, open yours
oh u did it already
yeah
lol manual co-author

once their pr is merged you can merge master into your branch
and their commits will disappear
why would you make a merge commit from master into your branch when you could just rebase 
don't clear git history when you're updating your branch from main though ;w;
rebasing is a one way operation
you can undo a merge commit with git reset --hard HEAD^
no?
that's correct
but if you have an active main branch you'll have a ton of merge commits into your branch, which makes git history a mess
its better than a destructive operation
But it's fun making git history explod
You love git reset --hard HEAD^1000 && git push -f
You can undo rebase by rebasing somewhere else or resetting to its start using reflog
Rebase is quite powerful even if not a best practice to use in 99.9% cases
Like you can use rebase to unsquash a commit (altho doing it manually and with no trace to commits before the squash, still you get to break up a commit into smaller ones)
(You can use git reset to state before squashing if it happened just now, rebase if happened long ago)
you can just reset back
hoiw
git reflog
oh
so 
is there a way to get the file extension on attachment?
like example.js i just want to get the js part
split(".")
are u doing this on discord
or in some other environment
oh that is probably a better idea
git push origin --delete master
vendy do you mind pinning this
no cause its outdated
fr??
lazyWebpack is kill
Which is better?
Implementation that requires the message obj itself
export function dismissBotMessage(message: Message): boolean {
MessageSender.dismissAutomatedMessage(message);
return true;
}
Implementation that requires the channelId and messageId
export function dismissBotMessageViaId(channelId: string, messageId: string): boolean {
MessageSender.deleteMessage(channelId, messageId, !0);
return true;
}
@dull magnet
idk
are u sure dismiss automated message doesn't just need channel id and message id
dismissAutomatedMessage requires the message component
its really weird
ehh ill just use second implementation
it only needs channel id and id wdym
but it literally just calls deleteMessage lmao
Yeah
Ill use second implementation to cut middle man
idk what to make it return
ill just make it return nothin
@dull magnet am i doing smth wrong?
Uncle
doesn't findByCode find by code?
im confused
ooooh
yeah, i get it now
findByCode doesnt find modules as a whole but their exports (?)
@dull magnet could you check https://github.com/Vendicated/Vencord/pull/234 whenever you have time 
ayaya
tytyty
@dull magnet
hi
MERGEE
@dull magnet dunno if you knew this or not
but you dont need a ref to get the value from a TextArea in the themes tab
you can attach an onInput event listener, and just do event.nativeEvent.target.value
eg
<TextArea
onInput={ event => doSmth(event.nativeEvent.target.value); }
/>
(I'm saying this cause using refs is discouraged by react and you don't use it for anything else other than to get the value on the onBlur event)
ya, the only reason I used it was cause discord did as well
when I looked at their use of that component
what is the onBlur event btw?
when the element is blurred aka loses focus
when you save, if the link is empty it will be removed
but yeah i can add a button
someone asked me for it
I shall tell them ty
do you know if discord has a trash icon anywhere?
hmm, their design system doesnt seem to need one
oh
https://cdn.discordapp.com/emojis/1006671492068675617.webp?size=48&quality=lossless could probably use this
actually no I think they just use a fat button with text
they do have a svg for it on mobile
oh, custom emote
they do
idk if they have on desktop
my reviewdb plugin steals svg from mobile
oh yeah
PS react dev tools no workie for me
or use Google material icon
I have done it more than 20 times, got tired of it
From my testing
I think it usually gets broken if you press F5 on dev tools
To refresh client I mean
Vencord.Webpack.wreq(Vencord.Webpack.findModuleId("M15 3.999V2H9V3.999H3V5.999H21V3.999H15Z")).Z
the delete icon!
now the question is, will the export named Z change or not?
it has been named that way for months now
hmm, i think i remember reading that Z is the default export?
ven hardcodes it
so ig it really is the default export
for anyone that might want the icon:
const DeleteIcon = makeLazy(() => wreq(findModuleId("M15 3.999V2H9V3.999H3V5.999H21V3.999H15Z")!!).Z({ width: 24, height: 24, color: "red", foreground: "red" }));
I wish makeLazy allowed to pass arguments
but oh well
const DeleteIcon = LazyComponent(() => wreq(findModuleId(...));
<DeleteIcon width="24" height="24" color="red" foreground="red" />
there u go
feel free to add arguments to makeLazy if u need it
forgot about it
also should use discords red instead of html red
--color-danger or smth like that
nop
I'll continue this tomorrow, gotta sleep
var vars = Array.from(document.styleSheets)
.flatMap(styleSheet => Array.from(styleSheet.cssRules))
.filter(cssRule => cssRule.selectorText === '.theme-dark' || cssRule.selectorText === ":root")
.flatMap(cssRule => cssRule.cssText.split('{')[1].split('}')[0].trim().split(';'))
.filter(Boolean)
.map(text => text.split(':'))
.map(parts => ({ key: parts[0].trim(), value: parts[1].trim() }))
console.log(vars)
prints most if not all css variables
or including every single colour
var vars = Array.from(document.styleSheets)
.flatMap(styleSheet => Array.from(styleSheet.cssRules))
.filter(cssRule => cssRule.selectorText === '.theme-dark' || cssRule.selectorText === ".theme-custom" || cssRule.selectorText === ":root")
.flatMap(cssRule => cssRule.cssText.split('{')[1].split('}')[0].trim().split(';'))
.filter(Boolean)
.map(text => text.split(':'))
.map(parts => ({ key: parts[0].trim(), value: parts[1].trim() }))
.filter((p, i, arr) => arr.findIndex(x => x.key === p.key) === i)
console.log(vars)
just as feedback:
- centering the file names doesn't look all too good;
- don't center the titles as well and add more margin bottom
- add those thin dark grey lines between each sound yk
- the trashcan maybe white, smaller and only visible if you hover over the sound
my css skills suck
so this may take a lot of refinement to look good
learning makes you a pro
funnily enough, I did not center the titles (if you mean the table headers)
I sucked 1.5 years ago as well, and even more suck now
its not learning, but gaining experience
I already know a lot of about css
A LOT
well yeah
i just suck at using it
I can make good UI, it just takes a huge amount of hours for the small stuff
welp same
I mean I am a web dev and I redesigned the whole site of my bot like 3 times in a month
anyways, gnight
gn
do spotify embeds come from backend???
yes
i hate
i get it because the cache image
iframe
no i mean spotify embeds seem to come from discord backend
is that rn
desktop
wtf
that's an old screenshot
that array is empty
oh
it is
discord silly
oh
it is ok <3
why are embeds just dead rn
i know i HATE
i was gonna be like "oh lets just not rely on discord"
but IT IS BACKEND ?!?!?!?@3TRY
SPOTIFY EMBEDS GET SENT OVER GATEWAY/?!@#54
i will combust
yea
inb4 discord got api banned or smth
because we're abusing their tokens against Spotifys terms
death
if this isnt fixed tomorrow i will do my own embed detection and ignore the discord sent ones
shouldn't be too hard
the best part of discords though
but using discords would be smoother
cause you could just patch their Spotify embeds for 0 overhead
is they provided an image url
i didnt have to do an api request for it
so embeds were themed at render time
maybe not render time but a lot quicker than an api request
what the FUCK
also @dull magnet
i actually need the discord images
because it will cry about tainted canvas
i dont wanna rely on csp
**petpet.ts: **Line 54
img.crossOrigin = "Anonymous";
does that work on user script
erg
oh thats true
why doesn't the Firefox csp bypass work though
firefox hates you
that's really painful cause Firefox bans csp bypass so I'm not sure they will approve the update
I'm surprised they even approved v1.0 that has csp bypass
thankfully I haven't updated Firefox in a while
maybe if I push update that fix csp with big changes to other files they won't notice again
yes
that's how embeds work
First it dispatches message with no embeds
then it dispatches message update with the embeds once it finished building then
real
I think they describe it in the docs somewhere
ok then time to find what part of the logic handles the embed part
cus i dont wanna fire a whole message update
u can just fire a message update
I do that in hide attachments
Well for some reason it broke
it doesn't solve its intended purpose lol so it has no effect
if they don't we can just selfhost it
even on github pages or something
the problem is u need to change the csp to access github pages
is the text alignment ok?
well it’s better
i only asked about the text alignment
this is not the final design, and you arent being helpful
also maybe make the Link an mp3 blue like links, may look better(?)
rn im trying to fix a bug
@dull magnet uhh
what if I want to set the value of a TextArea
but I don't want to use a state
setting the value property makes it not accept any input
what im doing rn
(why am I making a copy? cause I got paranoid)
basically the text is saved properly
but since I dont set the value property, re-opening the settings means that if you click on the text area it will delete the existing (invisible) value
fixed
oh yeah, can't read settings when patching
F
now this is an issue
how great would it be if this just worked
alas
nt
don't do like that
patch the function that gets the sounds
and return custom sound
findByCode finds a function by code
you want findModuleId
but also this should be find(m => m.prototype?.renderAudioMetadata)
NOOO
DISCORD MOVED ALL THE AUDIO HANDLING OUTSIDE OF AUDIO CONTROLS
AND INTO THE FILE COMPONENT
i will use the file component and hide everything but the controls
trol
lovely class component
intellij
replace \v with [a-zA-Z$_] in patch replacements
\v
var
is for future proofing
\w doesnt contain $
. is 1
not a huge deal but it would include all possibilities
the fuck is an ANNOUNCEMENT_THREAD
gonna steal the code from an old build
Threads for announcement channels
wait till you see an implicit relationship
@dull magnet what would the best way to store custom pronouns in
there isn't an appropriate OptionType, so should I just directly use localstorage/indexeddb or whatever?
and if so - how
How do you use datastore
wow using gifenc was such a good idea
it really gets the most important colors
i just need to prioritize the colors based off something
its only enforced if u never edit the variable
wrap it in a <textarea>, those parse newlines into actual new lines
or make a custom react component that splits a string on \n and then wraps each one of those with a <span>
export function TextRenderer({string}) {
return <div>
{string.split("\n").map((line,i)=>
<><span key={i}>{line}</span><br/></>
)}
</div>
}
@green vessel
pog good library
yupp
that library is really awesome
all the other gif encoder libraries I tried were all terrible shitcode
for example some of them forgot to declare some variables so it just makes globals
do u know anything i could use to replace that
meanwhile that library fast efficient and small
BYTES AS STRING
Holy shit wtf is this
utils/colors.ts
I think it's because they were all written more than a decade ago when typed arrays and similar weren't a thing
i convert them to hsv so i can do different style preferences like this
monet engine knockoff
is the "find" field in the patches thing only used for finding the right webpack bundle by using its value
its for finding the right module
it basically looks for module.toString().includes(find)
not on my watch!
git push --force
if you don't wanna put your opinions above everyone else, do a --force-with-lease
but my opinions are above everyone elses
Wait so if you install vencord via a local git clone of it, when you update it inside the client, it updates that local clone of the repo right?
yes
yes
So why not make it so installing vencord with any method just clones the repo and builds it locally
and then if someone wants to add a plugin, they just put the plugin in the userplugins folder
prob the most stupidest yet hackiest idea ever
uh basically
most non-devs don't want to install node, git etc
we do plan on adding userplugin support for basic install one day
ship it with the installer
the idea was that the installer & vencord would be as small as possible
bundling git and node is not very small
You could also just make it a requirement
no
¯_(ツ)_/¯
not everyone wants to have 1gb of junk on their pc
installs electron application Yes nobody does
electron is like 200mb
git is probably pretty large cause it ships git bash as well
vencord has like ~150mb of dependencies
in any case the idea is bad because many things can and will go wrong
git conflicts, build failing for some reason, unexpected behaviour on specific platform, etc
people complaining its taking too long
implementing user plugins shouldn't be terrible
people who have npm blocked for some reason
Vencord namespace is already global so
so many factors
blazing fast
wtf 🚀 🚀 🚀 🚀
libgit2 for git
for node, well, explode
I use libgit2 in vencorded
btw pro tip, chrome devtools has a function that finds instances of classes
queryObjects( find(m => m.prototype?.getTopEmojiWithoutFetchingLatest) )
gives you all instances of the EmojiStore for example
(dont run on very generic classes that will have thousands of instances unless u wanna die)
time to run on very generic classes that will have thousands of instances
its actually not too bad
but i think if i dare expand the array i will explode
ah no its not too bad cause it partitions arrays
chrome team so smart
love
HOLY SHIT
i dont think u can access those outside of the devtools vm
noooooo
how new is this
ancient
thats FUCKED UP
i used to do entire HEAP SNAPSHOTS
for this exact purpose
yeah u cant
theres way more utilities
another cool one is getEventListeners(htmlElement)
and monitor(function)
which logs calls and arguments
this is so fucked up
the amount of times i have done all of these manually
you love monitor(Object.create)
monitor(Object)
even better
could anyone help me figure out what i'm doing wrong here. My find is unique and my regex works on the minified js but my run function never gets called. There are no errors in the console and my plugin appears to load successfully
export default definePlugin({
name: "TypingAvatars",
description: "Shows the avatars of typing users",
authors: [
{
id: 398887208947286017n,
name: "Pseudorizer",
},
],
patches: [{
find: "Reactor: currentUser cannot be undefined",
replacement: {
match: /(\w+)=0===(\w+)\.length\?.+?;/gmi,
replace: "$1=Vencord.Plugins.plugins.TypingAvatars.run($2);",
},
}],
// Delete these two below if you are only using code patches
start() {},
stop() {},
run(v: any) {
console.log("TEST1234");
console.debug(v);
return "lol";
},
});
hmmmm okay, any ideas as to why it works in chrome but not in the patch?
are you on canary or smth lol


Reactor: currentUser cannot be undefined
insane
what are you trying to replace @astral nimbus
so the regex targets this ternary operator that decides what string to show for the typing indicators
that string then gets put into a span
bruh
is that what u want
uh
if so then
{
find: "Messages.SEVERAL_USERS_TYPING",
replacement: {
match: /(\w+)=0===(\w+)\.length\?.+?;/,
replace: "$&Vencord.Plugins.plugins.TypingAvatars.run($1);"
}
}

that's not quite what i want no, i want to replace that whole ternary operator, not add a line after it
but let me see if that new find works
remove the $& and you'll be replacing that entire line
btw use pretty print

ye ik i was showing it worked with the minified code
@astral nimbus btw $& puts the original match inside ur replacement
mhm, switched to a better solution now anyhow, just re-assign instead of replacing
match: /(\w+)=\w\.typingUsers.+(\w+)=\w+\.channel.+(\w+)=\w+\.\w+\.getGuild\(\w+\).+(\w+)=0===(\w+)\.length\?.+?;/gmi,
replace: "$&$4=Vencord.Plugins.plugins.TypingAvatars.run($5,$3,$1,$2);",
is there not a better way to do this?
show what the function looks like?
alright
venn i really want a custom escapee for clean identifier matchinggg
also what if $# => `Vencord.Plugins.plugins.${plugin.name}`
will u accept custom eslint regex rule for top thing
what if $@
but make it so the ide doesnt cope about unnecessary escape or similar
coffeescript reference
ye
ok easy
if im doing another package change i will make the @taips packages
btw if you use a function you can name the groups
ye i was gonna change them out for named
regardless, that's enough late night random fixation

stash push WHAT
ur just pushing to your furry stash chill bro
.husk()
If I made a PR that fixes the flashbang on load this weekend, would that be accepted?
I could just show a dark background.
Maybe with a logo if vencord gets a good one
Try it
I don't want to east my time if it will be denied
you mean in the android app?
yeah sure
I mean i personally don't have the flashbang lol
I can probs just but a BG on the webview or smth right?
Why not?
nvm I have it lol

it'd be extremly easy probably
it's already in a linearlayout
just need to give that layout a background colour
Yeah ik.
Yeah I thought so. Unless the webview displays white until loaded, in which case I nay need to switch to a framelayout or smth
If I do it it will be my first PR ever :p
I always want to PR smth to a project but the codebase is too complicated so I can't figure it out
But vencord mobile codebase is pretty simple I think
So should be good :)
the codebase is not too big if you know what you wanna do and focus on that small part of the code
it's very overwhelming I agree
but if u focus on the small part u need to edit its oki

you don't need to understand the entire codebase to do changes to a part of them
honestly I don't think anyone knows the entire codebase in big projects like Linux or chromium
Not for vencord mobile imo
its projects like heroic that I am talking about
I wanted to port it to solidjs
But they have so many react-only deps lol
Yeah agreed.
Well that's a very big feat lmao
gotta rewrite a shit ton of stuff for that
I could have done it maybe
But there were so many dependencies that had no solidjs equivalent :(
Would have probs been easier to rewrite the whole thing lol
why do you care about performance of a client you'll maybe use 2 minutes a day
I use it super often
Oh if I just launch a game tho
Yeah idk why I wanted to do that lol
Just felt like it
any good docs for the unofficial discord api?
tf is a unofficial discord api
isn't that what you call it?
oh you mea
doesn't the client use api routes and such that say a bot wouldn't?
found some things on it, but they're all kinda meh
hmm, ig so, global searching for function names the best option to find them?
yea and putting breakpoints to find something relevant
it's pretty painful when you barely know what you are looking for
haha yah it defo is
can i use these findBy utility functions to find a function by its name?
hmmm, so i have the module id that a function i want is coming from
so ig i could then find that module, find some code in it and then use findByCode?
i could've just used the UserStore 
YOU KNOW WHAT WOULD BE AWESOME FOR THE SPOTIFY MODULE
using this component
and icons are just
the play along one with the cool flexbox expand thing so they take up all the space
i love react devtools
we love
:)
:)
working on a cool plugin btw
this way css-snippets will be more accessible to others (cause not everyone knows how to edit the css file)
and tbh it is a hastle to edit it for every little thing
wah
i hate yaml https://github.com/Vendicated/Vencord/pull/344
i also hate using my brain
before install
after install
after an edit
im quite satisfied with the buttons
all thats left is to actually apply the CSS
and to add a settings UI (ugh)
(and no, I don't need or want any advice/help, I just like posting my progress)
@dull magnet hey ven, ya free?
ven tried to implement it using that but it was not really practical
the message element does not re-render unless you hover out of it
so after clicking Apply, the UI doesn't update until after you leave the area using your mouse
yooo
that's so cool
now you could just link the snippet to the message id and have an install/uninstall feature somewhere in settings
showing the collapsible code block, the author, uninstall and jump (to the message) buttons
try using the useForceUpdater hook
**ignoreActivities.tsx: **Line 91
const forceUpdate = useForceUpdater();
it might help to check how i do the "Copy" button in shiki
thx
sadly it doesn't work
I can't use react hooks
it errors
(yes I know how to use a react hook)
even tho the function returns JSX, it looks like discord doesn't treat it as a component or smth
hmm
since I can use components in it, I could just treat it as a wrapper
well that was a failure
the moment I use a hook react complains
giving the 321 error
Iirc what I had to do for my kernel mod was like this: https://github.com/Henry-Hiles/kernel-package-downloader/blob/master/renderer.js. Kindly ignore my bad code :p I had never made a discord mod before
Also BTW I couldn't use JSX because I was using kernel as a mod-loader, but with vencord u may be able to use JSX.
its not "you might" but "you can"
and I already am using JSX
I see you use a hook
i cant use hooks
So the useEffects in your code don't work?
Also what is the purpose of the const useEffect near the top? Can't you just do const useEffect = React.useEffect?
Why would I do that?
First of, it would fail
Secondly, the other option is to do React.useEffect everywhere
Why?
Your line const useEffect = (...args: Parameters<typeof React.useEffect>) => React.useEffect(...args); seems like a longer implementation of the same thing
sighs
const useEffect = React.useEffect, on the top level?
that would fail
as React is lazy loaded in vencord
and it would not be available
please dont comment on code that already works
well, not lazy loaded, but more like, it is undefined until it is found
in Webpack/common.tsx
please, I know you are trying to help
but all you are doing is annoy me
I appreciate the attempt
my guess is that the array, my component is inserted into, is the issue
Ah I see.
Hmm.
@cursive plank did you try having this eslint plugin on and see if there are any errors? https://www.npmjs.com/package/eslint-plugin-react-hooks
Maybe its the fact that its an array function thing
Idk.
I doubt it would work but you could try changing the definition to js SnippetManager: (props) => { // your component code here }
this would be because you're not actually in a react component context
you can make a simple wrapper around your component that does give it the proper context
function ActualComponent() {
useState()
}
function makeComponent() {
return <ErrorBoundary><ActualComponent /></ErrorBoundary>
}
makeComponent()
that's why some plugins have two functions with one just being a wrapper like this
Knew it!
How do i setup vencord android for development?
you need to make a keystore first
search google on how
after that, you need to set up some properties, typically there is a file named local.properties
you can set them there
although be careful to not commit your keystore
well, it aint that important if you are just messing around
the keystore is the signature for the apk
anyone who has it and knows the password can make an apk using that signature
anyways
if you dont plan on making a fork
then you shouldn't care
ven is the one that must care, to not leak his keystore
@dull magnet is there a more graceful way of modifying plugin settings (outside of the discord settings) than just Vencord.Settings.Plugins.CssSnippetManager.cssSnippets = ...?
ig I could make a wrapper function for just that
but it still doesn't feel great
updating the settings is slow, maybe bc it is not async or smth
I am gonna make a pr
then its ok
although its weird that ven did not allow debug builds w/o a keystore
or are they allowed, but the config assumes there is a keystore either way?
where is the vencord for android repo?
i havent really done much with android apps before, idk any of this keystore stuff
just google it
android studio can generate a keystore for you
you just fill in some info
mf doesnt have a debug release
darn
yeah, or just add a debug build
lol
w/o a signingConfig
debug {
minifyEnabled false
}
ill assume that you can make that edit urself
edit the build.gradle (app)
add that build type, and use it
do i have to do this? https://developer.android.com/studio/publish/app-signing#generate-key
the issue is that the config expects you to have key variables on ur system so you get an error if u don't
oh.
that should be removed in favour of passing command line arguments
I just did it that way cause I didn't know a better way
ah, so what do i have to do?
no
that's also how the settings ui does it
and it shouldn't be slow
obviously don't make 100 changes a second but other than that it shouldn't be slow
just set up keystore and the variables for the time being
laggy how?
it feels like it takes a solid second to save
uh, ok. let me figure out how to do that :p
if you're changing custom css, it will take about half a second because of how it's implemented
anything else should be instant
how do you notice how long it takes to save?
im talking about discord freezing for some miliseconds


