#🧩-plugin-development
1 messages · Page 68 of 1
patch the popout component and change the variable / react prop that contains the user object
you can use a react hook to properly handle the promise
so this right
yes
issue is, if I modify the popout component directly, I don't have access to the Message ID, which is necesssary to get the bio and pronoun data to actually use, since the UserID is technically identical for webhooks, even though the username and pfp can be different
what promise?
okay so I have the exact component that handles that but it's your choice if you want me to just give to you or show you how to get to it
I would like to learn how to find this information myself :3
please show me how to get it
luckily pronoundb already patched pronouns there so it was the same component lol
okay so
I selected the pronouns component
then I closed all of it's siblings and selected the parent of it
now if you click here it jumps into the code responsible for it
and as you can see from the props you have the user, pronouns, and nickname
which is all you need to change
mk
I understand all of that
now the issue is
I have no reference to the MessageID that the user interacted with to create the popout
what would be the best way to get access to that?
well that component doesn't have it
so you can try to see if you can patch and add as a prop
from here you can see MoreUserTags already patches and adds the channel id
lets see if we can sneak in the message too
I see
yeaah
not without patching a billion components to pass it down
the whole popout doesn't have that information since the beginning of it
would it be stupid to set up my own global variable and store it earlier on in the process? Like somehow overriding the onClick event that starts the whole popout-ing process, grabbing the message ID from that, and then using that later on?
oki
so now the question is
how do I find the onClick event that starts the whole process
because I spent like 4 hours searching yesterday and kept going in circles, which is when I gave up and came here to ask for help
select your name
go up, you can see an onClick prop
right click it, go to definition
just code to paste the mention in the chat box, not what we want
ngl this is one is complicated
yeaah
okay so the onClick here is handled by the Popout component
which basically calls renderPopout to create the bite size popout
so you need to patch the renderPopout
which for this case you need to go up like 3 or 4 components to finally find the source of it
if you wanna try to get to it feel free, but either way here's a find for it "renderUserGuildPopout: channel should never be null"
I was using that earlier actually
I was just modifying the store at that point
ok so at least I was on the right track
now you can either modify the place I showed earlier or this
I just need to combine the two approaches basically
use renderUserGuildPopout to get the message information, then modify the popout component and store a reference to the MessageID
this is where the component gets the nickname and pronouns for
.hasAvatarForGuild(null== for that
nono
use renderUserGuildPopout to set a variable in your plugin with the latest message id
you are gonna need a lot of patches to get the messageId down there
not worth it
fair
it's not like there's gonna be multiple popouts open at once under normal circumstances anyways
yep
yay, got something usable
This is kinda already a thing with permission viewer
Not sure what you're trying to do tho
just for my own fun

and tbh i didn't know permissionview existed
tysm! 
the pronouns are now switching responsively
I just need to poke around more to figure out where to patch in the bio now, since it doesn't have an explicit "bio" section like it does for pronouns, but that shouldn't be too hard I don't think
that's fair
I figured out how to set the bio :3
I just had to set v.bio right before the function returns
OO server profile ui rewrite?
I was looking at other plugins, but im not able to find something
When the plugin is enabled or disabled vencord should restart.
But i only find that option for settings, not for the plugin self
If the plugin has patches, it requires restart
Dunno if there's any field to explicitly dictate that
okay, bcs i add the button to the serverlist, but when you turn the plugin in, it is not there, only when you refresh discord
add the functions to your start/stop
thats what i was saying, i cant find what the tag is for that
I only find it for the settings
const settings = definePluginSettings({
loop: {
description: "",
type: OptionType.BOOLEAN,
default: true,
restartNeeded: false
}
});
You can't add buttons in start/stop unless there's an existing api for it
For more creative button locations, you need patches
Which indeed require restart
atm this is my definePlugin
export default definePlugin({
name: "BetterGuildList",
description: "Adds an 'Expand' button to the bottom left corner to expend the width of the guild list.",
authors: [Devs.kebab_420],
dependencies: ["ServerListAPI"],
renderExpandButton: ErrorBoundary.wrap(ExpandButton, { noop: true }),
start() {
addServerListElement(ServerListRenderPosition.Above, this.renderExpandButton);
},
stop() {
removeServerListElement(ServerListRenderPosition.Above, this.renderExpandButton);
}
});
Oh, so there is a ServerList api
ye so im looking to all the other scripts and to the libs but I cant seem to find how i can say it needs to restart
here an idea, open a modal requesting the user to restart
or force the user
hmm that is a option maybe. Let me see if I can find the best way to do that, Thanks!
Or figure out why it requires restart in the first place
well i have been looking the past 2 hours why the plugin needs a restart before working. I guess Discord may not dynamically render new components added by plugins unless the application is restarted. I found some other plugins that have the same issue.
So for now I solved it editing my start() function to this
start() {
if (!Vencord.Plugins.isPluginEnabled(this.name)) {
onRestartNeeded();
} else {
addServerListElement(ServerListRenderPosition.Above, this.renderExpandButton);
}
},
If addServerListElement does not rerender the list, that's a bug
Ye i found the readAll button plugin that was having the same issue when you enable it, it is not there, until you reload discord
I've noticed some performance issues creeping in with my plugin, and I was wondering how I might be able to figure out the cause. The performance tab in the dev tools isn't showing all that much, and the react profiler says it's not supported
is there another way I might be able to profile it to figure out where the issue is?
can i take the source of an existing plugin (oneko) to modify it for mine by giving credits?
for public or private use?
yea
public, i want to submit it
sure, append with yours
alright thanks
why does this matter
tbh plugins are GPL-3 unless mentioned or what? I'm kinda confused
wdym user-made ones?
users make the plugins
not on vencord's repo
all plugins are gpl3.0
yeah
i see, guess i'm good leaving them GPL3.0
(which necessitates gpl3 to be used)
so i just tried making the plugin but with shiggy, why doesn't it work?
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import definePlugin from "@utils/types";
export default definePlugin({
name: "ShiggyCursor",
description: "cat follow mouse (real)",
// Listing adryd here because this literally just evals her script
authors: [{ name: "damima", id: 1001076524612603945n }],
start() {
fetch("https://raw.githubusercontent.com/adryd325/oneko.js/8fa8a1864aa71cd7a794d58bc139e755e96a236c/oneko.js")
.then(x => x.text())
.then(s => s.replace("https://cdn.discordapp.com/stickers/1039992459209490513.png", "https://raw.githubusercontent.com/adryd325/oneko.js/14bab15a755d0e35cd4ae19c931d96d306f99f42/oneko.gif")
.replace("(isReducedMotion)", "(false)"))
.then(eval);
},
stop() {
document.getElementById("oneko")?.remove();
}
});
source: oneko plugin
s.replace("https://cdn.discordapp.com/stickers/1039992459209490513.png", "https://raw.githubusercontent.com/adryd325/oneko.js/14bab15a755d0e35cd4ae19c931d96d306f99f42/oneko.gif")
This replaces something that doesn't exist in the script, I think you filled in the wrong part of the replace for what you're doing
wdym
your replace is wrong way round
because of the content of the asset?
You wanna replace the ./oneko.gif with your sticker
exactly, or even better with just the shiggy gif
As in, you want to replace the highlighted one with your url, you replaced the first string instead so it's not doing anything
like this?
The first string needs to go back as it was before as well, "./oneko.gif"
ok
let me see if it works
woah it works
the problem is
it looks like this
how can i fix it
Seems like the scaling is wrong. You propably need to define the scale when fetching from github
an example?
i'm new to these things :)
Oh, oneko.gif doesn't seem to just be a regular gif
It's actually a png segmented into frames
correct
You'd either need to do this for your shiggy gif or adapt their original script to use a regular gif
is there a website that automatically does it by putting a regular gif?
Well gifs dont contain any sizing data on thier own (afaik), and the viewport on the image you shared seems to be to small to show the gif correctly. So either make the viewport bigger or downsize the gif.
(you can see the uper side of the hairbun on the image you shared)
I imagine there are tools to make sprite sheets but this set is pretty specific to this use case
I feel like the time you'd spend getting it to fit into the existing script could just be better spent rewriting it to work with a regular gif
impossible i will be able to rewrite that
lmao
This is basically what you want instead #📜-js-snippets message
But adapted to follow the mouse instead of bouncing
can someone help? i'm having trouble
so i'm trying to do a plugin that's like the oneko plugin, but with the shiggy gif
i did some attempts but failed, i think the problem is the scaling of the gif as when i tested it the gif was just pixelated and cropped
the source has been taken from the oneko plugin (#🧩-plugin-development message) and now I modified it a little bit and it doesn't even load anything
this is the current code:
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import definePlugin from "@utils/types";
export default definePlugin({
name: "ShiggyCursor",
description: "cat follow mouse (real)",
// Listing adryd here because this literally just evals her script
authors: [{ name: "damima", id: 1001076524612603945n }],
start() {
fetch("./shiggy.js")
.then(x => x.text())
.then(s => s.replace("https://cdn.discordapp.com/stickers/1039992459209490513.png", "https://cdn.discordapp.com/stickers/1039992459209490513.png")
.replace("(isReducedMotion)", "(false)"))
.then(eval);
},
stop() {
document.getElementById("nyan-cat")?.remove();
}
});
I also added to the plugin directory a file called shiggy.js (source taken from #📜-js-snippets message), and the code is the same as shown in the original code
I don't think you can fetch like that, I'm pretty sure that just fetches discord.com/shiggy.js or something
i will just put it in a gist
oh woah i made it work!!!!!
thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
fwiw you can also just put all the code directly into the start() function rather than fetching it from the gist or another file
can TextReplace rules/settings also be stored in a file for easier editing? (instead of only being stored in IndexedDB)
prolly but you can also just use this to move your text replace stuff from 1 device to another
#📜-js-snippets message
or the one below that made by ethan
how would i check permissions, for a specific user rather than myself
from their userid
thank you
how do people get access to this channel again
modmail
i thought mentioned flag is part of LOAD_MESSAGES_SUCCESS, but it isnt.
removing out mentions and preventing then to ping is fun
is this in stable?
yepyep
Hey, so i'm looking to make a plugin that gives the ability to switch fonts within discord, without relying on external css. Where would i get started and where would i be able to look at plugins to get an idea of how they are structured?
you want #🎨-theme-development
thank you!
use a theme
graveyard of yoinked client mod features
how do you find a settings?
look at other plugins
a name could help?
@hushed loom, <t:1726803053:R>: review #2161
import { findByCode } from "@webpack";
no module found
Anyone else notice how people on this server seem to say you make a plug in that allows you to upload more than 10mb files but betterdiscord used to have a plug in for that, https://github.com/ImTheSquid/SplitLargeFiles anyone tried recreating this here yet?
where can i find the addreaction function
i tried using previous one but it stopped working
findByCode?
would i do
findStoreLazy?
i'm trying to access the function.
findByCode from @webpack/common?
would it be .userHasReactedWithEmoji?
findByCode(".userHasReactedWithEmoji")(channelId, messageId, { name: "", })
yeah but how do would i import findByCode because whenever i import it from @webpack its like non existtent
import { findByCode } from "@webpack";
Oh lol
It should be there lol
Go in your webpack.ts in src/webpack and ctrl f findByCode and verify its there
isnt that the context menu api?
Lol nvm I actually answered my own question the first time I sent the message LOL
okai cbotsweat_smile
Hey
I made a cuss word bypasser plugin for vencord and idk how to make it send the message
it doesn't send the message
I think plugins for circumventing rules aren't usually appreciated
real
ehh
any word bypasser
also I got timed out for posting my script
what am I doing wrong?
I couldn't send the script
it just timed me out for 10 mins
That is maybe the most whitename image i've ever seen in my life
The bot doesn't like unicode bypasses, yes
ahhh mades sense
So since you included those in the code you were trying to send, whoopie
do you want the code without those?
Frankly, I do not give a damn
bro I just need to know why it doesn't send bruh
did u make that using ai lol
yes
LMAOO
thats why I am here
gotta love the AI explaining every single line
because i'm dumb
Peak
real
anyway can anyone help my bright skin ahh
doesnt this usually cause someone to lost their access to these channels 
I would recommend not using ai for these type of things, the AI will 100% not know how to properly make a vencord plugin and in my opinion if you dont understand what its writing you shouldnt be trying to ask for help on it as its annoying to us and not really beneficial to you
Ai is a one way ticket to either getting banned for selfbotting, or having a broken plugin 
everything
Or both tbf

then give me a whole plugin doc and i will learn myself
You should try to look at other plugins as reference so you can see what they do
The documentation isnt really that good I admit
like what plugins?
this
thats why I used ai
look at any other plugin that uses command and sends text and see how it works
there are plenty
where can I find them besides #1256395889354997771 ?
I already looked there
who would have guessed the website has a filter for plugins with commands
and a button to view their source code
i had no idea
erm actually 172 
fr
anyways on one note someone should try making the docs better 
agree
thanks y'all
?remind 100 months make docs better
Alright @swift delta, in 8 years and 4 months: make docs better
Obviously not, he is just practicing proper comment usage, how else would he know import { definePluginSettings } from "@api/Settings"; imports settings from the API
const b = a + 1; // adds 1 to a
copying other coded plugins and putting it into chatgpt
because chatgpt is dumb too
function checkWorldState(): string {
if (0.1 + 0.2 === 0.3) {
return "The world is fine";
} else {
return "The world ends";
}
}
console.log(checkWorldState());
Should work perfectly fine
.3000000004
yup
Not really
I had a replugged plugin that I was trying to port to Vencord, so I wasn't sure how to work with the vencord API
I assume I just need to take a look at the plugins source code?
Looking at how things are used is often a good way to learn how things are used
Yeah that's fair
I was just wondering if there was a doc
OK so I'm reading the source code from one of the plugins and there's a @api library apparently
I tried finding it by looking into the package.json for Vencord, but I don't see a name match
what is that called?
Ah I see, ty
check discord markdown rules, all the regex you desire; are there.
found the custom: /^<a?:(\w+):(\d+)>/
For what the user types into the chatbox not the content
guess what. this regex is used for both
searching {RULES: would show the module if you want to test it yourself
sorry if sounded somewhat rude
Just so that I understand correctly, using a dev Vencord is for when you're testing the plugin, correct?
yes
Props = Properties right?
What’s the difference between FindByCode FindStoreLazy and all the others like they have names what’s their functionality
And do I submit a PR for the plugin?
or do I have to open a ticket in #🏥-vencord-support-🏥 with the fork repo link?
PR
ctrl+click them in vscode, you can see the implementation
the lazy ones however only do the action specifically when needed
so, when they're first accessed
rather than instantly
Which is useful since they're often used at the top-level scope, which is run before discord has loaded
Can I use a node module in my plugin?
yes but why
I'm going to add svg and avif support
you don't need a module for that
yes now that I think about it I don't
@hushed loom, <t:1727407876:R>: review #2161
O did that already
I
I can send you the code if you want
@rocky falcon you type but you never say something
mystery
Anyone here know morse code? Maybe they're trying to say something
Sure
on my phone whenever i click someones name it puts a ping in the message box so that triggers the typing, but i didnt actually wanna say anything lol
is there an API to add an icon to the toolbar (like the toolbox does)? i saw the toolbox, but it uses a patch, and i really don't want to conflict
If there was an api, toolbox would be using that
true
So uh
what was the plugin that existed for PR #2918 to be closed?
Cause I looked at the entire plugin list and never found that
vp Unindent
Weirdly enough it didn't appear when I searched for indent the first time
welp, ty
Guys, how to write code when i click on menu option to open browser with link?
All things are done but cannot open browser by click menu option
double the brain rot intake plugin
oh it keeps 2 channels open that’s actually pretty useful reminds me of channel tabs
20 billion chat buttons
Access to fetch at 'https://cdn.discordapp.com/attachments/1015060231060983891/1290003784839467063/QA3gPLF.mp4?ex=66fae125&is=66f98fa5&hm=c47e600f9bbcfb08331fa789789d71a631744ac1cc6f3d038ae600b5a960eaa7&' from origin 'https://discord.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. 
how fix
i dont get it
const res = await fetch(url, { mode: "no-cors" });
if (res.status !== 200) return;
return await res.blob();
url is the same as stock discord that it opens in the browser
wtf its literally not even calling the fetch
???
because in the browser your origin is not discord.com
Use a native.ts file to fetch it
idk what that is
it's the way of executing code in the electron (node js) environment
which means fetch wont have cors and is allowed to fetch anywhere
how do i do that
native.ts file with exported functions
then VencordNative.nativeHelpers or something like that in your plugin
look at any other plugin that has a native.ts file
and see how it exports/invokes the methods
cant i just remove the origin header or something
webcontextmenus uses fetch and it doesnt complain about cors
it doesn't
actually it does
seee
funny
hey huh I'm making a plugin to compress video directly by uploading it on discord
The compression part works pretty well (made with ffmpeg lib), but have problem with discord itself for actually sending it, like I don't get the patch part

@dull magnet what do i doo
what is that video 😭
sometimes
@hushed loom how make it download
native.ts
also im having to like restart vesktop manually everytime i make a change
WebContextMenu downloads without native.ts
you have to do that with native files iirc
not reloads
i hate pressing ctrl r 50000 times
i remember it automatically reloading/restarting upon changes
when i made my other plugins
make fs watcher like styles do
this will make you rage while in vc with your friends making a plugin btw
what if we made the vencord companion extension detect changes and force reload
not really what yall talking about but this would resolve the issue of reloading discord early before the vencord build is ready
vencord companion is too unreliable for this, and isn't the appropriate interface for doing so
like i already said
filesystem watcher, like styles use
i agree that its not the right place to do it, but why is it unreliable
no auto-reconnect
that isn't auto reconnecting
that's connecting on startup
when i say auto reconnect
i really mean "reconnect on failure"
yes, maybe
you have experience?
no, but i know it'd be annoying
also my friends hate it when i develop plugins in vc and have to reload so often
smart
i’m pretty sure though that web doesn’t have good noise cancellation as desktop
Hey, everyone! I'm developing a plugin that patches the expression picker search bar, but, when I attempted looking for the module for the emoji search bar, I got referred by the Patch Helper to a module that straight up isn't in my Sources tab- what could be happening here?
those files only appear if the modules are modified by some plugin, your target module hasn't been modified by anything
Oh, I see! So I could try patching that file in my plugin to check the module itself, right? Or is there a better way to check it?
yeah or wpexs(/\[\i\.EXPAND_OR_COLLAPSE_EMOJIS/) will extract the module
Cool, thank you very much! Have a great day ^^
you can find it by typing ID:
Ooooh, thank you!! I'm not too well versed in this, so I assumed they needed to show up on my sources tab, separate from the js file :V
I'll save this image, it's really useful!
why patching the search bar?
I'm trying to add a button (similar to the diversity surrogate) to the side of the search bar on the GIFs tab so you can spoiler sent GIFs, just as an exercise- so I'm looking to patch the search bar's element nodnod
I was asking this specific question because I wanted to look at how the diversity surrogate works on the emojis tab, for reference when I patch my own thing in
So I'm trying to upgrade the moreUserTags arround the Threads
The main problem is that the badge is to big for the size of the members list, so the nicks start to being almost invisible because cutes with ...
Any ideias to how to solve, or any ideia of displayName for the Thread_Manager permission?
pretty sure that already happens with it
"Chat mod" exists and is longer
It already happened with some other badges
Was I was thinking is to create apart of moreUserTags, an resizable members list and chats list
that's what I said?
So that's also why I was thinking about resizable lists (members and chats)
Imma try to dev it asw
Marquee member names 
ewww
do any of you know how to disable this autoscroll thing when hovering over the edges in dev tools
its so freaking annoying when trying to select code and it just starts scrolling up
like in react devtools
never had that happen 
:(
this is awful
OF COURSE i cant find a single mention of this behavior anywhere
@remote kestrel do you use x11 or wayland?
wayland
Dont bully the third time ive made a plugin, but im a stupid?
Actually cant i just import { definePluginSettings, Settings } from "@api/Settings"; ?
You can just tell eslint to fix it, and it'll change it to that
hi I've been following this guide and got stuck on the step that requires you to open the Components tab in React devtools. The thing is I can't find that in my devtools. Can someone enlighten me please? 🙏
Did you install react devtools
it's often hidden behind overflow menu
Are you certain you did a full restart?
Yeah, well I can try again to see
oh god it appeared after I restarted, my bad
thank you
p sure I restarted the client that time tho
also that gist says it's superseded by official docs but uhhhh the docs are lacking most information said here or am I looking at the wrong docs or something
because most the docs are in prograss
understandable just wanted to ensure I'm not missing something, thank you
is there a way to force update a plugin settings so it gets saved?
settings.store.foo = "bar"
I am doing this tho
delete settings.store.StatusPresets[status.text]
don't delete
should set it to undefined instead?
deleting doesn't even work to my knowledge
yes that's exactly the reason I was asking in the first place
@flint bronze hey man can you dm me ?
my dms are open stop asking me to dm you
im trying to make a plugin that doesn't show desktop notifications unless it matches a criteria like sent by a specific user or contains a specific word. Is it possible to do this? im not sure where to start looking for information on this.
on the userdocs the push notifications show only talk about ios and android, and i couldnt find anything for windows
you would find it in the desktop code
where do i find documentation on that
press ctrl+shift+i
its the client code, you have to dig through it yoursefl
there are some helpful pinned messages
the pinned comment mentions finding the function you want in the ui, but idk if there is a ui element that sends a notification
Isn't there a setting that turns push notifications on or off? Maybe you could look at what that toggles and where that setting is read
thank you
How would I go about matching this in webpack chunk 766646? I'm trying to hook into the member role display, like this one.
Most of the guides I've seen have a much more descriptive name in the children attribute, which helps to match
but this takes in variable data and is just named s
even trying to match a()({ just to keep it simple still gives 117 matches
="span",showOnFocus: would be the obvious one
But that component doesn't look very useful to patch, all it does is adding hiddenVisually xor showOnFocus classes
hiddenVisually]
According to the components module, it's simply called <HiddenVisually>
I just checked again and yeah, I was actually looking for the upper component seemingly
i'm trying to make a plugin to allow someone to collapse the role list, so I'm just looking to append a button right next to the role list number
why add a button
jus make it collapse on click
oh yeah I could do that also
I was at least planning on stealing the down arrow from it
man im being reminded of how much I hate regex 
regex so good
i loved regex before i started writing a lot of patches
and patches have just made me love it even more
The problem is that I have a big case of The Stupid™️
and regex to me is just gibberish unless it's matching a raw string
There's something oddly liberating in patching a complex context-free language with something as crude as regex
and the patch helper tab in vencord
the what
YOU DONT KNOW
no?
all i know about is the companion extension
build with --dev --watch
and that tab shows up
||--watch alone didnt work for me||
ah yeah I completely missed that
is there an easy way to append a common thing?
I don't really know how I would steal a different discord element, so I'm just trying to get a basic poc working at the moment
i was thinking of adding something like patch helper to companion
findCompnentByCodeLazy
||assuming its exported||
ngl there's really no pont on using a webpack component for a collapsed thing
just make it manually it's a simple useState and a predicate to render elements
yeaaaahh 
I know what a predicate is but I have little to no experience with patching react apps
basically I have zero clue how I would even target an element
which is what I figured patching would be useful for
but now I have no idea lol
Seems like it's used at some point in the discord tutorial also, which makes it a little more annoying to find the exact element i need, but I'm pretty sure it's the Anonymous element, is that normal?
I'm pretty sure it at least means findComponentByCodeLazy won't work 
because there's no component name to find
nevermind then, I found it
what do you want to find? is it exported?
- the member list role name and count
- pretty sure no
this thing
I want to just append an extra child to it
why do you want that
to patch it?
find* functions are for obtaining modules so you can use them yourself
you only need them if you wanna render them
if you want to add additional stuff, you need a patch
I want to patch it, they suggested using a find function
you need a patch
that's what im currently trying to do
I'm trying to even get it to throw an error to indicate that im actually changing stuff, but despite vencord companion saying the patch is okay, nothing is changing
and yes, the plugin is enabled and im using the right dist
i could be fundamentally misunderstanding something, but this should at least do something right?
patches: [{
find: ":z.roleIcon",
replacement: {
match: "z.roleIcon",
replace: "z.whatever",
}
}],
dont use minified var names
use \i
well that at least got me to a crash
progress
so basically I need to use regex now to lookbehind from here to here? Then I should just be able to inject something else into the second part of the ternary operator?
I could be vastly overcomplicating this but again, I suck at regex
lmao
I mean to be fair there aren't really any docs to go off of here ;-;
at this point it's just regex
what do you want to add
show a mspaint sample
click minimizes role list
like how the channel list works
so you want to add after the - and the digit
yeah pretty much
so u wanna add here
after s
s is the digit
the ternary is the role icon
yup, but the problem is that z.roleIcon seemed to be the only unique thing I could find
match: /" -",\i/,
would probably work for the match query, but the find query can't be a regex according to the type info
ahh okay
patch acts on the found module
hm
don't copy paste what I gave you verbatim 😭
it's a special unicode -
copy from the module
yeah I just checked again
apparently that's an "invalid or unexpected token" though?
do you know how to use regex to replace text
yes
I know how regex works
okay so
the match and replace is literally just code.replace(match, replace)
it's that simple
don't overcomplicate it
try to understand the code
then think of how to best achieve what you want. in your example, you need to insert a $self.renderThing()
think about where exactly you need to insert that code
and then just do it via regex replace
alright
Alright i'm starting to get the hang of it, i'll see if I can get the rest done myself

progress!!
Oh god discord why
roles aren't separated out into separate elements, it's all one huge list of divs, separated by h3 elements
How would I even go about iterating through sibling nodes using react? since im not allowed to do dom stuff, I assume that applies to iterating and setting styles on elements?
Could you find a way to filter the array that's providing the users it's rendering instead?
that's normal
do you not know how react works?
I have pretty limited knowledge of react itself, but I figured it would at least be something like
<div class="role1">...</div>
<div class="role2">...</div>
It is, kinda
{role.members.map(m => (
<div>{m.username}</div>
))}
the code looks something like this
It's more like something like <Component1 value="something">content</Component1>
Or, in compiled code, (0, React.jsx)(Component1, { value: "something", children: "content" })
which transpiles to role.members.map(m => (0,r.jsx)("div", {}, m.username))
you need to find that in code and change the array before it's rendered
hm
so basically every time someone presses the collapse button, I need to mutate the member list array, instead of just doing something like adding display: none?
and then reverse it when they press the expand button
Or just make the function return nothing instead of mapping the list
Mutating stuff is so distasteful
if you wait a bit I'll have a look at the module
but the way you'd do this in react is with a ternary
exactly like this ternary
it renders the roleIcon only if l is not nullish
you need to find where discord renders the role members which will be a .map over an array
ahh okay
that makes more sense
then change it to shouldShow ? members.map(...) : null
(well better would be be shouldShow && members.map())
well luckily there are only two .maps in the entire module, and one of them is right below W.Z.Messages.MEMBERS_LIST_LANDMARK_LABEL, which sounds suspiciously like what im looking for 
if you're lucky it's in the same component and it's gonna be very easy to do
if it's in different components then it's gonna be hard
Well I managed to get it kinda working, there are multiple caveats right now though
- I can't set the iterate amount to 0, because that gets rid of everything, including the header. Only 1+ works ;-;
- I'm not rendering the component again after the iterate amount is changed, it takes a couple seconds currently (not sure if I can?)
- Currently i'm not using the vencordstore to save stuff
- it's ugly
I can fix problems 3 and 4 easily, but I don't know enough about react to fix the other two, maybe I could add a fake hidden user to every separate role?
Also discord freaks out when it doesn't expect the role list to be so short
u need to adjust their math
what math? qwq
don't use that function
findComponentByCodeLazy
settings.use()
in ur component
but that won't work well yeah
if you tweak settings in the modal it doesn't immediately update
we need to rework the settings modal
is there a reason that fakenitro doesn't support soundboard? i'm thinking that you could get the audio file of the sound, and play that into the vc. is there some issue in that
Sounds are server side in discord
plus at that point wouldn’t it just be easier to use an external software and just google to sound you want
that been discussed in a plugin request
Issue #$3
this.
Hello! I have been directed hero to ask for help making my plugin, I'm currently stuck trying to make it work as a plugin after I had made a js snippet because the snippet doesn't persist (the div is gone when changing channels/server). But basically what I'm trying to make is showing the current time in the members list because I use hidden taskbars so 99% of the time I actually never see the clock on my monitors. Here's the git https://github.com/AkiVonAkira/VencordCurrentTime soz for wall o' text
How much information can you get about a message with just the channel and message id? (if any at all)
I'm asking because i'm making a plugin to add more info to the message forwarding component
let's see-
if you can't access the channel, nothing
discord already adds context when you can access it
so doubt you can do anything else
Yeahh i kinda thought as much
time message was sent
Hello! Apologies for my inexperience, this is the first time I'm writing a vencord plugin 😅
I wanted to add an element after the Home / Servers separator, I found what I presume is the source for it:
function a() {
return (0,
i.jsx)(l.H, {
children: (0,
i.jsx)("div", {
className: r.guildSeparator
})
})
}
My idea is to find r.guildSeparator and it works, but I don't really know what to do from here, I've tried looking at some examples but I can't seem to wrap my head around it
could the server list api be what you're looking for? https://github.com/Vendicated/Vencord/blob/main/src/api/ServerList.ts#L35
Ex.: https://github.com/Vendicated/Vencord/blob/main/src/plugins/readAllNotificationsButton/index.tsx#L91 https://github.com/Vendicated/Vencord/blob/main/src/plugins/readAllNotificationsButton/index.tsx#L88
ServerList.ts: Line 35
export function addServerListElement(position: ServerListRenderPosition, renderFunction: Function) {
index.tsx: Line 91
addServerListElement(ServerListRenderPosition.Above, this.renderReadAllButton);
index.tsx: Line 88
renderReadAllButton: ErrorBoundary.wrap(ReadAllButton, { noop: true }),
Oh, I did not know about that! I'll look into it, thanks :D
I was trying to update my randomQuotes PR to work with the latest Discord fixes which broke Vencord a few months ago, and I am using loadingQuotes plugin as template.
My problem is, I think, that the async/fetching part takes too long and the HTML renders before it ends, hence the quote is not shown. The only hacky fix I could think of is to directly edit the HTML of the loading tip, but pretty sure this is not a good idea. Any guidance is welcome, and I'll provide any required info.
quotes.length = 0;
// quote() is an async function that handles the fetching of the quotes and returns a string.
quote().then(randomQuote => {
quotes.push(currentQuote);
quotes = [randomQuote];
////// Hacky fix: Edit the HTML //////
// let elements = document.querySelectorAll('[class*="tip_"]');
// elements.forEach((element) => {
// if (element != null)
// {
// element.textContent = randomQuote;
// }
// });
});
You'd use some react hook for that
Just to clarify: the hacky fix works, thankfully, but I am looking for a better alternative.
useState is quick and easy, but might not be the optimal one
I'll try to research react hooks, then.
I mean, I do not work with JavaScript/TypeScript that much.
This works beautifully! I just have two questions:
- The function should have no arguments, right?
- Does it stick to the top of the server list, or do I need to re-add the component each time a server is added?
- it should be a react component without props
- it will stick, as vencord patches the code that renders and adds it to the dom directly instead of adding it after it's rendered
good answer
All 2 components in Vencord that are injected like that don't take props
Thank you so much :D
I'll see to look more into the API package, didn't know it existed
Actually one last question before I go and keep working on my plugin, I tried embedding icons / css files into my plugin, but I don't think I'm able to? Do I have to embed things like SVGs or CSS code into the index.ts(x) file?
You can import CSS files, with SVGs just embed them in your script (must be .tsx)
Oh okay, do I use like import "cssFileName"?
Yes
Oh okay that makes a lot of sense! 😓 I don't know why I tried to use fetch("/file.css")
can you use LESS/Sass syntax in imported CSS files?
They're css, nothing else
Alrighty, thanks.
If I use a react hook, does this mean I have to modify whatever function handles the loading screen and explicitly return a compoment or whatever to actually use the variable?
The way you ask this is confusing
You need to put the hook inside of the component definition
@flint bronze Referencing this and Kyuuhachi's reply, my bad.
Yes, you'd have to modify the component that renders that part
I see, thank you.
how does one go about making a context menu?
i.e. This is what I mean by context menu, is there a built-in API or do I have to make it from scratch?
Check how discord makes the menu, do the same thing
Just like how do you do literally anything else
I'm pretty new, do I just use react devtools to see how it's made?
Look at other plugins that have context menus ie. VencordToolbox or pindms
Thanks :D
Is there any reference for replacing components/sub components?
patches
how can I manually open this modal?
use react tools, and find the button that opens that modal
you can set breakpoints
I did find it, but I don't understand how it opens it, I'm very new to this
because its most likely going to look like this
where you won't be able to tell what's happening till you look into those functions source code
It looks like this(?)
how would you do that
I would go to the react tools. select the button, log the component
expend > props > onClick, than press function location
this
oh yeah I have found that already, it calls c.Z.openCreateGuildModal
but I'm as stumped as before because I don't seem to be able to find c.Z even with ctrl+f
just use findbyProps
just right click the onClick value lol
and it has the option to jump to the code
wait you can do that...
findByProps("openCreateGuildModal")?
I am dumb..
yes
and there, you found it 
Oh my god 😭 Thank you
this knowledge is very useful
patches: [
{
find: "guild-discover-button",
replacement: {
match: /return[\s\S]*?id:\s*"guild-discover-button"[\s\S]*?}\)/,
replace: "return $self.OwnButtonUserManagement()"
}
}
],
```I am using `Test Patch` with the companion plugin and I'm getting `Patch failed: Replacement 1 failed: SyntaxError: Unexpected token ')'`
I am trying to replace an entire return for a button with my own button, as to override it
return (0,
i.jsx)(f.Z, {
id: "guild-discover-button",
ref: t,
className: r,
onClick: x,
selected: n,
tooltip: I.Z.Messages.DISCOVER,
icon: s.CompassIcon,
...T
})
```This is the return itself
I guess the return[\s\S]* is matching more than you actually want
I mean possibly, I'm expecting it to only match that one return because of the id
as it's matching return <anything> guild-discover-button <anything> })
You appear to be correct.
very faint but it works!
don't use [\s\S]
and you seem to have misunderstood lazy matching
your regex will find the very first return in the entire file, then match everything up to id:
oh fair enough
Why?
there's no reason to ever use that
if you want that behaviour, use the dotall flag and .
but discord's code wont contain newlines
Oh okay, thanks
how to detect onkeydown in a modal?
tried to pass onKeyDown to ModalContent, that didn't work neither wrapping the components in a div
what's the end goal?
Use effect with add event listet
Is there a way to get information about the current user? (Profile name/icon, presence, etc?)
try to look at code of other plugins and figure it out yourself
many plugins that do this
use UserStore and PresenceStore
const CSS_TEMPLATE_STRINGS = {
".SEL_CREATE_SERVER_BTN": "#app-mount > div.appAsidePanelWrapper_bd26cc > div.notAppAsidePanel_bd26cc > div.app_bd26cc > div > div.layers_d4b6c5.layers_a01fb1 > div > div > nav > ul > div.scroller_fea3ef.none_c49869.scrollerBase_c49869 > div.tutorialContainer_c96c45",
".SEL_NAV_FADE": "#app-mount > div.appAsidePanelWrapper_bd26cc > div.notAppAsidePanel_bd26cc > div.app_bd26cc > div > div.layers_d4b6c5.layers_a01fb1 > div > div > nav > ul > div.footer_aa1bff > div.gradient_aa1bff",
".SEL_NAV_BG": "#app-mount > div.appAsidePanelWrapper_bd26cc > div.notAppAsidePanel_bd26cc > div.app_bd26cc > div > div.layers_d4b6c5.layers_a01fb1 > div > div > nav > ul > div.footer_aa1bff",
...
};
```there must be a more version proof way of doing this (doing styling for some specific elements, replacing them in CSS to have more concise stylesheets)
Just patch them to add unmangled classes
wdym
Patch the react components to add classes you can target
oh yeah fair, I could do that
Any idea how I would figure out where roles badges are rendered? I want to render them even when the appearance is set to compact but I have absolutely no idea how I would find what I'm looking for
where do I even start digging
react devtools
i'm unsure which element I should start at
the cozy in this case
Nuckyz showed me a trick a while back, where I can open a module in separate tab which helps in searching for matchs and functions. how could I do that again?
thanks, exactly what I was looking for
what would be an easy way the render the first letter in the chat box uppercase
just patch the component
Damn thats alot of work
ik what you trying to do, I could just make the patch for you
I read fy has "fuck you"
fy as "for you"..
Ik
I mean if you wanna try, like said this is my third time makin a plugin so my patch will prolly be fucked and bad
I dont even where to look for a good way to do this
sorry, I got a abit distracted
here's the patch
{
find: "Messages.CHANNEL_CHAT_HEADING",
replacement: {
match: /(memo\(func.{0,30})(let.{0,20}chatInputType:\i,.{0,25}}=(\i))/,
replace: "$1$self.whatever($3);$2"
}
}
tried to simulate Nuckyz mindset
erm im not my computer, you should fork and pr on the plugin /hj
I would, but if I didn't eat in the next hour I may eat one of my siblings

understand if you don’t wanna ill try to remember to do this in the morning
actually
?remind 1pm #🧩-plugin-development message 
Alright @swift delta, in 11 hours, 42 minutes and 43 seconds: #🧩-plugin-development message 
Oof (unless i did somthing wrong)
define whatever function
you have to have the function in your definePlugin
Thats where im confused gang
actually im to tired for this ill do it in the morning, if he doesn’t pr it
export default definePlugin({
name: "WriteUpperCase",
description: "things",
authors: [],
settings,
patches: [
{
find: "myFind",
replacment: {
match: /^./,
replace: "$self.myFunc(),$&"
}
],
myFunc() {
console.log("1")
},
})
@swift delta
format that
i cant format and do everything in a codeblock 😭
export default definePlugin({
name: "WriteUpperCase",
description: "Changes the first Letter of each Sentence in Message Inputs to Uppercase",
authors: [Devs.Samwich,
{ name: "krystalskullofficial", id: 929208515883569182n },
],
settings,
patches: [
{
find: "Messages.CHANNEL_CHAT_HEADING",
replacement: {
match: /(memo\(func.{0,30})(let.{0,20}chatInputType:\i,.{0,25}}=(\i))/,
replace: "$1$self.whatever($3);$2",
}
}
],
start() {
addPreSendListener(presendObject);
},
stop() {
removePreSendListener(presendObject);
}
});
export default definePlugin({
name: "WriteUpperCase",
description: "Changes the first Letter of each Sentence in Message Inputs to Uppercase",
authors: [Devs.Samwich,
{ name: "krystalskullofficial", id: 929208515883569182n },
],
settings,
patches: [
{
find: "Messages.CHANNEL_CHAT_HEADING",
replacement: {
match: /(memo\(func.{0,30})(let.{0,20}chatInputType:\i,.{0,25}}=(\i))/,
replace: "$1$self.whatever($3);$2",
}
}
],
whatever() {
console.log("Do Something");
},
start() {
addPreSendListener(presendObject);
},
stop() {
removePreSendListener(presendObject);
}
@swift delta
okai that works
uhm, wops..
i got it, now to make it actually do the thing
you got it but I patched in the wrong location lmao
mb.
no worries tho, I just made a patch
you would want to access textValue and modify it.
{
find: "\"Only Ref objects are supported\"",
replacement: {
match: /(\.memo\(\i\.forwardRef\(func.{0,10})var/,
replace: "$1$self.whatever(arguments[0]);var"
}
}
ex
function whatever(props){
props.textValue = "indi"
}

Fuck we are back at square one of crashing
I cant do this iam to tired, ill do it late unless what to pr it
your situation is worst than mined when I started developing plugins..
this plugin was just fucked up to start with
wtf is even happening here?
hell
Look how they massacred my boy
@swift delta, <t:1728436637:R>: #🧩-plugin-development message 
“massacred”? nah… i improved it… except for this shit what I’m trying to do right now is completely fucked
plus you purged this plug-in off the face of the planet, I had a call up on God to be able to find it and resurrected it.
am i wasting my time in adding an rsa mode to InvisibleChat?
my thinking is that aes passwords could be exchanged via rsa every x days
conditional breakpoints are so op
the debugger is so op
for userplugins, yes
just make it different from nin0 and actually have good uptime
host forgejo on github pages
still would have better up time then Nin0
@fallen sandal @fallen sandal I will host you on github pages
vfjd?
No
shoot
vfjd?
No
give me 10mins
vfjd?
No
why
i just noticed something
the picture in picture plugin doesnt respect the video player volume
fixxx @dull magnet
what is the "video volume"
is that the stream volume?
guh
I made a plugin to replace embeds for things like twitter -> vxtwitter etc but it gets rate limited so fast
Also the settings component is a little bit scuffed but it is my first time actually making anything in react so I'll get there eventually
If you opened a channel with like 50 twitter links in it or something it'd just be sending 5 requests, waiting 30-ish seconds for like 5 minutes lol
Is there anyway to block the user to close the modal by clicking "ESC" or clicking outside the modal?
Override the onCloseRequest function in the options object when calling openModal
openModal(()=>null, {onCloseRequest: () => { }})
something like this (don't run this if you don't want an invisible modal you can't close)
You can still close it with closeModal
openModal returns the closeModal key
oh ok thx will do that
one more question, is there any way to dismiss an notification
outside the @api/Notifications?
A brief explanation of my problem:
I am creating a modal, so that the user needs to enter a string, and the plugin will check that string if it is correct or not, and in both situations it notifies the user through the notification system, but what ends up happening that the vencord notification system is working with queue, postponing when a user always enters the wrong string multiple times and then the right one, it will show for some time in the notification that the string they entered is wrong, until eventually the right one appears .
because the only function Im seeing is showNotification()
Does it have to be a notification? TextInput has an error prop that displays a red error text under the input box if you provide one, you could use that
There's a component for validated text input.
is not the validation that is the issue
and yes the notification queueing one after other and not displaying correctly
When I click on the button, if the password is wrong, it will say that it is, the same will happen for a correct password.
However, if I spam the unlock button, notifications will be added to the QUEUE as it will not showing the correct one directly when passcode (string) is wrong or correct.
I just needed to clear the queue and dismiss notifications every time I click the button, is there any function for this?
I don't think you can, I think you're just gonna have to use another method of displaying that it's wrong
Or implement it yourself and PR 
well for now some notifications I do like these
just to you guys get some context, I'm trying to make a plugin that locks discord with a password, not the account one but one that you can specify, like an old betterdiscord plugin called passcodelock.
Anti Stupid Brothers and Kids trying to access ur pc to do shit :)
There is a reason why it isn't in upstream vencord already
It provides no security against a skilled attacker
Is there any reason you'd prefer this over actually locking your computer at the system level?
What happens when you run out of attempts lol
nah, I'm just trying to also for some learning
also, nothing than a refresh to reset the timer

still things that I need to fix but I first want the main funcionality working
correctly without bugs
still would be a fine #1256395889354997771
unofficial plugins channel so good
you could also just make a css rule to html {display:none} making discord blank, and the only way to see it again is to toggle it off via devtools which only someone who knows how to do that would be able to
it also provides deniability so nobody knows it's done on purpose unlike something like a password prompt
Meta plus L on basically any os
Just do that when you’re not looking at the pc and it’ll be anti little brother proof
Also consider: not having such a loser as a lil bro
inspect element goes crazy
if you’re hiding stuff from your siblings or parents then clearly its something not good to begin with
i mean are you gonna be promoting the password on every new window you open or are you going to make it so you type in password and it temporarily suspends that and prompts again after a certain period of time
still has security risk
im not hiding
im only trying to develop an plugin based on an betterdiscord old plugin that I not see in vencord
I mean there is this. I don’t even know if it works anymore though.
i don’t think so.
ok, like I said, though it’s a cool concept it has no place being an actual Vencord tho but would probably be fine being uploaded in #1256395889354997771
yep that’s where it would belong
hold on what happens if you get all the attempts wrong?
there’s 4 attempts right
5 actually
it blocks for 300s
nothing than a refresh on discord clears the block
if im allowed i can show the code
im still need some ideias idk
That’s up to you whether or not you wanna show the code
not a substitute for real security
if you don't trust the people using your machine do not store login info
yes, we know it’s been stated multiple times that it’s no substitution for actual security
I still have to say, though, and I will stand on the fact that it’s a pretty good premise, but it’s also one of those plug-ins that would be best as a #1256395889354997771 having no place being in actual Vencord
well if you really wanna step it up store the attempts through a config file and probably a bool value whether the cooldown is enabled
yea i know people can still find the file, but it’s better than someone just restarting client and bypassing client at least it adds some security
you should make it so people who know how to use inspect element can’t just delete your background screen, along with the box i mean that’s the fastest bypass probably cause all ur doing is adding a overlay
you’re not really disabling anything
oh and discord web exist btw so say goodbye to everything you did also you can disable the plugin, also
i might be dumb but why does this error
export default definePlugin<PluginDef & { languages: Language[]; getAsset: AssetResolver; }>({
i want types for my custom properties in the plugin object
wrong plugin type, its Plugin
uhh from @utils/types ? it's giving me a type error with that lol
wait I may be dumb
lemme test in vscode
its fine for me
@quaint cipher did you add languages and getAsset in the definePlugin?
try pnpm build
also i dont think its possible
it uses regex in the build script
useful if you showed the error
oh yh here
ah
maybe a satisfies statement after the obj?
just a workaround but im not sure if you can use there
hey, i took a look at the code for PronounDB for #🏥-vencord-support-🏥 message
it looks like the patch for compact mode is also applying to "normal mode". would it make more sense to just remove the normal mode patch and have it just show pronouns next to display name? or to try to fix the compact mode patch to only work in compact mode?
the css just needs t obe fixed
Well, I'm not experienced with Discord modding. I never got a response in #🏥-vencord-support-🏥 and idk if I'm supposed to make a GitHub issue since it says not to.
how can i update the message content and display embeds for any links that could be in the new message?
or well, the update message part is trivial it seems, but the embed stuff not so much
Pretty sure embeds are server-side, aren't they?
So you'd have to replicate the link detection
And the data extraction, and the CORS
hey, sorry if dumb question but is there an api for adding a reaction to a message
That's probably just RestApi, and in many cases is probably selfbotting
ah ok. didn't think that would count as selfbotting. good point, thank you
Entirely depends on what you're doing
Adding a single reaction by user interaction isn't self botting for example
But for example something that husks all husked messages would definitely be selfbot
like for example if a person wrote like idk, hello in chat, responding with a wave emoji
Yeah that sounds selfbot
i found that there is an endpoint called /unfurler/embed-urls which i decided to call and that gives me the embed, very nice!
i tried to do a search through existing plugins but i couldn't find anything, how can i listen for new messages and intercept them before they land in the chat? i want to modify the content of the messages 😄
may I ask why?
i am working on a plugin that uses gpg to encrypt/decrypt the chat messages
i managed to use addPreSendListener to modify outgoing messages
but i am looking for a way to now do the opposite
isn't that what invisablechat is?
yeah but that only uses a password, and it doesn't seem to use proper encryption
check the moyai plugin
Or check how invisiblechat does it, even if your actual function is different
invisiblechat doesn't intercept messages, it only gives you a modal to send one
but i want it to be a seamless as possible, as long as you have someone's pubkey
i will check that thanks!
Isnt this just encrytcord https://canary.discord.com/channels/1015060230222131221/1271145508261462149
not exactly, but closer
ok sure then
well my plugin uses the system gpg agent
so you control the encryption keys
actually, encryptcord uses subtlecrypto so idk how that works, but i still would like it to work the way what i am doing it
its probably not very useful but i have friends that actually like this idea and im bored lol
flux interceptor
prob not the best method
but its worth a shot
I would have added them to my Anammox if I had ever seen one
I intend to add them to my plugin inspired by Anammox when they actually make quests that show up on Vesktop
i just remembered I was going to write a credits section in the readme for that
When did they change this to a right pointing arrow on connections?
I fixed Anammox' patches for the emoji list and git button sometime last week btw, in case yours are also broken
when the
That's blurry





