#🧩-plugin-development
1 messages · Page 69 of 1
?
Ah yeah
I've left it so far since it's not super in your face like the other things are
Is there any way to glob all the files in a directory and import them somehow without writing my own esbuild script?
Not that I know, or I'd have used it for my meta loader
How does that work?
is that cjs require 
Better than needing multiple lines per plugin
this is fucking horrifying
this might not be the right channel but why does vencord yoink itself anytime i try to connect to a websocket that isnt localhost?
for clarity by yoink i mean like it doesnt load until i rebuild it without the websocket that isnt localhost
its even on the local network?
I'm inclined to get channels to pop open in a row like threads do but multiplied, kinda hate react though so I wouldn't mind some strategic advice from smart people
Consider unhating react
hi there,
i want to create my own plugin (not necesarly publish it) but i'm not really familiar with vencord and i don't find how and where i can add my code.
if someone can give me a quick resume of how i can manage to do that, it will be really cool !
What are you wanting to make?
Try reading this https://docs.vencord.dev/intro/
i want to add sound effect, like when i write, click or other interactive sound
okay i check it thanks !
Maybe check this out too in that case https://ptb.discord.com/channels/1015060230222131221/1263127508094685255
oh thanks, it's not exactly the sound that i want but this will help me a lot
okay i made it thanks for all, do you think it's possible to add some animation while typing like a little fade in. i add some for loading the chat when you switch between and when you send a new chat but i can't make one for typing
Is there a version of this replugged plugin around?
https://replugged.dev/store/dev.shadow.quicktoggle
I was caught red handed because of a screenshot
It's like F6 to toggle all active plugins on/off and F7 for the theme iirc
Plugins can't be toggled without reloading
The way the plugin there works is apparently it doesn't really unplug, but has some sort of: "act like this isn't enabled" mechanism'
Which would require adding such a mode to every plugin
Fair, but this is the source code
might give any idea
Yep, it does .stop() on every plugin (except itself)
Which is not possible for most vencord plugins without restarting
Fair enough
But what if we could implement hot reloading for the plugins?
Probably a massive pain tho
That would require changing every patch in every plugin to have a play-dead mode
Yeah
which is not worth the effort to maintian because y'all are in servers that do not like client mods
just use a different client if you must screenshot something on your client but don't want to risk anything
I mean tbf, almost all servers get nosy about that
"almost all" none of the ones i'm in care
You hit the server jackpot ig
I've never met anyone who gives a single fuck
They don't give a fuck until some nosy snitch decides to report
the only times i've seen any server actually care is because people are going around and reposting deleting messages
It wasn't even a big deal, the whoreacted plugin
but the server staff weren't too strict about it, so it's whatever
Hey quick question, making a plugin and wanted to know how can i put something below the status of friends in the friend list page?
I know that the sortFriendRequests plugin shows the date the request was received below them by finding .Messages.FRIEND_REQUEST_CANCEL (you can see the result on the first image and second image) but I think it replaces the cancel with that, and what I want is to target the status below the username (look at last picture) and add the new line below.
I basically wanna put the date when a friend added you below the status.
struggling so much
the module for that component is 170245 but i have no idea how you'd write a find string for this module lol
nvm just found out finds can be regex patterns
find: String.raw`/usernameClass:[^,]{0,50},discriminatorClass:[^,]{0,50},showAccountIdentifier:/`,
replacement: {
match: /(?<=className:\i\.subtext,children:)\i,
replace: "$self.renderSubtext($&)",
},
Tried, but it's not showing
Here is the code so far
/*
* 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 { definePluginSettings } from "@api/Settings";
import { Flex } from "@components/Flex";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { RelationshipStore } from "@webpack/common";
import { User } from "discord-types/general";
const settings = definePluginSettings({
showDates: {
type: OptionType.BOOLEAN,
description: "Show dates on friend list",
default: true,
restartNeeded: true
}
});
export default definePlugin({
name: "SortFriendList",
authors: [gii],
description: "Sorts friends by date of addition",
settings,
patches: [{
find: "getRelationshipCounts(){",
replacement: {
match: /\}\)\.sortBy\((.+?)\)\.value\(\)/,
replace: "}).sortBy(row => $self.wrapSort(($1), row)).value()"
}
}, {
find: String.raw`/usernameClass:[^,]{0,50},discriminatorClass:[^,]{0,50},showAccountIdentifier:/`,
replacement: {
predicate: () => settings.store.showDates,
match: /subText:(\i)(?<=user:(\i).+?)/,
replace: (_, subtext, user) => `subText:$self.makeSubtext(${subtext},${user})`
}
}],
wrapSort(comparator: Function, row: any) {
return row.type === 3 || row.type === 4
? -this.getSince(row.user)
: comparator(row);
},
getSince(user: User) {
return new Date(RelationshipStore.getSince(user.id));
},
makeSubtext(text: string, user: User) {
const since = this.getSince(user);
return (
<Flex flexDirection="column" style={{ gap: 0, flexWrap: "wrap", lineHeight: "0.9rem" }}>
<span>{text}</span>
{!isNaN(since.getTime()) && <span>Received — {since.toDateString()}</span>}
</Flex>
);
}
});
I need to go sleep now as it's 4am, but if someone could share some wisdom on why it's not working, I will love you
I have an issue where the component is not updating when its state is changing in a the onChange handler.
what i am trying to do is modify the text value and force update but i am failing.
module number: 287746. responsible for rendering channels text area
oh wow, the screenshots are depressing. thanks discord
Still can't get it to work :(
find: String.raw`/../` what
It works, allows to use regex
I very doubt that
That would search for a discord module containing that regex
Which probably doesn't exist
To use a regex, you'd use a regex
Yes, that finds discord's regex for parsing code blocks
It does not run that regex over discord's code
Got it to work, but it seems to add to requests as well
/*
* 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 { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { RelationshipStore } from "@webpack/common";
import { User } from "discord-types/general";
const settings = definePluginSettings({
showDates: {
type: OptionType.BOOLEAN,
description: "Show dates on friend list",
default: true,
restartNeeded: true
}
});
export default definePlugin({
name: "SortFriendList",
authors: [Devs.Megu],
description: "Sorts friends by date of addition",
settings,
patches: [{
find: "getRelationshipCounts(){",
replacement: {
match: /\}\)\.sortBy\((.+?)\)\.value\(\)/,
replace: "}).sortBy(row => $self.wrapSort(($1), row)).value()"
}
}, {
find: /usernameClass:[^,]{0,50},discriminatorClass:[^,]{0,50},showAccountIdentifier:/,
replacement: {
predicate: () => settings.store.showDates,
match: /(?<=className:\i\.subtext,children:)\i/,
replace: "[$&, $self.makeSubtext(arguments[0])]"
}
}],
wrapSort(comparator: Function, row: any) {
return row.type === 3 || row.type === 4
? -this.getSince(row.user)
: comparator(row);
},
getSince(user: User) {
return new Date(RelationshipStore.getSince(user.id));
},
makeSubtext({ user }: { user: User; }) {
const since = this.getSince(user);
if (isNaN(since.getTime())) {
return null;
}
return (
<span>Added — {since.toDateString()}</span>
);
},
});
patch where the module is used, not where the module is defined if you dont want that to happen
pending 2661
wtf??
150k followers on connected twitter crazy
I'm not entirely sure how
I tried
find: /usernameClass:[^,]{0,50},discriminatorClass:[^,]{0,50},showAccountIdentifier:/
find: ".discordTag,{"
both of which result in it being added to requests
i mean i would hope so considering those finds match the same module
How do I only match the friend list one
Yeah so, I'ts getting both right
go thru where it is used and search thru them and find something that would indicate its the friend list
oh i thought you meant you only wanted it on the left side bar with friends
Isnt it the same element?
Like it's the friend list thing
The friend request plugin for example targets the cancel button
and it gets it to look like this
wait so what do you want to do
Literally this but on friends saying the date you became friends with them
in only this tab?
here?
yup
701861 patch this
oh
My plan was to also add extra controls to sort by Name/Status/Add Date
Would make purging a friend list easier, I've got so many people added from a long time and going one by one is annoying lol
170245
this is what you want
a should be this
and then you can modify it to add something or whatever u want
My bad
noo, this is the module they originally patched 😭
but they diddnt want to do that because it applied to other places
oh
LOL
there's no much escape you can insert something inside that one specific place without patching that module
unless u insert something in the sides
which is then in another module of course
Could you just look at the other children and check for the pending request subtext?
u just need to patch where subtext is beign set actually lol
701861 was right
what did you use?
{
find: "peopleListItemRef",
replacement: {
predicate: () => settings.store.showDates,
match: /(?<=children:.*user:(\i),.*subText:).+?(?=,hovered:\i,showAccountIdentifier)/,
replace: "$self.makeSubtext($1, $&)"
}
}```
```ts
makeSubtext(user: User, origSubtext: any) {
const since = this.getSince(user);
if (isNaN(since.getTime())) {
return null;
}
return (
<>
{origSubtext}
<span>Added — {since.toDateString()}</span>
</>
);
}
You could probably make the match better
Tweaked and now it's working great;
But the sorting by date is not and don't get exactly why:
{
find: "getRelationshipCounts(){",
replacement: {
match: /\}\)\.sortBy\((.+?)\)\.value\(\)/,
replace: "}).sortBy(row => $self.wrapSort(($1), row)).value()"
}
},```
By the way how exactly do I send the plugin to be added to the list of plugins so others can use it?
i feel like this would look way better if you used the original date format
and implement it for blocked, and pending too
Blocked at this time friend request received at this time
What's the original date format?
SortFriendList it showed the date in which you received the friend request in pending tab
nope that’s for your online friends i’m talking about the original plugin that you modified
Format as in
sorry format the exact time in which the friend was added
But format in which way?
You are not being too clear, formatting can be done in many ways, so I need you to be more specific.
Like discord timestamps? This is how requests look:
instead of making it short do
Received - Saturday October 12, 2024
and for Added same thing i suggest implementing time too
if you can it’s not necessary it’s just nice to know exactly when someone added you
It's how it's formatted everywhere
You are getting the same exact information on both, I'm unusre what the difference you see is.
Sat -> Saturday, Oct -> October, 30 is the day, 2024 is the year
yep just looks better by putting it that way
i guess everyone has their own preference
ideally it would just be a timestamp tbh
so u could hover and get more info
If you can figure out how to make this "{since.toDateString()}" the way you think it's better then send it over
^ Still need some help with this as I don't seem to be able to get the sorting right
trying to make a plugin, to stop discord from locking scroll wheel when pressing keys like Shift, CTRL, and Tab i've tried removing the event listener for keydown, and other stuff but that doesn't seem to work
i cant scroll up when holding down those keys
Hello uhm how do I run a function for every message when It's rendered/updated (when its loaded, when its edited, when its send, etc.) and get the element that the message is
Alright-... I'm trying to make something where if you hover text parts of a message that are tone indicators (/j, /srs, etc.) it shows you the full meaning of it in a little tooltip. I have tried going through other plugins and looking what they do but most of them use patches that I cant apply for what I wanna do
The actual hovering part isnt my problem though, Im struggling with selecting message elements in the first place
do you know what patches are
i have a vague understanding of them but i have no idea how to implement them myself
discords code is split up into modules, think of them as seprate files
what patches do is find a module by using a string that is unique to that module
then change the code with regex
alr-
you want to enable the react dev tools in vencord settings
ok
and you can patch things like components to add/remove things
and how do i patch code
specifically in a way that i can run something for each message?
you might want to use a message accessory
a what?
hmm
i want it to be like seamless
so the messages already have tooltips for /j to moment theyre rendered
so you just have to hover them
i dont want users to need to press a button first
i want it to act more like how discords markdown acts
It might be worth checking out how this plugin works https://ptb.discord.com/channels/1015060230222131221/1271080235114434642
Seems to be fairly close to what you want to do
alr thx ill look at it
Ok so Im creating a markdown rule now but it has a patch conflict with one of my friend's markdown plugin
send the two patches
{
find: "parseToAST:",
replacement: {
match: /(parse[\w]*):(.*?)\((\i)\),/g,
replace: `$1:$2({...$3,${patch}}),`,
},
},
theyre both the same but we dont know how to not make them the same
okay...
first of all
what is the contents of patch
my friends one:
Patch: wiggly:$self.rulesByName["wiggly"],highlighted:$self.rulesByName["highlighted"],spinning:$self.rulesByName["spinning"],glowing:$self.rulesByName["glowing"],rainbow:$self.rulesByName["rainbow"],blinking:$self.rulesByName["blinking"],scaling:$self.rulesByName["scaling"],bouncing:$self.rulesByName["bouncing"],html:$self.rulesByName["html"],slam:$self.rulesByName["slam"],cursive:$self.rulesByName["cursive"],
mine:
Tone Indicator Patch: jIndicator:$self.toneIndicatorsByName["jIndicator"],hjIndicator:$self.toneIndicatorsByName["hjIndicator"],sIndicator:$self.toneIndicatorsByName["sIndicator"],genIndicator:$self.toneIndicatorsByName["genIndicator"],gIndicator:$self.toneIndicatorsByName["gIndicator"],srsIndicator:$self.toneIndicatorsByName["srsIndicator"],nsrsIndicator:$self.toneIndicatorsByName["nsrsIndicator"],posIndicator:$self.toneIndicatorsByName["posIndicator"],pcIndicator:$self.toneIndicatorsByName["pcIndicator"],neuIndicator:$self.toneIndicatorsByName["neuIndicator"],negIndicator:$self.toneIndicatorsByName["negIndicator"],ncIndicator:$self.toneIndicatorsByName["ncIndicator"],pIndicator:$self.toneIndicatorsByName["pIndicator"],rIndicator:$self.toneIndicatorsByName["rIndicator"],cIndicator:$self.toneIndicatorsByName["cIndicator"],lIndicator:$self.toneIndicatorsByName["lIndicator"],lyIndicator:$self.toneIndicatorsByName["lyIndicator"],lhIndicator:$self.toneIndicatorsByName["lhIndicator"],nmIndicator:$self.toneIndicatorsByName["nmIndicator"],luIndicator:$self.toneIndicatorsByName["luIndicator"],nbhIndicator:$self.toneIndicatorsByName["nbhIndicator"],nsbIndicator:$self.toneIndicatorsByName["nsbIndicator"],sxIndicator:$self.toneIndicatorsByName["sxIndicator"],xIndicator:$self.toneIndicatorsByName["xIndicator"],nsxIndicator:$self.toneIndicatorsByName["nsxIndicator"],nxIndicator:$self.toneIndicatorsByName["nxIndicator"],rhIndicator:$self.toneIndicatorsByName["rhIndicator"],rtIndicator:$self.toneIndicatorsByName["rtIndicator"],tIndicator:$self.toneIndicatorsByName["tIndicator"],ijIndicator:$self.toneIndicatorsByName["ijIndicator"],mIndicator:$self.toneIndicatorsByName["mIndicator"],liIndicator:$self.toneIndicatorsByName["liIndicator"],hypIndicator:$self.toneIndicatorsByName["hypIndicator"],fIndicator:$self.toneIndicatorsByName["fIndicator"],thIndicator:$self.toneIndicatorsByName["thIndicator"],cbIndicator:$self.toneIndicatorsByName["cbIndicator"],
@lapis fable unrelated to the patches colliding
use a spread operator
and a function called with self
every time i try to use spread operators it just kinda screams at me (vscode)
show the error
it just inserts the markdown rules
do you really need a separate rule for each one
just make one for anything that could be a tone tag, then filter them out later in your own code
where do i see the plugins that break after discord updates?
oh nevermind it's the channel under this one i'm stupid
wait no that's general changes
look in #👾-core-development for Vencord Reporter
okay thanks :D
alr i did that
but now the patch isnt working
send patch
patches: [
{
find: "parseToAST:",
replacement: {
match: /(parse[\w]*):(.*?)\((\i)\),/g,
replace: "$1:$2({...$3,toneIndicator:$self.getToneIndicator,}),",
},
},
],
@lapis fable upload your complete plugin code
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import { React } from "webpack/common/react";
const test = (data, output) => {
return <span>{output(data.content)} skiibid</span>;
};
/* function toneIndicator(short: string[], long: string, sourceDisplay: string, source: string) {
return {
short: short,
long: long,
sourceDisplay: sourceDisplay,
source: source
};
}
const ti = ["toneindicators.carrd.co", "https://toneindicators.carrd.co/"];
const toneIndicators = [
toneIndicator(["j"], "joking", ti[0], ti[1]),
toneIndicator(["hj"], "half-joking", ti[0], ti[1]),
toneIndicator(["s"], "sarcastic", ti[0], ti[1]),
toneIndicator(["gen", "g"], "genuine", ti[0], ti[1]),
toneIndicator(["srs"], "serious", ti[0], ti[1]),
toneIndicator(["nsrs"], "non-serious", ti[0], ti[1]),
toneIndicator(["pos", "pc"], "positive connotation", ti[0], ti[1]),
toneIndicator(["neu"], "neutral connotation", ti[0], ti[1]),
toneIndicator(["neg", "nc"], "negative connotation", ti[0], ti[1]),
toneIndicator(["p"], "platonic", ti[0], ti[1]),
toneIndicator(["r"], "romantic", ti[0], ti[1]),
toneIndicator(["c"], "copypasta", ti[0], ti[1]),
toneIndicator(["l", "ly"], "lyrics", ti[0], ti[1]),
toneIndicator(["lh"], "light-hearted", ti[0], ti[1]),
toneIndicator(["nm"], "not mad", ti[0], ti[1]),
toneIndicator(["lu"], "a little upset", ti[0], ti[1]),
toneIndicator(["nbh"], "vagueposting/venting directed at **nobody here**", ti[0], ti[1]),
toneIndicator(["nsb"], "not subtweeting", ti[0], ti[1]),
toneIndicator(["sx", "x"], "sexual intent", ti[0], ti[1]), // brother ew
toneIndicator(["nsx", "nx"], "non-sexual intent", ti[0], ti[1]),
toneIndicator(["rh", "rt"], "rhetorical question", ti[0], ti[1]),
toneIndicator(["t"], "teasing", ti[0], ti[1]),
toneIndicator(["ij"], "inside joke", ti[0], ti[1]),
toneIndicator(["m"], "metaphorically", ti[0], ti[1]),
toneIndicator(["li"], "literally", ti[0], ti[1]),
toneIndicator(["hyp"], "hyperbole", ti[0], ti[1]),
toneIndicator(["f"], "fake", ti[0], ti[1]),
toneIndicator(["th"], "threat", ti[0], ti[1]),
toneIndicator(["cb"], "clickbait", ti[0], ti[1])
]; */
export default definePlugin({
name: "ToneIndicators",
description: "Adds descriptions when hovering over tone indicators.",
authors: [Devs.Jaegerwald, Devs.Zoid], // crediting zoid cause this is based off moremarkdown
patches: [
{
find: "parseToAST:",
replacement: {
match: /(parse[\w]*):(.*?)\((\i)\),/g,
replace: "$1:$2({...$3,toneIndicator:$self.getToneIndicator,}),",
},
},
],
getToneIndicator: {
order: 24,
match: source => { console.warn("i swear to god if this warn doesnt appear in the console even though this should run for every message"); return source.match(/[\s\S]*/); },
parse: (capture, transform, state) => ({
content: transform(capture[1], state)
}),
react: (data, output) => test(data, output),
},
});
(that plugin won't be accepted btw if that matters)
its fine its for a fork of vencord
💀
this is just
wait what
is this just WigglyText's patch
which is horribly broken
@lapis fable this is not good code, but it works
woah
@flint bronze rate the horror
thx so much lol
i can barely understand with all the placeholders
oh, you dont see the actual markdown rule in the preview
i know it's stupid but I want to remove the keyboard shortcut if it's locked to some dumb modifier
well
I have it mapped to a key that is hard to press (on a different layer)
ideally I want to hook it up more like a video conferencing solution where you can PTT with just space bar on a voice page
idk why that isnt a thing in Discord
this could be useful on Vendroid (for the 2 people who use it)
no useless button i use keybind personally but id hate to press a button each time just to talk
i really think you could expand that edit you did on voice utilities by adding a button to manage rather than right clicking context menu
like Mute all in Call (Locally), Mute all Soundboards, Disable all Cameras, and the other stuff i guess maybe exclusions too that’d be way more convenient than the PTT
+1 id use
that would be useful if vendroid had vc
?remindme 2d emote cloner bulk import from other server
Alright @flint bronze, in 2 days: emote cloner bulk import from other server
theres a js snippet for that
also ratelimit
(downloading zip, not uploading them)
I know
I'm trying to send a message replying to something else (just text content, no attachments or funky stuff), and iirc someone told me the only way is to do something similar to this
pretty much everything is fine, but i want to check which flags i should pass (more specifically if it varies because a voice message is being sent in the reference)
you only have to send the content and message reference
nonce is optionally but you can do it to keep it inline with what the rest of the client does
Hello! I have a quick question to plugins. Is there a way to detect when the User exits the config menu of the Plugin? Like when the "Save & Exit" button is pressed? And that this action can be used to execute a function?
I believe the onChange function of each setting is executed when the save button is clicked
How would i write that in Code? Could you give me an Example?
I'm not at my PC right now so I'm speaking from memory and could just be completely wrong but if you had
someSetting:{
type: STRING,
...
onChange: newValue => {
// do something with the new value of someSetting
}
}
I think onChange runs on save
np 
Hi
I've just found something that is Not used
And that some people will use
There is this data in group calls
{
//...
"call": {
"participants": [
"806442568564604968",
"881574130573508748",
"862738768183296061"
],
"endedTimestamp": null,
"duration": null
},
//...
}
There should be some icon next to call
(On call that ended)
can you be more clear, are you requesting a feature?
Making view as role available for everyone is causing me pain because of course it is this is discord
it changes the permissionstore depending on what roles you are viewing as, which is annoying because you don't actually have access to those channels
so i can't just steal patches from ShowHiddenChannels
if it only fucks with the PermissionStore maybe I can get around it by calculating the permissions manually but i'd rather not do that
i thought this was gonna be a small little silly plugin with a couple patches but i don't get that luxury
psst: it's alresdy inbuilt into PermissionViewer
RolesAndUsersPermissions.tsx: Lines 225-246
{(settings.store as any).unsafeViewAsRole && (
<Menu.MenuItem
id={cl("view-as-role")}
label={i18n.Messages.VIEW_AS_ROLE}
action={() => {
const role = GuildStore.getRole(guild.id, roleId);
if (!role) return;
onClose();
FluxDispatcher.dispatch({
type: "IMPERSONATE_UPDATE",
guildId: guild.id,
data: {
type: "ROLES",
roles: {
[roleId]: role
}
}
});
}}
/>
)}
mm
i thought making a version of this that doesn't send invalid requests would be easier
😔
Its just some big task that i thought would've been way smaller, basically its looking like stealing basically every ShowHiddenChannels patch and modifying the check to manually calculate permissions.
And this all assumes that it only messes with PermissionStore and not GuildStore and ChannelStore
I would wrote the credits in a comment
Calculating permissions manually doesn't seem that bad (and looks like the only option) and duplicating ShowHiddenChannels patches is annoying because well... they'll be 2 of them!
(and this is stuff I only have discovered yet, maybe theres other stuff thats also annoying af that needs patching, like accessing automod rules and shit)
This just isn't worth it 😔
is the plugin fully functional yet?
As in you can actually view server as role without permissions to do so normally? yes
my next step would be clean up. are you like copying the patches as is or have modifications on them?
because you can have shc as a dependencie
Well I would need to duplicate them because not every user would have both ShowHiddenChannels and this plugin on & ShowHiddenChannels isn't even enough because it relies on the PermissionStore (which discord changes with this feature)
and this function would also need changing in the copied version to manually calculate the permissions instead
And like I said before this doesn't count like the guild settings menus that you shouldn't be able to access normally without permissions (expressions, automod etc etc)
Its a big project for something that would not make it into vencord
is there a documentation on the functionality of different stuff being imported like for example define plugins settings all the attributes?
look at other plugins
the source code is your documentation
search interface PluginDef
alright thanks
and i understand patches a little bit but how would i get regex or whatever because there’s a certain replacement pattern
i have an understanding of how to find stuff but replacement there’s a certain pattern you need
i meant like i wanna learn regex. where would be a good place for that?
youtube videos, than practice
I used to look at this when starting, reading "Contributing a Plugin" section. @normal wagon throwing it here because maybe others will see it useful
that’s perfect thank you
ez 
thats fine until you realise that one of the functions has to be modified (unless that can also be done) and not all patches need to be used
I'm kidding anyway but I think it would point $self to your plugin anyway so you'd have to implement any functions SHC does
If that line would even work in the first place
No, i'm just saying that because i randomly discoverd that yesterday
I will try making it myself
hello i added a command and i cant use it (doesnt appear) although ive rebuilt and reinjected vencord, the plugin is enabled
nvm it just appeared somehow 😭
okay so it only works on servers
and i want it to be usable everywhere
okay i got it 🔥
@flint bronze, <t:1729400994:R>: emote cloner bulk import from other server
do you guys know how i could add users profile pictures next to messages
clueless?
im gonna make it
no im not
this is not worth it
i would end up just wanting to refactor the mess that is the existing plugin
Do
You serious? You want to see a refactor of EmoteCloner?
With a few extra features
I don't care about that plugin
But I like seeing people doing probably unnecessary work
"probably unnecessary" soft-fork with some 20 original tiny plugins
My emote cloner PR:
I just found it and idk how to say this but I find it kinda funny that one of the places you fixed got removed from discord 
oh i see
you nuked it already
since a month ago

Is this not just basic react
Hello, I am learning the vencord api by looking at other plugins, however is there any definitive documentation of the vencord api I can read?
pretty much https://docs.vencord.dev/ & just reading plugins code to see how they work
> 3 │ import definePlugin, { OptionType } from "@vencord/types/utils/types";
> ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> You can mark the path "@vencord/types/utils/types" as external to exclude it from the bundle, which will remove this error.
>
> 1 error
How do i fix this?
I assumed vencord used webpack so i marked it as external under webpack.config.js but that didnt work
It should just be "@utils/types"
I had that, nodejs kept on giving me errors
as it isnt a package
is there any way to fix that error?
like link vencord and @utils
It should be like this in your tsconfig.json
With the same path?
Wait no
in node_modules/@vencord/types/utils/types
I don't think vencord should be in your node modules folder, these are just pointing to directories in the /src folder
Unless this is something related to vesktop or something? I'm not familiar with that
I am developing this outside of the vencord directory
uhhh, I am using something called nixcord which manages plugins declaratively, so i cant develop inside the files themselfs
But anyways i got it working so thanks
I see
> 5 │ ...chCallback, removeContextMenuPatch } from "@utils/api/ContextMenu";
> ╵ ~~~~~~~~~~~~~~~~~~~~~~~~
>
> You can mark the path "@utils/api/ContextMenu" as external to exclude it from the bundle, which will remove this error.
>
"compilerOptions": {
"paths": {
"@utils/types/*": ["./node_modules/@vencord/types/utils/*"],
"@utils/api/*": ["./node_modules/@vencord/types/api/*"],
"@utils/api/ContextMenu/*": ["./node_modules/@vencord/types/api/ContextMenu/*"],
}
},
}```
Sorry for being back so soon but I tried like 5 different combinations
Why is it saying contextMenu is not excluded
Nope, i tried:
"@utils/api/ContextMenu/": ["./node_modules/@vencord/types/api/ContextMenu/"],
same error
"@utils/api/ContextMenu" doesn't have a slash at the end though so it doesn't seem like that'd pick it up
If i have that, i get this warning in my code:
Cannot find module '@utils/api/ContextMenu/' or its corresponding type declarations.
Just to clarify from the beginning, have you done
in your code: ... from "@utils/api/ContextMenu";
in your config: "@utils/api/ContextMenu": ["./node_modules/@vencord/types/api/ContextMenu"],
I tried that
I would've though "@utils/api/*" would've picked it up anyway tbf but yeah I don't know enough about this then, sorry
Oof
Anyone able to help with my issue?
Oh your paths for /api/ have /types/ in them, that shouldn't be there, right?
The @utils path or the @vesktop paths?
For the @utils path it doesn't matter
For @vesktop I need to get the correct path to context menu which I did
> 5 │ ...chCallback, removeContextMenuPatch } from "@utils/api/ContextMenu";
> ╵ ~~~~~~~~~~~~~~~~~~~~~~~~
>
> You can mark the path "@utils/api/ContextMenu" as external to exclude it from the bundle, which will remove this error.
>```
"compilerOptions": {
"paths": {
"@utils/types/*": ["./node_modules/@vencord/types/utils/*"],
"@utils/api/*": ["./node_modules/@vencord/types/api/*"],
"@utils/api/ContextMenu/*": ["./node_modules/@vencord/types/api/ContextMenu/*"],
}
},
}```
Anyone able to help?
?
I read both of those pages. It didnt tell me how to fox my issue unfortunately. Also I don't know who made that tool, I don't know if discord or vesktop is the one to use it. I assumed it was tsconfig that I had to edit but maybe I'm doing something wrong?
the docs dont tell you to do whatever the hell this is
follow the docs and you will have no problems
The maximum the docs mention is:
export default definePlugin({
name: "MyCoolPlugin",
description: "I am very cute!",
authors: [Devs.YourName],
});
And tsconfig is needed like this because vencord changes the location of its api to be in @utils and not in node_modules/@vesktop
This feels like some weird webpack issue anyways
do not use webpack
follow these docs
for setting up a vencord clone ready to develop
I dont use webpack
I was guessing what was the cause of the issue
Also I assume your talking about skipping the tsconfig bit and just putting my project inside the plugin folder
dude this is the vencord server not "nixcord"
you can use whatever you want to use but don't ask for help with that here
go ask the authors of that tool
if you want help here, you do it the official way and follow the docs
if you want to do it differently, don't ask for help here
you wouldn't have any of the issues you're describing if you followed the official method
then why are you asking for help here
Ok I cloned vencord, I built vencord and set a new destination for the install of vencord under vesktop
@utils does not refer to anything, so I need to keep tsconfig.json, I am having @utils refer to ../../utils/* where all the utilities are kept
for the love of god delete everything you have done and follow the docs for setting up a proper clone
you will have 0 issues
I fixed these issues
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
How come neither "test" nor any message is sent to the console?
did you enable your plugin in settings
I mean maybe im in the wrong place for what im trying to find
yes ofc
I mean, it should still print
as i open context menus
its not activating at all
try this instead
const patchContextMenu: GlobalContextMenuPatchCallback = (navId, children) => {
// Search for the element with the class 'peopleList_e0840f'
const targetElement = children.find(child =>
child?.props?.className?.includes('peopleList_e0840f')
);
console.log("test")
// Log the target element if found
if (targetElement) {
console.log('Found the element with class peopleList_e0840f:', targetElement);
} else {
console.log('Element with class peopleList_e0840f not found in this context menu.');
}
};
also
Hm.
note
- const patchContextMenu: GlobalContextMenuPatchCallback = (navId, children) => () => {
+ const patchContextMenu: GlobalContextMenuPatchCallback = (navId, children) => {
Sorry for being stupid again but uhh, I'm trying to make a plugin to always show blocked messages, and I want it to skip the part where it checks if a message is blocked? Is that possible?
look at the code of NoBlockedMessages and see how to detect blocked messages and instead of hiding it make it auto expand
I did earlier, but I dont understand what the patch does at all
You can keep the sounds if you install CustomSounds plugin @hollow jetty I sent the links in #🎨-theme-development

Where is that plugin
not part of official vencord.
It's not official
Don't tell us it's hosted somewhere in your highly modified Equicord install
no
i just know of a plugin that exist under that name i don’t use it or anything i’ve just heard of it

Hey everyone,
This is my first time making a vencord plugin I had an idea and design. I want to make a HTML Preview plugin I currently have the button working but can't figure out how to make a div that I can apply the html content to. Anyone a idea on how to accomplish this.
Does it support scripts
what are you doing that you need something like this
I just have a bot that send html content to a message of ticket transcript and it would be fun i could directly see it in discord
Make it send a rich embed instead
Or an image
A bot that is unusable without incredibly unsafe client plugins is not a good bot
you could probably just patch how embeds are rendered in the client if you want to do this
its just so niche
also leads the question of what can be exploited by you supporting this
Sounds like what you need is to load attachments in an iframe instead and use a native script to modify Content-Type headers
hold on
Correction
You need to remove Content-Disposition header
Could you help me more because its my first plugin
I think you need to consider both situations of attachment VS codeblock
What do you want to start with
Also, I think someone's made an SVG preview plugin before, though I don't know where or when
Regarding this, is this a mockup or do you already have code doing this but static?
Yes this is a mockup i made i want it to have this as end result
Hi so is there any solution for communication between index.ts and native.ts since they both only have access to their own API's
for example if i set off a modal with index.ts and the user clicks "Delete File" then i have to use the fs library for node js what should i do?
create a function in native that would take the path (aka string) and call it in index.ts
So like export a function in native and use it in index.ts
i thought that would make it so the function only has access to what index.ts has
since you cant use Node APi in index.ts when you import the function from native it'd still be limited to index.ts
you could check how plugins use native, chek the translator plugin
Okay thank you 🙏
I dont think that works unless im doing it wrong
show code, that could be helpful
//index.tsx
import definePlugin from "@utils/types";
import nativeRead from "./native";
export default definePlugin({
name: "testplugin",
description: "description",
authors: [{ name: "Ce", id: 615999706836893720n }],
start() {
console.log("yessir vencod");
console.log(nativeRead());
},
stop() {
console.log("exiting");
}
});
//native.tsx
import { readFile } from "fs";
export default function nativeRead() {
readFile("/text.txt", (err, data) => {
if (err) throw err;
return data;
});
}
✘ [ERROR] [plugin ban-imports] Cannot import node inbuilt modules in browser code. You need to use a native.ts file
src/userplugins/discordTouchBar/native.ts:7:25:
7 │ import { readFile } from "fs";
╵ ~~~~``` during build
your file is named native.tsx
the x in tsx has a special meaning: it enables JSX syntax
there's no need for that syntax in native scripts so it's not supported
I meant to type native.ts the only one ending in Tsx is index
I don’t think it works because I’m trying to use a function that uses the node API inside of index.tsx?
you dont import the native file
you are treating a callback like an awaited promise
try an async function and use await readFile
import from fs/promises not fs to do this
look at any other plugin that uses native.ts to understand how it works
https://github.com/Vendicated/Vencord/blob/main/src/plugins/openInApp/native.ts#L27-L31 this is a good example
native.ts: Lines 27-31
export async function resolveRedirect(_: IpcMainInvokeEvent, url: string) {
if (!validRedirectUrls.test(url)) return url;
return getRedirect(url);
}
Okay thanks but I can use node api in index.ts as long as I export the function from native.ts
yes
index.ts: Line 78
const Native = VencordNative.pluginHelpers.OpenInApp as PluginNative<typeof import("./native")>;
Okay bet
I want to read more about how that works under the hood but I don’t know what to search because when I think about it if index.ts only has access to browser api I don’t understand how importing from native will give the imported function access to the api
Do you know what might cover these questions that I could go read?
native.ts: Lines 27-31
export async function resolveRedirect(_: IpcMainInvokeEvent, url: string) {
if (!validRedirectUrls.test(url)) return url;
return getRedirect(url);
}
index.ts: Line 78
const Native = VencordNative.pluginHelpers.OpenInApp as PluginNative<typeof import("./native")>;
index.ts: Line 128
url = await Native.resolveRedirect(url);
the first one is your native file, the second and third are how you call native exported functions in your index file
It's effectively a friendly wrapper around Electron IPC
Ohh okay so vencord added a workaround since I can’t Do what I was trying to do in a simple way?
this is the simple way
index.ts is a web browser (literally chrome)
it has no nodejs
it doesnt know what nodejs is
Right
well
native.ts runs in a different nodejs process
It's a simple way to interact with it
you cant share data between the two directly
you can only do that via IPC (inter process communication) by sending messages to the other process
I see
normally that's more work but Vencord autogenerates IPC bindings for you on VencordNative.pluginHelpers.PluginName
so if your plugin is called CecePlugin and your native.ts file exports a method called eatBananas, then you can call that method via VencordNative.pluginHelpers.CecePlugin.eatBananas()
How long have you been coding for? I feel so dumb sometimes I’ve been trying to read up on everything for a while but I always find myself running into issues I can’t really put into words to learn about
since 2020
You both seem really good do you have any advice on what I should look into to understand all this more because right now I’ve just been reading JavaScript.info which isn’t node related
stop reading random stuff and just come up with a project idea
learn by doing
reading a thousand recipes isn't how you learn to cook
the way you learn to cook is that you pick one recipe, look up how to cook that, and then do it
it will probably be meh the first time but if you cook it a few more times you will get better
similarly, don't aimlessly read guides and such
instead, pick one project idea. anything. a website. a (discord or other app) chat bot. a small 2d game. a shell script. a gui app. ANYTHING
come up with any idea you find interesting. and optimally one that solves something you actually need. start off with a smaller project, don't go super crazy
then look up how to do that specific thing. read a guide on how to make that specific thing. then just start building. it will be poopy and you will get stuck, but whenever you do, look up solutions online or ask a friend. once you learned, you will likely realise your old code sucks ass so you will rewrite it from scratch with your new knowledge
the initial vencord code was hot garbage so i rewrote it from scratch
Protip: don't be ashamed that your code is hot garbage. There does not exist code that is not hot garbage
^
sometimes i push code to vencord and the next day i look at it and wonder what the fuck i was smoking
Loool
it happens less the more experience you have but even then it still happens
But for example let’s say I ran into this issue that we were discussing I have no idea what IPC is and I had no idea that was the solution so how would I coke across that naturally?
bro this is advanced stuff it's not the right project for a entry level dev
Also If you need to send from native to renderer async, (for example, you implement a server that can allow other programs to control Discord) make a function that takes the arguments[0].sender.executeJavaScript function, saves it to a variable, and call a function exported in your plugin definition object, and call it in your plugin start function
There's no proper example for doing this in Vencord itself, just treat this like running eval to set a variable (use JSON.stringify twice on your data, for example). Don't accidentally make remote code execution.
https://github.com/Vendicated/Vencord/blob/main/src/plugins/consoleShortcuts/native.ts#L10 is the closest example of doing this in Vencord itself, it doesn't actually send any data though
native.ts: Line 10
const handleDevtoolsOpened = () => e.sender.executeJavaScript("Vencord.Plugins.plugins.ConsoleShortcuts.eagerLoad(true)");
yop
though
vencord taught me regex
please scrutinise this
It's not dumb to start with something advanced
It's GOOD to build something practical
I just can't with example guide to building [x]
Also after reading what you said way earlier, be careful regarding path traversal (adding ../../../someOtherFile) especially if it's a text field
Read that as meth 😭
So Electron IPC is something that lets the chromium instance electron makes communicate back and fourth with Node?
Yes
If you're interested in the details of how that works (for other projects, you won't be needing this here), see https://www.electronjs.org/docs/latest/tutorial/ipc
Use the ipcMain and ipcRenderer modules to communicate between Electron processes
anyway, what are you actually trying to build?
what is your plugin trying to solve
I just bought a MacBook Pro with a touchbar I’m trying to integrate the touchbar with discord
For fun
I’ve been using Js for a few years off and on but I’ve never really done anything to advanced I’ve really only made Full stacks for some people every now and then
I don't actually know how you'd do that, specifically how to get the BrowserWindow of Discord
oh
A while ago, I made a plugin that added embeds for svg, avif, animatedwebp, and other file formats like that. Do you want to see the source code for it?
you probably just want to listen to browser-window-created events on the electron app object @green vessel
Create TouchBar layouts for native macOS applications
instead of using app.whenReady promise to create a window use the event's 2nd argument as the window
native.ts: Lines 10-27
app.on("browser-window-created", (_, win) => {
win.webContents.on("frame-created", (_, { frame }) => {
frame.once("dom-ready", () => {
if (frame.url.startsWith("https://www.youtube.com/")) {
const settings = RendererSettings.store.plugins?.FixYoutubeEmbeds;
if (!settings?.enabled) return;
frame.executeJavaScript(`
new MutationObserver(() => {
if(
document.querySelector('div.ytp-error-content-wrap-subreason a[href*="www.youtube.com/watch?v="]')
) location.reload()
}).observe(document.body, { childList: true, subtree:true });
`);
}
});
});
});
see here for sending data back when pressed
you won't be needing to send arbitrary data for this afaik
@green vessel what do you want to display on the touchbar
this might be a bit of a lie
Yeah sure every bit will help
I’m thinking guilds deafen and mute and some other things I’m still coming up with the design thanks for the advice too
If I listen for the electron window created event will that initiate the touchbar window when discords window is created?
if you associate the touchbar with the window it should
you will need to listen to some flux events to update the touchbar
Wouldn’t the plugin be started after the window is created though
No, it'd be even earlier than that. Do note you are effectively building a plugin that can't be turned off
Maybe consider checking if your plugin is enabled in your functions
Is there a way you could look for it again because then i can see how he did it
Ask @hushed loom
Flux is the system discord uses for events such as when messages are sent, lots of things actually
Ah
You will find flux events being listened to and action being taken upon them in a significant amount of plugins
Thanks bro ur goated
Search for flux: and FluxDispatcher in the Vencord source to see examples
He is offline 😞
i'll have a look
It's not on his github (from my brief search)
wait
I found https://github.com/sadan4/Vencord/blob/c28a971f0e8762b3f395d354fdb67fa13fb508f9/src/plugins/renderMoreMedia/index.tsx but I don't think this will be very helpful
The cutest Discord client mod. Contribute to sadan4/Vencord development by creating an account on GitHub.
I will have a look thanks maybe he wants to collaborate :)
yeah like you said i didn't get anything useful out of this. I just need it to create a div below the message where it grabs the html content from.
this is want i have now
If you still want that SVG preview plugin and I haven't sent it within an hour or two, just ping me a bunch.
i already got it
@hushed loom You wanna work with me on this plugin :)
Alas, creating divs is the one thing js cannot do
hey im trying to do what spooktober recommended but its undefined in the console
const Native = VencordNative.pluginHelpers.TouchBar as PluginNative<typeof import("./native")>;
//native.ts
export function nativeRead() {
console.log("testing");
}```
just note, you must reinject vencord every time you make changes/create native's
Your plugin name is TouchBar yes?
No does it have to match my pluginName
no?
Yes
is that enforced by vencord or its part of JS/TS
Vencord
Ah
Got it working im usign a api to generate the html to a image. im now using a paid one im currently setting up my own
that’s pretty smart
that’s just an image though right
it’s more safe i guess but let’s say ur wanting to test an html element
yeah it is :)

why the hell
literally just render the html
yeah i was trying but dident know how
so thats the why
Including scripts?
Either send to a weirdo service to sandbox, or sandbox/sanitize yourself
ever heard of this wonderful thing called iframes with permission policy
i know but dont know how to create it with a plugin first time making a plugin
if you set iframe sandbox permissions to none and set a strict csp on the frame (only supported in chrome), it's safe
learn basic react first
To lazy rlly
or use raw dom manipulation
if you don't care about submitting it to be an official plugin
it likely won't be accepted either way from what I heard so far
but like i think i now on how to make it in react but i dont know how to do it with a vencord plugin
look at any other plugin
Could find any that does but i wil have a look again
i have no idea to do its and cant find any that have done it
You are absolutely right I found it it was even easier too and topper thanks :)
I did something similar as my first plugin too, I did mine via iframes
I didn't know as much then so it's a message accessory placed under each codeblock with a react portal
Any possible way to grab discord browserwindow?
xyproblem https://xyproblem.info/
what are you trying to do
Access the browser window discord uses to use a method on it
what method?
Attach a electron touchbar to it
Instead of creating a new window
İs there a way to sene notification to the system (not in @api/core)
notifications api
I said "not in @api/core " because its only in app notification (on webcord)
the proper way to do it is the notifications api, it does send a system notification when the windows isnt focused
When I tried it, it only showed it in the application (maybe stop when you use arch linux)
since you said webcord, it could just be that it doesnt run vencord's native.ts stuff so system notifications can't be displayed
So is there a proxy setting in the Vencord application?
?
Im in Türkiye, in Türkiye discord is banned, im loggin in with tor proxy
Is there a way to add a button to the files like the design
patches
find the code of the component with react devtools and add a child to it
Where can i find it src
?
Ohh nvm thanks
Oke so im not greate with docs but i need to find a class name where the button is in and use that for the find value right
is there a way to get the discord build hash
click the source button
Uhh where ?
oke yeah found it and now ?
patch it
you can take a look at other plugins that add things to the ui
in code i mean
that seems to be hardcoded
what im trying to do rn is this but it has no effect apparently
patches: [
{
find: /.log\("[BUILD INFO]/,
replacement: [
{
match: /Build Number: "\).concat\(("\d+")/,
replace: "Build Number: \").concat($self.setBuildNumber($1)"
},
{
match: /Version Hash: \"\).concat\(("\w+")/,
replace: "Version Hash: \").concat($self.setVersionHash($1)"
}
]
}
],
setBuildNumber(buildNumber) {
return BUILD_NUMBER = buildNumber;
},
setVersionHash(versionHash) {
return VERSION_HASH = versionHash;
},
yeah i was already doing so maybe you could make the patch ting for me so i can see what you did and so on
findByCode("logsUploaded:new Date().toISOString(),")
anyway to access discords browserwindow?
try searching the server first
Oh yea
No I read that but I was in the car
Can I get discords browser window listening for that event?
You should be able to?
Okay bet I’ve been looking at it all day and all i couldn’t find anything
Only other way was to use remote to access it
Which was deprecated
Incase that doesn’t work I was trying to create a second window that’s hidden but when I did that the touchbar turns off if I’m not focused on that window

And I’m guessing there’s no solution to that right
like this?
I made a plugin that adds this copy file contents button you could probably use as a reference
does anyone know how discord determines whenever you completed a quest? I thought it's via flags similar to other badges but it isnt apparently
Yeah i saw it was nice but i only want it for html files and i was trying to get the FileExtentions but could
i hope discord explodes
some badges use user flags to determine whenever they should be added and some use a completely other method
like the 'quests' or 'originally known as' badge
there is a plugin called something like ShikiCodeblocks that might do what you want
like without making a new plugin
Oke but i saw you got the values FileContent and BytesLeft how did you get that because i dont need the BytesLeft so i was trying to changes that with FileName but it didn’t work
open dev tools and press ctrl+shift+f to open search, and search the find value in the patch
Okay yeah i found this then
let {url: t, fileName: n, fileSize: a, transitionState: s, language: o, fileContents: u, bytesLeft: c} = e
, [d,_] = i.useState(o)
, p = null != u ? u : "";
return 0 !== c && (p += "... ".concat(f.Z.Messages.PREVIEW_BYTES_LEFT.format({
formattedBytes: (0,
E.IC)(c)
}))),```
window.GLOBAL_ENV.SENTRY_TAGS.buildId
also works
can i use a patch to modify what is returned when getting a field?
Sure, but more common would be changing either the thing that sets the field, or the thing that reads it
id like to cosmetically change aspects of users
Sure, patch the component
{
find: "getUser:",
replacement: {
match: /(getUser:)(\i),/,
replace: "$self.getModifiedUser($1),"
}
}
?
Sounds like a good way to potentially brick your discord if you're careless
ah
Plus that's invalid
Replacing getUser: function(...) with $self.getModifiedUser(getUser:)(...) should be self explanatory
Not sure if it's a function expression or just a variable name there though, depends on what exactly you're patching
id just like to modify some fields?
Modifying fields on discord's data stores is always risky
Better to just change how it's rendered
i'm not sure what i would need to patch in order to cover every place user information is renderer
Hello, I made a plugin for the WebScrobbler WebHook, so I use the Http library from node inside of native.ts file. But I have the error that said Cannot import node inbuilt modules in browser code. You need to use a native.ts file but the import is in the native.ts (in root directory of the plugin) ?
show code
native.ts:
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import * as http from "http";
export default http;
WebHookServer.js (only the import):
import { createServer, request } from "./native.ts";
as I gussed, you are incorrectly importing it
what you trying to do is
const Native = VencordNative.pluginHelpers.MyPluginName as PluginNative<typeof import("./native")>;
and btw that 100% won't work, you can't export node modules to web
there is a link some where explaining ipc
u can look into this discussion
#🧩-plugin-development message
So the native.ts is not use I have to put this into the .js ?
the native is being used, you just need to correctly use it
I assuming you mean by "use" is some format of compilation
just lil note, you must replace MyPluginName with your Plugin name
Like this ?
/**
* @type {import("./native").default}
*/
const Native = VencordNative.pluginHelpers.webhookRichPresence;
yeah looks right
Hum... I think there is a problem.
because you are exporting a module...
create the function you want to use in native.ts and import it
I probably need someone to validate every information I said and would say, I am 8 hours past my bedtime
native.ts is just the link for the .js for the http module there is no function inside of it
what are you using the http module for?
A Web Server
a web server in vencord?
It's the only method to communicate (directly) with the WebScrobbler Extention (Witout any third party app like LastFM) so I can get more info
for what purpose 😭
why would you want to use webscrobbler directly in discord though
this sounds very xy
One thing the time of the track
this is a terrible idea lmao
just make a browser extension
or use premid
that's not useful iamme
sorry
It can replace completely the Spotify integration for non user of Spotify
there is no practical use to reading that because it's a very complex topic and you don't need to understand any of that
you just need to understand that you have to export functions and call these functions via the global pluginHelpers object
I am making a plugin that adds a button to send a random picture of my cat. I have it mostly working, but when I use it in a channel with slowmode it doesn't activate the slowmode timer. How would i go about making it activate the slowmode timer.
are you using manual fetch call to send the message?
i am using RestAPI.post how the voiceMessages plugin does it
import sendMessage
and use that
RestApi is very low level and should only be used as a last resort when there's no better option
i was using sendMessage but i couldn't find how to send attachments with it
i see, thank you for the help.
What I try to do is completely overkill, I think I will fork the extension (WebScrobbler) and make it work with Discord or a WebSocket
I was wondering why the patch was so long and the person who made it made the match go through the entire module for children: and the letters which children gives anyways so I trimed it down
What's with the \i\i
for the letters they were using it honestly dont know if its needed or not
they used it for the ... 
oh its probably for the other vc buttons
what format does the user api /settings-proto return in
.settings has a string, which can be decoded with b64 but it also gives a bunch of junk with it
protobuf
Hello, i'm trying to get the cpu consumption data used by discord but since they don't have an api for it. So i manually put "pressure" on it in my code here (1st pic). but when i run the code over and over agian it doesn't seem to work at all. Is there another way of measuring cpu consumption used by discord within the app?
upping the samples time from 5 doesn't change anything, it remains at about a recorded of 0.39% with sometimes spikiking at 41% but clearly, discord uses way more
[34mDiscord[0m
[34mUser:[0m .buzzzzy
[34mCPU Load:[0m 0.37%
[34mUsed RAM:[0m 239.09 MB
[34mTotal RAM:[0m 272.79 MB
[34mNetwork Traffic:[0m
- [34mOutgoing Request Size:[0m NaN bytes
- [34mIncoming Response Size:[0m 648811 bytes
Bro
No way i js got a husk instantly
😭

You probably need a native.ts for that
Aha
Alr
I'll try it
[34mDiscord[0m
[34mUser:[0m .buzzzzy
[34mCPU Load:[0m 100.00%
[34mUsed RAM:[0m 419.44 MB
[34mTotal RAM:[0m 433.76 MB
[34mNetwork Traffic:[0m
- [34mOutgoing Request Size:[0m 450 bytes
- [34mIncoming Response Size:[0m 206202 bytes
So i did a native.ts but i selfcooked at it shows 100% all the time 
I made a folder, in this folder i have an index.ts and a native.ts. I don't know why it's giving me this error, i have the correct import in index.ts for native.ts (3rd pic). the funtion name is also corret (4th pic). any ideas on how to fix this?
(ping me when you respond)
I also tried rewriting the import to
const { getCpuUsage } = await import("./native"); but i still get the "make a native.ts file" error
look at other plugins using native.ts
Alrighty, ty
also that promise is pointless just remove it
I can't get it to work, i'm using imports from electron and using ips, 😭 .
First pic is from native.ts and 2nd is index.ts
(ping on response)
dont import electron into your plugin
do something like this
const Native = VencordNative.pluginHelpers.YOUR_PLUGIN_NAME as PluginNative<typeof import("./native")>;
This?
`import { ApplicationCommandInputType, Argument, CommandContext } from "@api/Commands";
import { sendMessage } from "@utils/discord";
import definePlugin from "@utils/types";
import { GuildMemberStore, UserStore } from "@webpack/common";
const Native = VencordNative.pluginHelpers.vcBtop as PluginNative<typeof import("./native")>; // Reference the native helper`
Alright, got it, ty very much
please, for the love of god
use codeblocks
not inline code
like this?
yes
Sadan, thank you, you hlped a lot with that import. The plugin works perfect now
[34mDiscord[0m
[34mUser:[0m .buzzzzy
[34mCPU Load:[0m 19%
[34mUsed RAM:[0m 232.61 MB
[34mTotal RAM:[0m 255.24 MB
[34mNetwork Traffic:[0m
- [34mOutgoing Request Size:[0m 1246 bytes
- [34mIncoming Response Size:[0m 100567 bytes
🔥
i am begging someone to PR a feature where it errors when you import native directly
like an eslint rule?
This
I need that so bad
you need to read other plugins code more before yapping
Yes
?remind one week
Alright @hushed loom, in 1 week and 1 hour: …
add it the new Vencord companion you have
That thing is a lot better than the other one anyway
it literally already does
where
The message is horribly misleading
cause I didn't expect people to be dumb and import native.ts from index 
I added it to stop people from trying to import node stuff in index
tbh if you've never done electron before, it makes sense
no it doesn't lol
if you import the file then it's just the same as putting it in index
you expect people to think too much
well there could be black compiler magic automatically returning bindings when you import it
but no
actually I could do that
maybe
?remind one week
Alright @hushed loom, in 1 week and 1 hour: …
time for cursed esbuild shit
this is cursed and i love this idea
hey @flint bronze ive been trying to fix this for ages but i got the touchbar to work but anything i put on it for example a number , the bar doesnt render the update like it does normally it just stays the same value even though its actually updated
Are you updating the variable or the content of that box thing
ping
the content of the box is a template literal working with the variable
it works fine when i create its own browserwindow
when i attach it to discords main browserwindow thats when things stop working
Then it's probably some weird stuff with discord's electron
yea... it would probably be super hard to fix let alone pin point the cause in that case right
i fixed it
finally
it turns out discord creates two browserWindows, one for the loading when you open and the second for the actual application
and i attached the touchbar to the first one since
wait
does electron only allow you to attach a touchbar to one window?
thats dumb design
For some reason even when I attached it to the discord loader window it still showed the touchbar on the second window but it didn’t work
show me your code?
Why are you doing it to one window then
Wait nvm I attached it to every window in the event listener you told me about
So it was attached to the loader and the main app but I guess it breaks if you do it that way
Huh
Strange
@green vessel have you considered using a nodejs EventEmitter, sending updates to that, and create the touchbar for each window and listen to those events to update it / when the button is pressed?
this should make sure it works for all windows still
though it might not be so efficient
this is stupid why not just have an array of touchbars and remove them when windows close
Well isn’t there only a few windows created
There’s only a need for one which is the actual discord window
Can you elaborate on this though I’m curious on what you mean
True
My terminology is bad and event emitter is what broadcasts to listeners right
Create a touchbar in the event when you make a window and then listen to events from an emitter to update it, for onClick and other similar things you emit events back on that emitter you made
Probably not the most perfect idea but it could work
So if there were a lot of windows they’d all be synchronized?
Yes
Yea
I don't think I can provide the best advice here though
You should look for some examples of TouchBar being used in multi-window electron apps
That would be ideal if electron didn’t allow one touchbar object for multiple windows that need it
I’m still not sure if they do but when I added it to multiple windows on accident it broke so
hey, I noticed that the ViewIcons plugin has a very short animation when opening the user avatar by left-click from the user's right-click->profile
it seems that it adjusts itself (not sure how to describe it); basically it doesn't already appear in the "correct" place
known issue
nobody cares enough to fix it
Can you help with patches? How can I get find and match values?
for testing the find, you can use ctrl+shift+f in devtools
or the patch helper
I would like to remove the gift button in the chat bar. Patch helper and dev tools helped a little, but I still don't understand
I hate saying this but I've already done this just over a month ago
With patches, not CSS
patches.ts: Lines 18-24
patches: {
find: '"sticker")',
replacement: {
match: /=\i\.gifts?/g,
replace: "=null"
}
}
thanks, but this still doesn't explain how patches work
insane

take a look at https://gist.github.com/sunnniee/28bd595f8c07992f6d03289911289ba8 and some of the links at the bottom of the page
warning: they might be outdated; use an IDE (vscode is fine for this) to look stuff up while you work
husk lover
Im trying to use querySelector but the element im trying to access isnt loaded yet is there any simple way to wait til its loaded?
Im trying to get all guilds im in
And you're doing that... from the dom?
Vencord.Webpack.Common.GuildStore
how do i get all the guilds from that edit: nvm i got the guilds from it
i also need their pfps
theres an icon property with a value like ""3de0a07842b66707d81dd1671b545e3a"" do you have any idea how i can access the icon from that?
https://cdn.discordapp.com/icons/id/hash.extension
gif for animated webp for non animated
Probably you'd want to use some premade react component for rendering the icon
one of the best plugins ever ~
https://github.com/Kyuuhachi/VencordPlugins/blob/main/Anammox/index.ts
Why not just use css?
should I make a plugin that adds a calendar for events
Vouch
would anyone else find this useful?
@hoary pilot need your advice do i actually make it
good idea 
we will be needing a way to filter out always ongoing events
I made a stupid plugin that gets an insult everytime you type /insult, i get this error. Is there a way to bypass it
I changed
https://evilinsult.com/generate_insult.php?lang=en&type=json
to
https://cors-anywhere.herokuapp.com/https://evilinsult.com/generate_insult.php?lang=en&type=json
Cors anywhere
Test
You are like a herd of swine being invited to the table of a prince. You understand not such an honor, but only ravage what is set before you, even soiling the prince.
I should prolly get a better api
This one is js too poetic
Last update report, i found a better one:
https://cors-anywhere.herokuapp.com/https://insult.mattbas.org/api/insult.json
You are as ugly as a revolting absurd heap of annoying monstrous detrimental cockroach dung
God damn stop husking me
I think if you wanna bypass cors you should send the request from native.ts instead
I had one experience making a native.ts and it went awful, i had to be spoonfed the answer
But i'll try it
I tried searching this up, referring to the documentation, and asking an AI (codeium) for why this is occurring and I cant figure it out.
and I created this file in the proper place too, its in its own folder in the userplugins section of the vencord dir
Where are you getting that discord.js from? There's no such thing
Only that it's completely irrelevant
It's for building discord clients/bots, which is irrelevant because vencord is already running in an existing client
yeah im completely lost, I looked into the documentaiton but it just shows a plugin boilerplate no documentation on the api, how do I do this (This is my first every attempt at making a plugin, no less a vencord plugin)
I got an idea of what I want and how I want it to work I just dont know my tools, you get me?
Copypaste another plugin that does something similar to what you want
Ok so I looked into voice chat utilities ts
because what im trying to do has to do with voice chats
im trying to watch for a server mute or server deafen done on my user when im connected to a vc and when I am server muted I want to locally deafen my user and when I am server deafened I want to locally mute automatically.
I had an AI help a bit because I am not understanding some of the errors (as I never coded in ts/js before this)
well im gonna have to pause any further continuation of this headache, Im going to campfire with friends, when im back I might try a bit more but might have to leave this for tomorrow
hello guys,
will it be possible to merge this PR ?
https://github.com/Vendicated/Vencord/pull/2841
@novel canyon did a very good job 🙏
prs are merged when reviewed and when maintainers have time. be patient
Anyone know how I may detect my voice state changing
like me being server muted or server deafened
using vencord API Im lost bruh
flux events
look at VcNarrator
warning: cursed
