#๐งฉ-plugin-development
1 messages ยท Page 11 of 1
is Could not find the language '', did you forget to load/include a language module? from react_devtools_backend.js:4026 normal?
I don't think I caused it but just wanna double check
have you guys thought about making an AUR package
what for
arch users putting everything on the AUR be like
like idk why
installing is super simple
I did it! @dull magnet
MessageEvents.ts Lines: 44-66
export type SendListener = (channelId: string, messageObj: MessageObject, extra: MessageExtra) => void | { cancel: boolean; };
export type EditListener = (channelId: string, messageId: string, messageObj: MessageObject) => void;
const sendListeners = new Set<SendListener>();
const editListeners = new Set<EditListener>();
export function _handlePreSend(channelId: string, messageObj: MessageObject, extra: MessageExtra) {
for (const listener of sendListeners) {
try {
const result = listener(channelId, messageObj, extra);
if (result && result.cancel === true) {
return true;
}
} catch (e) {
MessageEventsLogger.error("MessageSendHandler: Listener encountered an unknown error\n", e);
}
}
return false;
}
export function _handlePreEdit(channelId: string, messageId: string, messageObj: MessageObject) {
for (const listener of editListeners) {
try {
https://github.com/Vendicated/Vencord/blob/main/src/api/MessageEvents.ts#L44-L66
**MessageEvents.ts: **Lines 44-63
export type SendListener = (channelId: string, messageObj: MessageObject, extra: MessageExtra) => void | { cancel: boolean; };
export type EditListener = (channelId: string, messageId: string, messageObj: MessageObject) => void;
const sendListeners = new Set<SendListener>();
const editListeners = new Set<EditListener>();
export function _handlePreSend(channelId: string, messageObj: MessageObject, extra: MessageExtra) {
for (const listener of sendListeners) {
try {
const result = listener(channelId, messageObj, extra);
if (result && result.cancel === true) {
return true;
}
} catch (e) {
MessageEventsLogger.error("MessageSendHandler: Listener encountered an unknown error\n", e);
}
}
return false;
}
Everything seems to be working with async now
Should I make a PR?
something like this? ```js
Vencord.Webpack.Common.RelationshipStore.getFriendIDs().map(id => Vencord.Webpack.Common.UserStore.getUser(id).username)
outputs all friend's usernames
@green vessel pong
ping
oh yeah try ```js
Vencord.Webpack.Common.RelationshipStore.getFriendIDs().map(id => (u => u.username + "#" + u.discriminator)(Vencord.Webpack.Common.UserStore.getUser(id)))
by chance, has anybody taken a look at my pr?
I'm not very familiar with js/ts, so any advice would be appreciated
tho i didn't really add anything new in the pr, i just did it so my plugin could work
hey i have a question how i can remove embed from message locally
im trying to just do
<IMessageCreate>.message.embeds = [];
but that kinda don't work and i don't have idea
doing plugin to hide embeds from certain websites because my friend irritates me with one lol
you mean that?
FluxDispatcher.subscribe("MESSAGE_CREATE", this.onMessage);
thats subscribing
you can also dispatch your own events
you can just dispatch a message update event
FluxDispatcher.dispatch("MESSAGE_UPDATE", {
id: ...,
channel_id: ...,
embeds: []
});
i know im really stupid and don't know what im really doing but
when i do this like that ide shows me an error TS2554: Expected 1 arguments, but got 2.
lol
and when i just ignore that it prints many errors in console
cause its dispatch({
type: ...
})
figure it out
im trying to
jeez
show code
@dull magnet guh do you still have the config and the flag to open discord with to debug with vscode, I literally cannot find
it's literally in the repo xd
**launch.json: **
{
// this allows you to debug Vencord from VSCode.
// How to use:
// You need to run Discord via the command line to pass some flags to it.
// If you want to debug the main (node.js) process (preload.ts, ipcMain/*, patcher.ts),
// add the --inspect flag
// To debug the renderer (99% of Vencord), add the --remote-debugging-port=9223 flag
//
// Now launch the desired configuration in VSCode and start Discord with the flags.
// For example, to debug both process, run Electron: All then launch Discord with
// discord --remote-debugging-port=9223 --inspect
"version": "0.2.0",
"configurations": [
{
"name": "Electron: Main",
"type": "node",
"request": "attach",
"port": 9229,
"timeout": 30000
},
{
"name": "Electron: Renderer",
"type": "chrome",
"request": "attach",
"port": 9223,
"timeout": 30000,
"webRoot": "${workspaceFolder}/src"
}
],
"compounds": [
{
"name": "Electron: All",
"configurations": ["Electron: Main", "Electron: Renderer"]
}
]
}
this makes discord take like 5 years to start btw
Noted
can we make a plugin to update UI?
like replacing some elements
(cannot be done with css)
yes
I am blind thank you.
How to setup a dev environment? ๐
Like if I clone the vencord repo then make my plugin I am sure it won't work, so is there any specific path where I clone it so that the installer reads it?
@solar maple read the docs https://github.com/Vendicated/Vencord/tree/main/docs
๐
not a vencord issue
you've modified it yourself so you'll need to figure it out
take a closer look at examples and existing plugins
just copied the code from your guide
megu's plugin guide
screenshot code?
firstly, remove spaces from "name"
having spaces will break stuff
folder called ts?
does it work now?
it builds successfully
but no console logs
userplugins must be turned on by default
i was banging my head for no reason
good to know that preSendListener does not trigger for messages with attachments
RIP
I can't access the plugin tab because it's crashed
vsupport more info
"doesn't work" or similar are not very helpful.
You can make our lives easier by providing the following information:
- What platform are you on? Windows, Mac, Linux?
- What client are you using? Discord Desktop, Discord Web, Armcord...?
- What branch are you on? Stable, Canary, PTB...? If not on stable, does it work on stable?
- Are you fully up to date? You can check by going to the Updater settings tab. If you cannot access that page, use the installer. If no, update and try again
- Are there any errors? Open the console (Ctrl+Shift+I) and check the console tab. If there are any errors (red text), please provide them.
- Does this issue persistently happen, or only sometimes?
- Please provide steps to reproduce this issue. Screenshots or videos are also helpful.
hi guys 
I wants to edit content from incoming messages. How to subscribe event on my plugin?
look at existing plugins
moyai does
well, subscribe yes
idk about modifying
they just asked how to subscribe though
np
but asking for how to subscribe is x/y problem
so no point to help with that
you need to patch some part of the message event lifecycle to edit message content
@dull magnet what is Promiseable?
Oh okay I have to import it then
you can use this if you're not sure if something is a promise or not https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/resolve
try import type instead of import
actually mm
yeah tsconfig needs ```json
"@webpack/common/types/": ["./webpack/common/types/"],
or something like it
@dull magnet fix
just don't import them
in any case you can just add this
alr
just add as const to ur object
oh thanks
const foo = /* ... */ as const; we love
it works but i still dont understand what that does lmao
by default ts considers objects as possibly partial and mutable
so it types
const blah = [{ type: "hi"}]
``` as `Array<{type: string}>`
the as const tells ts that this object is immutable or constant and now correctly infers every variant of type as literal
so in this case it would be typed as Array<{ type: "hi" }>
ohh i see
so its basically making the entire object and all properties/elements constant
thats actually really useful
i do that
in spotimbed
sike
i dont do it far up enough in the lifecycle to be generalizable
only affects embeds
is there a wasm lib/any other reimplementation of base64 => ascii decoding than atob?
atob is slow
like rly slow
a 1-2k line json encoded in b64 takes like good 5-6 seconds to decode
is pmneo.tsimporter useful
or does vscode alr implement what it does (& that's what it got removed)
also in the most part auto rename tag's functionality is part of vscode ("editor.linkedEditing": true,)
linkedEditing bad
doesnt work in most file types
and tsimporter mostly obsolete
i think tsimported is only good for importing default exports
but u should just avoid default exports theyre bad
atob/btoa converted 25MB of json to base64 and back to json in less than a second for me (i do not feel like getting an exact time right now but it is fast)
saying it is slow is insane
hello webdev folk pliz halp
is emote cloner working?
i think image context menu patch is broken
well not broken but passing the target isnt working
https://i.imgur.com/h6djTnV.png
i think it only uses target to not show reverse image search for videos and other junk
interesting
hey, i'm using codef53's stylesheet (https://codef53.github.io/CSS-Snippets/discord/RevertUserPopouts.css )
and some more css:
[class*="avatarPositionPremiumBanner"] {
top: 72px;
left: 18px;
}
[class*="avatarPositionPremiumBanner"] circle {
opacity: 0 !important;
}
[class*="userProfileInner"] {
background: var(--nord-dark1);
}
[class*="userPopoutOuter"], [class*="userProfileOuter"] {
padding: 0 !important;
background: var(--nord-dark1);
--profile-body-background-color: var(--nord-dark1) !important;
}
to disable custom profile themes, but those that are light themed have a theme-light class on them so it makes them unreadable
and i have no idea how to fix that pure css w/o like 50 css selectors to undo the whole light theme ๐ตโ๐ซ
(screenshots of a theme-dark profile and a theme-light one)
(idk if this is the right channel but i don't see a theme-dev/css specific one so ๐ฅด)
well tbf its in the worst section it could be in
it should be in appearance settings
yeah, along with the option to yeet profile themes altogether ๐ตโ๐ซ
@dull magnet DELETE
done
How can the CustomRPC plugin set a custom presence type and name
why can't other rich presence applications do the same
wha
It's internal
So not possible from an external application?
because i added it as a setting
im unsure why others don't though
bruh
for gods sake if any soul can help me get stage channels to work
https://github.com/Vendicated/Vencord/pull/469
literally just use my pr, click a hidden stage channel and you will see the issue (it doesn't transition correctly
)
@dull magnet can I include this on my pr
**index.js: **
// Generated by MS2Porter
const version = '1.1.0';
let src;
const downloadURL = async (url) => {
let el = document.createElement('a');
el.href = url;
el.download = url.includes('http') ? url.split('/').pop() : '';
el.style.display = 'none';
document.body.appendChild(el);
el.click();
document.body.removeChild(el);
};
const keypressHandler = (e) => {
if (src && e.code === 'KeyD' && e.ctrlKey) {
downloadURL(src);
e.preventDefault();
return false;
}
};
const hoverHandler = (e) => {
if (e.target && e.target.src) {
src = e.target.src.split('?')[0];
} else {
src = undefined;
}
};
export default {
goosemodHandlers: {
onImport: async function () {
document.addEventListener('keypress', keypressHandler);
document.addEventListener('mousemove', hoverHandler);
},
onRemove: async function () {
document.removeEventListener('keypress', keypressHandler);
document.removeEventListener('mousemove', hoverHandler);
},
}
};
I GOT IT
THIS FREAKING THING WAS REPLACING MY ROUTE FROM STAGE CHANNELS
THIS TOOK ONLY LIKE 7 HOURS TO FIND
no kidding
On discord web wit my browser when I got to share my screen, It shares my desktop audio even without a window selected. Would it be possible to develop somthin like that for Ventcord?
wha
@dull magnet aight it's done https://github.com/Vendicated/Vencord/pull/469/files
keep in mind chatgpt's training data cuts off at 2019
so it would never know about vencord
other than what you could infer from the name
no you thought AI could port that plugin ๐
So, we are now living in a world where people generate feature requests based on random ideas AI might have? โ https://github.com/systemd/systemd/issues/26212
And I thought AI was supposed to reduce the workload on humans, not add more on top!

/*
* 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";
let src;
function downloadURL(url: any) {
const el = document.createElement("a");
el.href = url;
el.target = "_blank";
el.style.display = "none";
document.body.appendChild(el);
el.click();
document.body.removeChild(el);
}
function keypressHandler(e: any) {
if (src && e.code === "KeyD" && e.ctrlKey) {
downloadURL(src);
e.preventDefault();
return false;
}
return true;
}
function hoverHandler(e: any) {
if (e.target && (e.target.src || e.target.href)) {
src = (e.target.src || e.target.href).split("?")[0];
} else {
src = undefined;
}
}
export default definePlugin({
name: "DownloadImagesShortcut",
description: "guh",
authors: [Devs.Nuckyz],
start() {
document.addEventListener("keypress", keypressHandler);
document.addEventListener("mousemove", hoverHandler);
},
stop() {
document.removeEventListener("keypress", keypressHandler);
document.removeEventListener("mousemove", hoverHandler);
}
});
@green vessel ^
bit modified from the original cuz it didn't work 
instead of opening the download popoup it opens the link in your browser for you to download
@cedar olive i dont understand these
why even bother webpack searching
just hardcode the values
eh just in case discord ever change them somehow
they wont
I guess it would be more perfomant hardcoding
it's more likely those webpack searches fail than that the values are changed
aight I will change it
I will keep channel flags
since those are bitfields
nvm actually
most if not all of those are part of the public api
aka they will not change them ever unless it's a major api update
this fixed performance? @cedar olive
yeah
so strange
I added the comma at the start too cuz there was another function that ended with NOTICE_DISMISS
why did u add so many patches O_o
does anyone already know how to modify the user modal?
just asking in case I can avoid searching for all eternity
nvm found it
nice
hi
now, how would I make the timestamp show correctly?
do I use the markdown parser?
<t:1675638180:f>
actually nvm
i got a better solution
working on a timezones plugin
(that is my own timezone btw)
i havent reached the part where you can change the timezone
How do I fix the react components debugger again?
I remember Ven or some other dev saying you have to delete a folder to make it actually work a while back, but I can't find it
I just open my browser to use the react dev tools
Kinda inconvenient but it works all the time
Although, it might be just Firefox, but the react dev tools are showing errors every second
So they are a pain
My firefox says discord isn't using react
found the thing
but that seems to have just entirely removed react devtools from my client, even following a restart
disabling, restarting, enabling, restarting fixed it
Hello, i'm currently trying to develop a plugin for the Vencord platform that permits our application Cider to use the "Listening" activity type and forces the application id to also use the Spotify progress bar UI as its more suitable for music purposes.
However, i'm somewhat caught up amidst the the webpack mess that is Discord client code, is there any efficient way to intercept a RPC websocket request to apply a custom activity type on receive?
Any help would be greatly appreciated!
you can just dispatch custom events
as in don't use native rich presence
do it urself then manually dispatch appropriate SET_ACTIVITY events
see the lastfm plugin for how to dispatch those events
you could run ur own websocket server via cider then connect to it with the plugin and set the activity
Noted, so there's no efficient way to intercept then?
Ah
search for SET_ACTIVITY:function and you'll likely find it
Awesome will do thanks!
if it doesn't do it omit the function
you can search all of their sources by opening devtools then hitting ctrl shift f
Gotcha.
if u get stuck and need more pointers just let me know
Thanks! I will.
@celest hound if you want to do this, search for this nonzero pid required instead and scroll up till you see handler:function, that's your handler for when a RPC websocket emits a SET_ACTIVITY
I have similar code, I'll get it in a bit
Huh, interesting.
from there you can patch and do any manipulation you want to do with it
I change the application name, u can just adapt it to change type instead
That'd be awesome!!
Thanks for all the help.
no prob!
if you have this patch ```ts
{
find: '.displayName="LocalActivityStore"',
replacement: {
match: /LOCAL_ACTIVITY_UPDATE:function((\i)){/,
replace: "$&$self.patchActivity($1.activity);",
}
}
you can then have this function ```ts
patchActivity(activity: any) {
if (activity.application_id == "<whatever id you want>")
activity.type = 2; /* LISTENING type */
}
do note that the application id is a string, not a number
although yeah actually js wouldnt care lol
their api might
you only need to compare
guess we'll find out.
oh wait application id
i thought u meant type
yeah application ids are strings because ids are too large to fit in 32 bit integers
and js loses precision after 32 bits
Sounds about right.
why lol
HELL
type has to be LISTENING
name has to be Spotify
gotta have start and end timestamps
party id must include spotify:
Doesn't seem to be functioning as it should I don't believe.
Not seeing any effect.
Tested it without the if, still appears to send the "Playing" activity type instead.
Discord DevTools shows 0.
just sanity checking
dont think im doing anything wrong but if I am do lmk
did u enable it?
you should do appIds.includes(activity.application_id)
in plugins yeah
not the opposite
alright can confirm that wasn't it
(thank god)
activity.activities[0].application_id
thats activity store
not sure
any errors in console?
I mean did u rebuild and restart after u updated plugin
yeah
im using watch and the restart client button in the vencord tab
yeah it doesn't even update the name
pretty sure im f*ing something up.
not sure where
if u want
ill double check my stuff
epicly trolled
imma cry from laughter
how did u not have that error before though
hmmm
u can still have spaces but then u cant use $self
should I make custom rpc support this
mayb
I will pr plugin name sanity check
it's just custom activity type 1
plugin names must match ([A-Z][a-z]*)+ (fuck numbers)
(no dont take that seriously)
only users with vencord will be able to see the playback bar
awesome thanks
@celest hound btw dont do spaces on your plugin name

which plugin
TimeBarAllActivities
oh
patch the patch
enabling it you make your bar work

btw u can also add a custom component to ur plugins about page @celest hound
settingsAboutComponent
oh
if u wanna have link and stuff
make custom RPC support spotify 
wdym
wdym what do I mean
like support a fake playbar?
this would genuinely be a useful plugin if you make it more general (aka allowing any ID and making it possible to use other presence types other than "listening")
there's already a plugin that does that
what
TimeBarAllActivities
no what
that just adds a timebar
I'm saying changing the presence type of presences
maybe something I could make
it probably wouldn't be that hard in all honesty
I mean I could merge my activityRenamer with this
yeah
YES
I would love to use that
@celest hound do you mind if I give an attempt at editing your code to make it be able to be used more generally?
that's fine
alrighty
i was hesitant to add that because discord is incredibly consistent when it comes to RPC, but if it's requested i can give it a shot
I already made a pr lol
though wdym incredible consistent?
your rpc shows for yourself and only yourself if it's invalid, for example
ah
I think I will add a desc explaining what's needed to get a streaming rpc working
the minimum discord requires for it
same for this
uhh...?
@dull magnet we will add displayName filter
real
it's better than using byProps
can't wait for discord to get rid of displayNames completely 
that would break our patches anyways
lots of finds depend on display names
also
they wont
cuz of this
Hi I was wondering how to use genPluginList?
I ran it through node but it said Vencord isn't defined
I'm just trying to get all the plugins installed
u paste it in discord devtools
would it be possible to add the partyid to an already existing presence?
how would you fetch user id through a vencord plugin?
like the id of the current logged in user
yeah
UserStore.getCurrentUser().id
thank you
npnp
pnpm
TRU
upnp
yarrn
networking yes
upnp is so real
what is other upnp
its kinda silly to commit your packages imo
typescript doesnt support it i dont think
and a lot of packages break because it forces them to be read-only
wait wdym commit
basically pnp monkeypatches node's module resolution system
to instead of looking at like node_modules
it just checks .yarn/cache in the pwd
which has zips of each package+version installed
and the idea is that u commit those zips and the pnp script
yea its a little silly
I thought it was like
we do a little polluting git history
global
you can make it global if u want
but then its only zero install if u already have them installed
and then you do have to install packages
Is there an event for a presence update?
LOCAL_ACTIVITY_UPDATE guh
details, state, and large image text
of I guess assets might be the better word, since large image text is under that
nvm, got it
i cant get the data from this form with FormData
does anyone have a clue why
if you click show data its just an empty object
Is there a way to dismiss the notification before the timer runs out via the console?
ah cool ty
not sure if this is the right channel, but does anyone know of any extensions or projects that have the same ability to patch javascript before it's loaded (/ in real time)? I know about userscripts, but what I want would only work being able to patch the js before it's loaded
a tiny bit of searching in the discord finds a few old conversations about some related stuff, but no actual projects
(if need be i can try to just extract the important parts from vencord and make my own, but i'd rather not if I don't have to)
I'm trying to make some changes (like you might usually make with a user script) to a site I use, but it uses webpack and everything is minified and really hard to hook into. Specifically, I'm trying to mess with some requests it sends, and theoretically I could overwrite the fetch function or something like that to be able to modify it, but that kind of edit is a lot more difficult to make than it would be to do something like Vencord does
I could use a proxy of some kind, but I don't want to have to start it with the browser and deal with everything else that comes with that
@dull magnet
how so?
just monkey patch
what do you mean
or in what way / using what
find what code sends request
oh, do you just mean overwriting functions with a modified version and stuff?
theoretically I could do that, but because of scope stuff, that becomes a lot more annoying
if you do, please let me know
even if I could just monkeypatch it, this way also seems a lot more interesting and fun
btw, do you know how the userscript does it? does it just monkeypatch somehow? (how is it compiled / where is the src?)
its just the same code
then this kind of relates to vencord for web as a whole, not just the userscript version, but how does it actually modify the code? I assumed the extension modifies the response from the server somehow (or blocks it and loads its own patched ver), but that doesn't seem possible with a userscript
monkeypatching
I thought monkeypatching is just replacing the functions with a modified version / a 'proxy', but vencord modifies the actual text code, so how does it 'inject' that?
sorry for all the questions, i'm just trying to get my head around how vencord works
webpack uses chunking
the way it works is that there's a global variable webpackChunkdiscord_app
you can monkey patch webpackChunkdiscord_app.push to intercept chunks being pushed
and modify those chunks before their code is ran
it turns out you can call toString() on a function. I'm going to go re-evaluate my life choices
lol
you'll most likely have problems with inline-eval (or something similar) not being in the csp if you go down the inline patch route, so you'll either need to modify it or do inline patching a dif way (intercepting web requests)
actually, for whatever reason, the site I'm using doesn't seem to have it blocked, so hopefully I won't have to deal with that
are they stuck on loading?
ayo not sure if this is the right channel for this, but is it okay for me to PR some improvements to LastFMRichPresence?
@green vessel is the credited author of it
namely formatting stuff
I just found out Discord shows the large image text if the activity type is listening. ๐
wait wtf why is it purple
isn't it normally purple?
yeah i ran into that when testing CustomRPC and it is annoying af
maybe based on user profile colors?
on that note, the option to show it as playing doesn't work, and i have no idea why. 
perchance
:thonk:
btw, the hideAlbumName = !trackData.album is redundant, because last.fm API always provides placeholder album art if there's no album art.
nice
and i just realised this is #๐งฉ-plugin-development not #๐ง-off-topic-iceman-only
.album is the album name
Supporters can see the date they first listened to an album. View all supporter perks here.
312 listeners
1148 global plays
0 plays by you
0 by you last week
No listeners in this server.
- East Bound and Down โ
2:46 - The Weight โ
4:58 - One Time One Night
- Bust a Move โ
4:24 - Livin' Thing โ
3:39 - It Takes Two
- Smoke! Smoke! Smoke! (That Cigarette) โ
3:02 - Gimme Three Steps โ
4:30 - Joy
- Amos Moses โ
2:19 - Instant Karma โ
3:35 - What Goes Around - My Name Is Earl Theme - Vocal version โ
3:09 - 99 Red Balloons โ
3:37
oh well

I do that to hide the album name if the track name is the same
cuz that's very common for singles
wait i quoted the wrong code lmao
j
imageUrl: (trackData.image || [])
โ๏ธ ๐
um
amazing
did you provide your username and API key in settings?
yeah guh
h
idk a track that has missing fallback image rn but I've seen the plugin show it's own fallback multiple times so I know it happens
might make sense to provide your own fallback then, so the album art shows up correctly.
yeah it does that already
well it replaces it with the last.fm logo
btw we should probably move to the thread
threads will explod
???
i was thinking upload this as an app asset tho: https://lastfm.freetls.fastly.net/i/u/174s/2a96cbd8b46e442fc41c2b86b821562f.png
okay suddenly it works? 
personally i would make buttons a constant because it's never redefined and i would add brackets around the if statement so its consistent with the rest of the code but im just being picky lol
i hate you github
I always forget that arrays aren't redefined when you push to them ๐
FUCK YOU GITHUB
const just means a variable can't be redefined, but you can still mutate it all you want lol
yeah i know. i just forgor. ๐
tbh tho if you want to enforce code styling, you should probably add smth like prettier.
vencord has way looser code style enforcement than i would have
i dont think it has any
also prettier sucks vscode default formatter is leagues better
prettier is horrid
i don't enforce style much because it doesn't matter + people contributing their own plugins should be able to be fairly free to choose imo, i'm not a fan of forcing very opiniated rules for such stuff
i only added a baseset of sanity checks
ven will hop on dprint
simple fix just give me push access
Hmm. I need to do some more testing with LastFM PR. I don't think the try catch I added is even working?
if you want it to throw on failed requests, you need something like
const res = await fetch(...)
if (!res.ok) throw new Error(`${res.status}: ${res.statusMessage}\n${await res.text().catch(() => null) || "Unknown Error"}`);
const json = await res.json();
it's that way in most http implementations and most languages so idk why you'd blame javascript
even when it responds with smth like 400 it might still give u more info in the body so having access to the response object is useful
statusText btw, not statusMessage
Also turns out the API returns an error message, so I'm now throwing that instead of checking res.ok
@dull magnet requesting re-review ๐
you should still use res.ok
eh, I doubt it will fail unless the user lacks internet
even then, it'll still catch if there's a non-API error.
@dull magnet finish
dzshn:dots/ (main*) % curl -sSL 'https://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&api_key=<snip>&user=dzshn&limit=1&format=json' | jq '.recenttracks.track[0] | [.name, .album["#text"], .artist["#text"], .image]'
[
"ROBBING CHASE BANK WITH A MOP",
"",
"Wells Fargo",
[
{
"size": "small",
"#text": ""
},
{
"size": "medium",
"#text": ""
},
{
"size": "large",
"#text": ""
},
{
"size": "extralarge",
"#text": ""
}
]
]
yop @empty jacinth
the urls r blank for that track
anyways I'll check ur pr soon
Okay. Any chance you can replace the large image placeholder with this for consistency? https://lastfm.freetls.fastly.net/i/u/174s/2a96cbd8b46e442fc41c2b86b821562f.png
does it rlly matter
last.fm logo makes more sense for me instead of their own placeholder on their website
except that for the way I changed the code, it would show two lastfm logos.
for some reason the API returns the star for album art placeholder.
not using fake spotify RPC smh
How did you install Vencord?
if you didnt install manually (which is omega unsupported) not much you can do relating to userplugins
Question. If I make a user plugin, is it possible to install node modules in the user plugin folder?
no
plugins run within chromium, no node
But doesn't the build script bake in node modules?
Emphasis on modules, not on node
Node modules don't always require Node. A lot of them are designed to work on the web as well.
then no idea
plugins that depend on external libs install it asynchronously from a link
see plugins like InvisibleChat or ShikiCodeblocks
I'm going to assume that's ESM modules. I'll check in a second.
I have no idea what you mean by InvisibleChat doing that (all I see them downloading is a PNG asset), but for ShikiCodeblocks, it looks like the dependency is just included in Vencord itself.
looks like https://github.com/Vendicated/Vencord/blob/main/src/utils/dependencies.ts does what you are trying to achieve, if not then wait for someone that knows what they are doing
my understanding from this is that the only way i can do this in a user plugin is by adding a <script> into the webpage.
how can i find an app id for a rich presence
no
look at what they just linked
but you can also just add node modules
Somehow I didnโt see the line at the bottom. lol
And how would I โjust add node modulesโ? Iโm making a user plugin, not one to be included in Vencord.
Would users need to pnpm i in the plug-in directory as well?
user plugins are super unsupported
ye
good luck
๐ฟ
@dull magnet i think gif collections is ready. review it when you're free
thanks
how would i go about joining a voice channel in code ?
navigationrouter does "visit" the channel but does not actually join it
@minor jolt just did some testing
const whatever = findByProps("handleVoiceConnect");
whatever.handleVoiceConnect(
{
// ChannelStore is in webpack.Common
channel: ChannelStore.getChannel("channel id as a string")
}
);```
should work
i was trying different combinations of connect and voice in the search
but that one didn't hit my eye
this is where i found it
uhh I do not
np
apparently there is a handleGoLive function but findByProps doesn't pick it up
how difficult would it be to add the class .custom-theme-background to the root html?
or parse the existing CSS and remove the .custom-theme-background selector from all of it, replacing it with *
I am pretty close to replicating custom themes entirely with css, but some things require .custom-theme-background for their stuff
with my own css:
with the actual thing:
(note the scrollbars and folders)
adding theme-custom custom-theme-background theme-dark to the classlist of the root <html> perfectly matches the second screenshot
if js is gonna be needed anyways you can just trick discord to let you use the real
part of what I want to do is choose custom gradients and theme params
you should be able to just select the element using a query selector and add the class
unless discord remakes it, which would make the class disappear
discord redoes the html classlist every time you change a channel
I would've already written some openasar injected stuff otherwise
but do they redo the root
no clue, honestly not sure where :root is in the dom
the one at the very top of the dom, the one that says <html>
yeah thats the one I tried in the first place
and they redo it?
yeah
you can patch where discord puts their classes and add your own
I don't understand plugin dev that well. I am spoiled by mc modding where finding what I need to change is stupid easy because mojang provides the mappings to deobsfucate their code
let me help you
oh I'm gonna make the plugin for you
ah
sorry I would help you understand if I had more time
no problem
okay this is likely it
search for this (565e3) and scroll down
I will write you a patch real quick
what classes do you need?
I feel so dumb
include the parenthesis
theme-custom custom-theme-background
oh
yes I found it
alright, I think I can eventually figure this out
document.querySelector("html").classList.add("balls")
slap that in start of ur plugin
/*
* 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: "RootClassAdder",
description: "Add classes to the root element of Discord.",
authors: [Devs.Nuckyz],
patches: [
{
find: '"theme-dark theme-amoled"',
replacement: {
match: /(?<=className:.+?{)/,
replace: '"theme-custom custom-theme-background":true,',
}
}
]
});
here you go
yes but they redo root classlist a lot
thanks
interval MutationObserver is ur friend
but nookies already helped u so that's even better :P
mutationobserver makes me want to vomit
the new client themes experiment is objectively worse than the old one because it doesn't touch the values of --background-primary and the like
so now things that use those values directly are ugly
like my custom typing indicator
the old one directly changed those
and the new one relies entirely on OVERLAYS implemented into the css that uses the vars
incredibly horrible
lol
why is vencord based on tab depth 4?
aaa
can someone with real nitro figure out what css the new themes thing adds to settings?
turns out the css I found only covers the primary client
or someone just needs to develop a plugin equivalent to the old client themes plugin
hmm
can you tell me a class that discord adds for their custom theme
I may be able to find the other ones
I will dig through the css file then
.custom-theme-background {
--custom-theme-background: something;
}
you need more than what fits in a discord message, and it doesn't cover the settings
yeah thats what I have been using
to figure all this out
I only have the middle teir nitro, the one they got rid of
u will install gnu coreutils
that's what I did

?
no lol
I'm still disgusted
@cedar marsh lmao
preview a theme and restart your discord
the theme persists
discord so good
I can't get that to work
are you previewing a gradient?
yeah
no
ok 1 sec then
/*
* 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: "Aaaaa",
description: "",
authors: [Devs.Nuckyz],
patches: [
{
find: ".Messages.USER_SETTINGS_APPEARANCE_GRADIENT_THEME_TITLE",
replacement: [
{
match: /(?<=\.getGradientPreset\(\).{0,100},\i=)\i\[0\](?=.{0,50}useState)/g,
replace: "false",
},
{
match: /(?:\i\.)?\i\.isPreview/g,
replace: "false"
}
]
}
]
});
use this
one of those made the thing persist lol
did it work?
kekw
so the new client themes just don't touch settings at all?
eh idk completely
but I changed some isPreviews to false
and that made the theme kinda persist
ah
this new client theme experiment sucks so much ass though
it doesn't touch vars
I need a version of discord with the old one so I can recreate it
have fun experimenting with it lol
I will add the funcionality to fully bypass nitro for client themes on fake nitro tomorrow or something
alright
4 spaces indentation is objectively the only real indentation
anyone have any ideas ?
Wouldn't it be easier to overwrite the canUseClientThemes to always return true?
The gradient state is kept even after a restart iirc, unless they changed something
I will work on it
Vencord.Webpack.findByProps("canUseClientThemes").canUseClientThemes = () => true
ew monkey patch
i am working on a plaintext patch rn too
findByCode(".CHANNEL_CALL_POPOUT:null;")
It's the method handleGoLive calls inside it, but that one is exported
would this be a viable plaintext patch for the canUseClientThemes function or is it just arsejs { find: "canUseClientThemes:function", replacement: { match: /canUseClientThemes:function\(\w\){return \w*\(\w*,\w*\)}/, replace: "canUseClientThemes:function(){return true;}" } }
that's helpful thanks a lot
brazilia numero uno
unnecessary
you can just
{
find: "canUseClientThemes:function",
replacement: {
match: /canUseClientThemes:function\(.*?\)\{/,
replace: "$&return true;"
}
}```
this got lost in general so i'll ask here if it's not a problem
btw is there some way to force the overlay open via the console ?
(when running it in a browser)
since the keybind doesn't work
What overlay
the overlay that supposedly opens in games, you can run it in the browser
you can get the url from Vencord.Webpack.findStore("OverlayBridgeStore").__getLocalVars()._overlayURL
Oh like the vc one?
Maybe I'm confused
it can open like a mini-discord that communicates with the normal discord
no way that works in a browser
Never heard of it
yeah
pressing this used to work but it doesn't anymore
uhh you might wanna censor the url there i dont trust it
it's only a local token
oh okay
not an account one
basically when it loads it gives you the little prompt with the keybind
but the keybind doesn't work (presumably the overlay webview doesn't handle it)
so clicking on the prompt before it disappears is the only way to open mini-discord
but i want to open it from the console
or just force it to always open tbh
I don't think that's possible
the overlay is opened by electron
yea but it has to do some js event fuckery to open it. the mini-discord div has a "visibility: hidden" attribute, if i remove it manually it shows up but i cannot type in channels and it's not complete
it opens an entirely different window
yea probably opens a different browser view and loads the above URL
but how does it handle the keybind
I don't think you are quite understanding
the overlay is only officially used by discord on the client version
because it requires functionalities that the browser does not support
keybinds are one
and you simply can't take that browser window you are opening with the overlay url and apply it as the normal overlay
impossible
there is absolutely no reason to use the overlay on a browser
It can't do its main functionality, being an overlay
hmm, my idea with this was to use it with the CEF BrowserView Api on the Steam Deck, to open the little discord window in gamescope
the overlay likely requires DiscordNative
don't like having a non-steam game always open on the deck
lmfao why am i there i did like nothing
you did
accurate depiction of what i did
no problem lol
what's up with the dramatic music
are you starring in Halloween 2023
It's Gaster's Theme from undertale 
y'know, the scientist that existed, and then didn't?
mr funny haha wingdings
that gaster
idk
shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up shut up i feel old now despite not being that old
but holy shit really
Oof
the install script adds rlottie to system libraries
you just need to manually add it to the include path when compiling
inc i think
ooh my god I will cry
for gods sake what's the issue now
@dull magnet please assist
full thing
aka long long unsigned int
that's not the issue lol
liar




