#🧩-plugin-development
1 messages · Page 10 of 1
no
mew
Anyone know the flux event for opening member list on mobile web version?
how do u even find flux events?
like how did u know that MOBILE_WEB_SIDEBAR_OPEN opens sidebar
so ig u found that with Webpack.Common.FluxDispatcher._actionHandlers._orderedActionHandlers
but i dont see anything about memberlist there
search code
actually
react devtools
install RDT in armcord and enable mobile mode in settings
then inspect the member list button
see what it do
Oke will do
is it just me or viewicons didnt work? like its causing crash?
am i in the wrong channel
#🏥-vencord-support-🏥 would fit more but it doesnt matter
I am going to bed bye guys
gn lol
only you
how do install rdt in armcord btw?
(@dull magnet)
double ping moment
no particular reason
it just makes it harder to work with
bigints are more efficient though and it doesn't really matter which one we use
what u trying to do
not really u still have to convert it back to a string
for what
for the open profile thing
oh i didnt know that
nothing i was just confused why you make it giant constants list
since they will be implicitly converted to strings when indexing objects and other stuff
how else would you do it?
requires maintenance and upkeep and doesn't really improve performance at all
it's easier this way than to specify it manually in each plugin
well i would prob do it like unbound
with json manifests
but im a fan of multiple file layouts
ik some people like bd structure for some reason
that's just less convenient since you need to copy paste it multiple times now if you have multiple plugins
copy and paste what
your author object
as for single file vs multiple file, plugins can arbitrarily choose but since most plugins are only 200ish lines it's usually single file
oh do you have manifest parsing
or r u just saying import it
and have ts compile inline
you just specify your manifest on the plugin object
have u not looked at some plugins to get an idea of how they look?
yeah
i alr made a plugin
oh cool
but its kinda useless i might not publish
what is it
its just this https://github.com/swishs-client-mod-plugins/cumcord-plugins/blob/main/plugins/global-substitution/index.ts
**index.ts: **
namespace GlobalSub {
const CHUNK_NAME = 'webpackChunkdiscord_app';
let __webpack_require__;
export function initialize() {
if (__webpack_require__) return __webpack_require__;
const chunk = [[Symbol('global-substitution')], {}, _ => _];
__webpack_require__ = window[CHUNK_NAME].push(chunk);
window[CHUNK_NAME].splice(window[CHUNK_NAME].indexOf(chunk), 1);
return __webpack_require__;
}
let cachedModule;
export function onLoad() {
const req = initialize();
const id = (Object.values(req.c) as any)
.find(m => m.exports.parseAndRebuild).id;
const module = req.m[id];
const cached = req.c[id];
// Save for the unpatch.
cachedModule = cached.exports;
// I'm still not sure if any webpack modules use this but it's here in case.
const firstArg = { exports: {}, id, loaded: false };
const replacedFunction = module.toString().replace(/var (.)=(.)\.content.replace/, 'var $1=$2\.content.replaceAll');
// This mutates the second argument.
eval(replacedFunction)(firstArg, cached.exports, req);
}
export function onUnload() {
if (!cachedModule) return;
const req = initialize();
const id = (Object.values(req.c) as any)
.find(m => m.exports.parseAndRebuild).id;
Object.assign(req.c[id].exports, cachedModule);
}
}
export default GlobalSub;
cumcord didnt expose wreq instance so i had to grab my own
manual transform patch
cuz that was the only way to make it
yes
i tried monkeypatching to make it work believe me
discord doesnt expose anything in that module of use
its the parser module
which im sure you know is a fucking headache
that's a pretty cool plugin actually, I think if u wanted it to be more useful you could make it more powerful, as in add more capabilities of sed
regex, groups in replacement, global or case insensitive flag etc
I planned making that for powercord ages ago but got lazy
s/any character not present/
mobiles had been able to do that for ages though
theres no checks on it for some reason
s/ehjweiwjkwjejwkwkejejej/
prob cuz it affects nothing and would require effort to put in the backend
a lot of discords message sanity checks are client side only
discord only has so much of that to spare
especially rpc
cause otherwise you don't have sticker perms
ah i see
yes welcome messages explicitly allow you to use welcome stickers in normal messages even without nitro
they now have a dedicated endpoint for it but when that feature was new they just sent it as a normal message
they still have that on the api side so you can just go bonkers in reply to welcome messages
yeep
/greet
strap you seatbelts on, we have classname changes 
- className: G().wordmarkWindows,
+ className: U.Z.wordmarkWindows,```

huh
ok now i understand why people say i should name my variables something good
the fuck is cbt

Cock and ball torture
i will never understand
Whenever I can't think of a good variable name I legitimately just bash my keyboard
//TODO: good var name
how do you ever not have a better name for a variable
surely it has some purpose you can name it after
Yeah

Just make it descriptive
I don't like long var names
So thinking of something descriptive under 8 characters
What scenario?
I mainly run into this issue when I am solving a logical puzzle like AofCode and am not quite sure how I will use a variable yet, but I know that I will need it
**LiterallyJustOneBoolean.java: **Line 4
public static boolean LieAboutMovingForward = false;
just name it x
Yeah
Pascal Case?
"names in pascal case start with a capital letter"
I must have done it accidentally for the var name and not noticed when using tab autofill when I was using it
I will fix later
i used to not either but
i would at least like have a letter
or something
some atrocious abbreviation
Just bash your keyboard at that point and //TODO your problems away
how do u remember what ur variable is called
I remember the first 2 letters then press tab
insane
//TODO think of better way to name variables
so is there a way to patch the componentDidMount function of a component?
is the image view layer completely borked right now
I crash when trying to view someone's pfp as well as when trying to view album art from the spotify plugin
I will explod
**viewIcons.tsx: **Lines 27-28
const ImageModal = LazyComponent(() => find(m => m.prototype?.render?.toString().includes("this.renderMobileCloseButton()")));
const MaskedLink = LazyComponent(() => find(m => m.type?.toString().includes("MASKED_LINK)")));
I know where it is yeah, i'm just bad at finxing modules xd
might look at it later today but working on other things at the moment
this got fixed recently https://github.com/Vendicated/Vencord/commit/b8ed72286bfca5cbcae55ca37c5968079e43a352
the updater apparently has been failing builds for me for the last while but didn't show an error
lovely
manually building has fixed it
i'll figure out what was causing it to fail the build but it was probably some weird stale file somewhere
how fix
@dull magnet my man you've got to stop shipping this many plugins into the client the amount of lag when opening up plugins is crazy
well im overhauling ur plugin cards cuz they look like shit (no offense) so ill see what i can do
also vencord for kernel when so i can unisolate this garbage app
im just gonna edit the patcher index.js to load both
actually this is smarter yeah
I don't plan to
I don't really want the trouble of third party plugins being the norm
all inbuilt works well so far
someone go make a user plugin that implements version control for user plugins 
yop
i disagree
i think shipping a client with any amount of non inbuilt plugins makes it feel bloaty
thats the mindset behind astra and unbound
to have a verified plugins list and let users choose what plugins they want
also just having a version number helps immensely in debugging
the first thing that should be asked when someone has an issue with a plugin is "what version are you running"
ven do you have something against export default cuz like
why not just import { proxyLazy } from "@utils";
so much cleaner
circular import hell
I also don't manually import tho
I do it everything with ide auto complete
ah thats why your import statements are unreadable
ok that came across more hostile than i meant...
that's not possible without fetching all users
which is a bad idea since there's like 20 plugin devs and even more in the future
or do you have any better idea
i mean first off just have less plugins
but also discord requests a shit ton of users at all times
as long as you use the right endpoint itll be fine
u keep saying have less plugins like the bundle size is 300 mb or something
when did the norm switch to including fart v2 as an inbuilt plugin
like half of the included plugins are meme plugins
which ones other than fart2
gaslighting
moyai oneko petpet
fr
oneko is my favourite plugin please give it more respect
it's smelly

Downgrade your react devtools

PluginCards take 0.1ms
so not the cards
i wonder what's making the plugins page kinda slow
Discord UI components 
didnt do much for me
someone make a plugin to replace React with React Development
so we can use profiler
i think it might unironically be one of Discord's components that's laggy
wouldnt surprise me
okay so
the rendering itself is very fast
the slow part is actually React rendering the Components
Which means the bottleneck is very likely one of Discord's Components
LOL
i found it
it's the Switch Component that's laggy
after changing Switch to div
@foggy mason
Discord yucky at coding
wow
**index.tsx: **Lines 149-173
return (
<Flex className={cl("card")} flexDirection="column" onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>
<Switch
onChange={toggleEnabled}
disabled={disabled}
value={isEnabled()}
note={<Text className={cl("note")} variant="text-md/normal">{plugin.description}</Text>}
hideBorder={true}
>
<Flex className={cl("flex")}>
<Text
variant="text-md/bold"
className={cl("name")}
>
{plugin.name}{isNew && <Badge text="NEW" color="#ED4245" />}
</Text>
<button role="switch" onClick={() => openModal()} className={classes("button-12Fmur", cl("info-button"))}>
{plugin.options
? <CogWheel />
: <InfoIcon width="24" height="24" />}
</button>
</Flex>
</Switch>
</Flex>
);
gotta reimplement this without Switches
this is hilarious because Switches are also what makes Aliucord's Settings laggy
Switches are laggy on both Desktop and Android (Java)
100 switches
discord will fix lag
vencord will merge prs
Discord insane
TRACER??
I'm already tracer
it be tracing
surprised you didnt notice this earlier
its used in some parts of the code


@dull magnet for annoiler I can either of the following:
- PR the annoil command to the MoreCommands plugin
- Make it's separate plugin and PR that plugin
Which one should I do
if annoiler = spoiler spam then neither
SO option 3
3rd Party plugin
Another question regarding authors field in DefinePlugin
Does it have to be from { Devs } from "@utils/constants" or I can just type in text normally?
you can just type it in manually
i dont think i would have thought of tracer until i installed ow2 like a week ago
there's probably a better way to do this
but it works soooo
Lovely
You're sure? Or am doing something wrong
error is pretty obvious
you're setting it to a string when it should be an array of plugin author objects
And that's tied to Devs which is from "@utils/constants" which I will not be there due to the plugin being refused before even a PR taking place
Alright
Okay I now have the github repo up, but no perms to post to #1032200195582197831
Guh
LMAOO ven going crazy
lol what
i mean it is annoying
i dont want 12yos sspamming spoiler spam here
||@dull magnet|| ||s||||t||||i||||n||||k||||e||||r||
I DONT STKNK
go take a shower
ok insane idea
for testing could something be made that pulls the latest discord stable, or canary then patches it and lets you test your local changes without running on your actual discord?
like as a npm task or something
test if patch patches I guess
you'd need to fetch a ton of stuff but could be cached I think
like a task you can run from your ide or vscode
so i can have a copy of vencord thats working on my main discord
and for development another copy
easiest it to just use two clients
that would be ideal but i can survive with editing the main one
stable and canary
wha
~/.config/vencord/dist
fix
but the development build doesn't put the files there
if you patch with pnpm inject it won't alter your ~/.config/Vencord files
Fixed React Devtools for everyone, if you want them fixed do this
Vencord Settings -> Open Settings Folder > Extension Cache > Delete fmkadmapgofadopljbjfkapdkoienihi
@dusty spire hey :3
i want to pick your typescript brain
I have this type ts export interface DefinedSettings<D extends SettingsDefinition = SettingsDefinition, C extends SettingsChecks<D> = {}> { store: SettingsStore<D>; use<F extends Extract<keyof D, string>>(filter?: F[]): Pick<SettingsStore<D>, F>; def: D; checks: C; pluginName: string; }
SettingsDefinition is just a Record<string, some setting definition>
so I'm using a generic F here
export function useShikiSettings<F extends keyof ShikiSettings>(settingKeys: F[], overrides?: Partial<ShikiSettings>) {
const settings = pluginSettings.use(settingKeys);```
ShikiSettings is typeof store from the defined settings
settings has no members in this generic case
im wondering if its possible to have .use return a partial of the store in a generic case like this
is the equivelent of js const { x } = getModule(['y'], false)
from powercord/old replugged ts const x = findByPropsLazy("y").x;
or am i being dum
don't destructure
the one with destructuring is from powercord/old replugged
i figured out the no destructuring thing when it broke my vencord
then how do i get the .x thing
const { x } = getModule(['y'], false)```
```ts
const xModule = findByPropsLazy("y")
xModule.x()```
i see
the reason is because it doesnt actually look for the module until you try to access x
so if you are doing it before vencord gets to see the modules (like immediately when the plugin file is initialized) it will throw
but if you only access x when you're actually using it, it's likely that it will be at a point where the webpack stuff is loaded
oh that's actually pretty clever
real
yeah that's what the lazy stands for
we need to add like prefetching for lazy webpack @trail ginkgo @trail ginkgo
like detect when the client is idle and prefetch all the lazys

why is the property a string 
LMFAO
not needed t b h
prefetch them all exactly 50000ms after renderer init
you know what we should add
lol wdym
lazy-load them (after 2 milliseconds)
discord is trolling me
I looked at that back then but didn't understand the point
i think ur getting an enum
like when do you need this?
you're getting the wrong module

this is probably strings or api routes or smth
see how lastfm does it
i wanted to use a component that is only loaded when you go to a specific page, in this case its the file upload component
oh yeah i forgot lastfm
wp not defined 
but also what r u trying to do
the chunk with the file upload component only loads when you open the server sticker settings
enable console shortcuts
Should I make console shortcuts required in dev builds 🔥
yop
same module twice
told u wp not defined 
epic discord
hop on console shortcuts immediately
okay
Yop
ven will make pnpm build be dev build by default
wait that's a dispatcher event?
yes
that means im gonna have fun porting my old neofetch-RPC plugin to the new replugged codebase eventually
@dull magnet does this make sense
yeah probably
probably 
is it a smart thing to dispatch LOCAL_ACTIVITY_UPDATE every time a setting is updated 
probably not, unless the onChange function is called only when the setting is saved
okay from looking at the source, it seems to be called in saveAndClose()
is okay
discords way of handling rich presence button is the embodiment of "wtf am i reading"
I'm gonna assume OptionType.BIGINT is best for unix timestamps, right?
normal numbers are safe
ok
but they won't be after november 12, 285428751, at 07:36:31 UTC
**patcher.ts: **Line 79
options.frame = settings.frameless;
@stray imp dum

i fixed
poor jai paul
how do i get around this, i installed it with the gui and dont know where the repo path is https://commandtechno.com/i/82tktdb23p4w.png

using a "gui" for git
i Forget who made the Logging Plugin, But for whoever made it, you fixed the photos that now go black and white when deleted, but Gifs do not go black and white when deleted
Is there a (simple) way to patch the message menu?
Ye
patch the ret of this func
oh wait no moneky patch
how tf do u add shit to a menu with transform patch guh
spagetti string
it's not too hard
discord switching to jsxs made it more painful tho
also what
they werent already using jsx
ur joking
that means that function isn't exported
jsxs swish
the function
r.jsxs()
r.jsx()
omg im confusing the patcher for webpack
it's new version of React.createElement
that puts children inside the props as array
is it not just an aklias
no it's a bit different
the main diff is that children are an array inside props instead of being params
which is way more painful to match
forgive me i cant find anything on the web abt this
is it just a discord thing
nah react
Although React 17 doesn’t contain new features, it will provide support for a new version of the JSX transform. In this post, we will describe what it is and how to try it. What’s a JSX Transform? Browsers don’t understand JSX out of the box, so most React users rely on a compiler like Babel or TypeScript to transform JSX code into regular Java...
this is the most useless feature i have ever heard of
ok thats not true
js has 3 substring functions
but still what the hell is the point of this
Well it's not meant to be used by you (the user), it's just a compiler change for better performance
i just mean
https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md#motivation
solid is out here actually inovating
React devolving
and react just adds what most bundlers already do

why did they have to team up with babel for this what
lmao
the most compelling reasons for the new runtime is that it doesn't require you to import React anymore and minifies better
since before there were hundreds of "React.createElement" that can now be minified to one letter function
xd
well yeah importing the entire React object certainly increases ram usage
btw there's two functions in the new transform
r.jsx and r.jsxs
they're the same in production
jsx is used for any element that has multiple children```jsx
<span>{1}{2}</span>
<a>{1}</a>
```js
jsxs("span", { props: [1, 2] });
jsx("a", { props: 1 }]
I think it's so they can differentiate whether the array was created by react (multiple children) or passed by you so they can issue key warnings
i see
can someone who actually knows how github works explain why I can't resolve conflicts in my PR
Also is it just easier to make a new PR for https://github.com/Vendicated/Vencord/pull/296
You need to sync changes on your fork on github, pull those changes on local main branch, then merge it to your patch branch (if you did create a branch), then resolve conflicts, and commit + push
tyty
I think I've managed to do it
I wish GitHub liked me more 
Oh god, kill me
It's been 3 hours figuring out why the patches wont apply, and then i realised the plugin wasn't activated 
ideally you should just rebase and force push
there's no reason to rebase in a pr
plus the odds of fucking it up if you're not good with git are high so just don't

rebase bad
it kinda voids the whole point of git
having a canonical list of changes
a merge makes it obvious where main branch was merged into your branch

does the message popover api still work here?
I'm trying to get it to work on replugged but I cannot find the source for the life of me
broken on canary
how do I access this component in vencord?
I was just working on a plugin. It sends a code block from lines of a git file. It seems to work, but it sometimes sends messages with a bot tag and doesn't let me edit/delete them. Why is that?
It's not doing anything special so I didn't think it would matter. Only thing I thought might explain it is that it's async.
well send your code
#🧊-off-topic-iceman-only message
repost in case you miss it in #🧊-off-topic-iceman-only
you don't need to spend a penny for it
i think you still have to pay $5 license fee
because u still need to submit your extension to be signed into a .crx file
little late but here: https://github.com/hunt-g/vencord-plugins/blob/master/gitPreview/index.ts
I haven't had it happen again since the first day
the code has changed a bit, but i don't know js/ts so it's not done yet
index.ts:80-89
async function sendCodeBlock(url: string): Promise<string> {
const { name, ext, lineStart, lineEnd } = getFileInfo(url);
const response = await fetch("https://cors.proxy.consumet.org/" + url);
const text = await response.text();
const lines = text.split("\n");
const code = lines.slice(lineStart ?? 0, lineEnd ?? 26).join("\n");
const title = `**${name}**` + (lineStart ? `:${lineStart}` : "") + (lineEnd ? `-${lineEnd}` : "");
return `${title}\n\`\`\`${ext}\n${unindent(code)}\n\`\`\``;
}
works well enough for the moment
@dull magnet https://github.com/Vendicated/Vencord/pull/296 
how can i get S from this insanity
It seems it's Lq
Get the module id defined upper
Or
findByProps('Pl', 'sq', 'Ub', 'Lq', 'PP', /* and so on */);
i already can find module
how to get a right function if half of exports are similar to _ and are proxies to actual functions
i don't really like grabbing a function through patch but i already did that and it works
find: ".GUILD_DISCOVERY,object:",
replacement: {
match: /(function ([a-zA-Z_]+)(?:(?!function ).)+\.GUILD_DISCOVERY,object:.*?\.apply\(this,arguments\)})/s,
replace: "$1Vencord.Plugins.plugins.LurkGuild.setLurkGuild($2);"
}
just want to know if there any less weird alternative to this
it works but also hitting me on some level lol
mapMangledModule if its the only exported function of that kind
is it?
not the only but half of them look like this
so half of the exported functions are just X.apply(this, arguments)?
lmao
so two options:
- patch
- use findModuleId and manually require the module then use regex / regular string search to find the name
for now went to patch
the latter is cleaner tbh
const MyFunc = proxyLazy(() => {
const id = findModuleId(".GUILD_DISCOVERY,object:");
// match "S" aka ur func name here
const myFuncName = /.../.match(wreq.m[id].toString());
return Object.values(wreq(id)).find(v => typeof v === "function" && v.toString().includes(`return ${myFuncName}.apply(this,arguments)`));
})```
this is how u would do it
Hi, so, I don't know patching well, but I'm struggling with a problem.
The main problem is that a parent component requires a functional component, but not invoked, like;
const parent = find(...);
const child = find(...);
return <parent>{child}</parent>;
However, I cannot pass props to child, because otherwise it throws.
So, I did a ugly ass wrapper:
const parent = find(...);
const child = find(...);
const childWrapper = (props: Record<string, any>) => <child {...props} />
return <parent>{childWrapper({icon: myIcon })}</parent>;
It does not work properly, because a new component is created and the wrapper causes this, which leads to classes and other properties being applied to the wrapper instead of the children
<parent>
{discordsProps => <child {...discordsProps} {...yourProps} />}
</parent>
Omg thank you! I found the right way with your tip 
what is it
show
I meant code
Well, I removed InnerInnerChild, and it seems to work fine
Oh god, discord is so messy
how
I'll try to remove some stuff and see if it breaks
oh wait
i should not be managing the streams directly
i should be managing the devices
oh im in development wtf
how does discord inflate zlib stuff using the browser only?
all i can get online are ones that uses the nodejs zlib
when i try pako or zlib.js
it gives me error
nodejs's zlib works though
yes i didn't actually test pako or anything in the browser i just assumed the ones said to be compatible for browsers would work in nodejs
try this https://github.com/101arrowz/fflate
Does Vencord have i18n? Would love to translate this thing into my language! ❤️
that sounds like an interesting challenge
yeah, that was the challenge bit
wouldnt be surprised, i18n would bloat it quite a bit by ...
i dont know, i cant make up reasonable numbers
but i can say that it'd add loads of bloat that you wont ever use
and pulling strings from a remote isnt a reasonable solution either
so i guess No®️
what
what?
bro has voices inside his head
is is the fastest smallest, and most versatile pure javascript compression library
how is that not "good"
Javascript = slow
so create a compressor in javascript = slow
brain rot
bro??
Javascript can be insanely fast thanks to TypedArrays and jit
it doesn't matter anyway
yop
Create compressor in rust 
i dont fucking understand
TypedArrays is fast but same with that I am not really convinced
okay it doesn't matter
After maybe it depend for what kind of project
the author of that library claims
In fact, the compressor, in synchronous mode, compresses both more quickly and with a higher compression ratio than most compression software (even Info-ZIP, a C program), and in asynchronous mode it can utilize multiple threads to achieve over 3x the performance of any other utility
there's no reason not to believe him
yeah because surely performance is extremely critical, since the discord client is so well-optimised and we don't want to ruin that
that library just used by build build tool and if you enable react devtools anyway
so it doesn't matter 
is there a function to fetch all guilds the user is in
findByProps("getGuilds", "getGuild").getGuilds()
but if u need only the guild count then use findByProps("getGuildCount").getGuildCount()
how would I use parseTopic with JSX
should work
show full code?
would this be async or does it grab from the cache?
https://tryitands.ee (its cache)
thanks lmao
idk why i had a feeling you would send the tryitandsee
ya
is this still the same pr
I've literally rewrote the entire plugin
all patches
yeah
haven't pushed yet
hmmm
how would I add css to that component
It does not
L
I have finished
ew what??
oh wait
I used the wrong client
it's working correctly on the other
asdasd test 😁
at one point my main client crashed and applied the changes
e
message lagger has example
oh
good point

lmao
@dull magnet should I make a Timestamp API plugin
to export the timestamp component
findbycode poggers
wp.findByCode("MESSAGE_EDITED_TIMESTAMP_A11Y_LABEL")
i think the plugin just adds that cause it patches that module anyway
so might as well
https://i.imgur.com/5hL5Jyr.png is there a way to suppress this eslint error (clicking fix doesnt do anything)
I think you meant a different timestamp component right
fix it
how
i added semicolons and i still have the same issue
i mean intellij makes it easy to fix eslint on an entire file
but im p sure this eslint error isnt valid
i never used intellij for js so i cant help u
you will likely have a better experience in vscode
@dull magnet it looks before now
I love compact mode
@dull magnet OHHHH
IT'S CUZ IT'S AN OLD MESSAGE
send a message in #private
also what's the correct order
or
wdym
but also .
I honestly have no idea what I wrote there
private used to be top but someone (probably me accidently) moved it
I made a typo and I forgot what I said
what for
Object.fromEntries(Object.keys(findByProps("getGuilds", "getGuild").getGuilds()).map(g => [g, findByProps("getChannels").getChannels(g)]))
idk if theres a better way
and ty
findByProps("getSortedPrivateChannels").getSortedPrivateChannels()
ty
that gives all dms
if u only want dm groups ```js
const GROUP_DM = 3;
const DMStore = findByPropsLazy("getSortedPrivateChannels");
const getDMGroups = () => DMStore.getSortedPrivateChannels().filter(c => c.type === GROUP_DM);
yea thats kidna what i did
you should cache webpack searches
instead of doing it on function level, just add const Name = findByPropsLazy(...) on top level
the lazy will make it only actually do the search once it's used
like this right
oh
const DMStore = ...
consz GuildStore = ...
GuildStore is very likely in webpack commons
gotcha
for this reason
destructuring would access it immediately which would remove the lazy factor and not work since plugins load way before webpack modules are ready
I found something very weird with this 
you've always been able to make 1-member dm groups
look near the top right
oh
yeah that's also old
it's added by the isStaff setting in the experiments plugin
if you're in a gdm of only staff members, that badge appears
so that staff know they can talk about NDA stuff easier
megu staff when
i see
now
dang
fake
bruh
wut
i just reversed engineered it instead
what is this
ye discord uses pako for compression
i think i finally get it omg!!!
why do I get this when trying to use NavigationRouter.transitionTo("/channels/@me");
the finder for it is broken
const NavigationRouter = mapMangledModuleLazy('"transitionToGuild', {
transitionTo: filters.byCode('"transitionTo '),
transitionToGuild: filters.byCode('"transitionToGuild'),
goBack: filters.byCode("goBack()"),
goForward: filters.byCode("goForward()"),
});
i was too lazy to pr the fix
pr it with the plugin
kk
why does this patch give this error
put it in the patch helper and it'll show you the resulting code
(it only appears if you build with pnpm watch)
oh and also you can (should) use \i instead of .{1,2} for minified vars
why does it only appear with pnpm watch wtf
why would a regular user care about patch helper
why would a regular user install using git
third party plugins
looks like it should work
also you should use pnpm watch for dev builds anyway
because nobody PR'd it otherwise
it's hidden for normal users
most people developing use watch anyways
thanks
where's the closing } been put
wdym
oh
what should i do instead
i counted the function body and its like 190 chars when minified
removeRelationship: function(e, t, n) {
return r.Z.delete({
url: E.ANM.USER_RELATIONSHIP(e),
context: t,
oldFormErrors: !0
}).then((function() {
null == n || n()
}
)).catch((function() {
i.Z.announce(p.Z.Messages.A11Y_ANNOUNCEMENT_GENERIC_FAIL)
}
))
},
hmmies
@edgy berry what is the output that you want
the resulting js
insert at the start, but keep the original return as well?
yeah
alr
"match": /(removeRelationship:function\((\i),\i,\i\){)/,
"replace": "$1$self.a($2);"
something like that?
keeps the return, but adds the YourPlugin bit
ill try that when i get back to my computer
👌
the patch still errors for me
but somehow shows the diff in the console as well
probably
you have a space in the name
yeah lmao
vencord plugins names should be like RelationshipNotifier
we dont put spaces in the names
we will put spaces in every name
omw to add spaces to message logger so no one can keep what i said and insta deleted
do i need to do anything else after changing the name
since it wont load now
nvm im dumb
did you enable the plugin again

ok awesome it works
if i wanna use an export from another file is it just $self.<filename>.export
do you realise that the builds everyone downloads are built the exact same way?
its just tied to watch because i didnt wanna bother checking for something like node_env
wait was it always tied to watch
yea
oh then i'm an idiot
i could've sworn i saw it in settings when i was developing customRPC (i initially didn't use watch)
watch builds are non minified, have more strict errors / warning than non watch builds and have patch helper, more useful patch errors with diff, etc
they also have performance log spam in the console
many differences that most people wouldn't want
huh, i always thought vencord just checked somehow if it was a manual install
no it's done at build time
there are 3 different types of builds:
- dev ~ non minified, less optimised, many dev features
- regular ~ minified and optimised, this is what you get if you just install with the installer
- platform optimised ~ same as regular but platform specific code for different platform than you're on is stripped. this is what you use if you just run pnpm build
Well there are technically 6 different builds since there's this and then also this for web
Like from another plugin?
from my plugin
i wanna use a function exported from a file i made called functions.ts
just import them
It'll be the same you just have to put that export in your main plugin object
the same way you would import from webpack or similar
oh I see
u wanna use the function in a patch
yeah
the way to do that is to do what vap said
import it in your index and put it on the plugin object
Huge
if i store a map using DataStore.set() will it return a map object when using DataStore.get()
yes
it's indexeddb
you can store anything listed as supported here https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#supported_types
or easier anything not listed here https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#things_that_dont_work_with_structured_clone
okie thanks
I looked at the fakenitro plugin, but i'm not quite adept enough at typescript to understand how to apply the async messaging to my own plugin
Since it uses stickers and whatever else, I restructured my code to be similar in hopes something would change but no luck
I just need to replace each url with my message on send, but since it uses fetch the asynchronous response is causing me trouble with the listeners
.then() runs asynchronously
the function returns before it's done
you need to cancel the message send then send it manually
I'm pretty sure I tried it without that as well, but how do I do that?
It's literally what I suggested
I think that is what nookies suggest as well lol
yep
but it sends in the console at practically the exact same time the message sends, so surely there is a way to just wait right?
Or does the listener have a very limited amount of time to respond
it's impossible
it's impossible for an asynchronous operation to complete before the synchronous part completed
even if you make a promise that resolves immediately it will still happen after
but if the message is cancelled, the async operation completes, and then the message is sent... that would work?
how come messages cant just be sent asynchronously? since that's how bots worked I assumed discord would just function like that in general
discords logic for sending messages that we hook into is synchronous
I thought it was basically just an api call here too
it's a preSendListener
you are hooking into discord logic before it sends the message
all of that process is sync because discord did not make the api call yet
Okay that makes sense
I think it could be made async with some refactoring
u could try urself
are any other clients sending messages asynchronously?
new to vencord still looking around for answers but uhh anyway to convert bd plugins to vencord easily without typescript source of the plugin? Trying to get my animation plugins back
okay so the discord message event is patched and replaces with the preSend listener, which intercepts the arguments and lets you change them before passing them back to discord's message handler right? Is a listener the context in which you can modify the message?
also how come you can cancel sending a message but not editing. Does editing start when you open the edit window rather than confirm it?
i'm working on it but ive come across an issue
the set of listeners is empty now, and there is an error in a webpack module
in this function
sendMessage: function(e, t) {
var n = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2]
, r = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {};
if (t.reaction)
return Promise.resolve();
var o = function() {
return le._sendMessage(e, t, r)
};
return n ? new Promise((function(t, n) {
x.Z.whenReady(e, (function() {
return o().then(t, n)
}
))
}
)) : o()
},
something about o
I got things functional again, everything is written asynchronously now at least
okay so like for some reason there's magic happening with the one used by discord
i reversed engineered the webpack chunk thing and that works
I tried using pako from the GitHub it no works
Hihi, how do I send a message with a plugin?
My command should return a message.
from the user? or from clyde (ephemeral)?
take a look at line 108 in the spotifyShareCommands plugin
For what purpose are you sending a msg BTW?
it has examples of sending user and bot msg
Like what plugin r u making
Ty!
np
I am pretty sure you know the "women ☕" meme
I actually don't
same
Idk if more meme plugins will even be accepted
they wont
I just want to make a /women command that returns ☕☕☕. I just want to learn ts with some random stuff, so I wanted to start simple.
Will it won't be accepted
I don't mind actually. Just for education ^^
Ah ok
When a woman does something stupid (which sometimes isnt even that stupid) a man will comment "women☕️" in reference to a clip (you can find it if u search up women☕️ in tiktok search bar)
(I have nothing against women, I just like the meme, don't judge pls) x-x
How do I debug or even try my plugin? I tried pnpm build but I have no idea what to do now x.x
Well. My humor is broken anyway.
I did all that. But my plugin does not show under "plugins"
did you refresh discord
CTRL + R, yep.
then your plugin isnt set up properly
compare it to the examples and figure out what's wrong
Is it still the userplugins folder? Mine is greyed out for some reason
its greyed out because git ignores it
did you enable it in settings
The thing is that it doesn't even show up in there
did you rebuild
Yep
and reinject?
Inject?
pnpm inject
Well, didn't even do that once
do that then restart discord from tray
Thank you 
@viral roost Any idea why the command is sent aswell?
nope
youre using the wrong type
Type?
inputType on ur command
BUILT_IN_TEXT = respond with content
BUILT_IN = no response
Ohhh
inputType: ApplicationCommandInputType.BUILT_IN,
ye
Makes sense. Thank you c:
Is the pnpm inject thing written somewhere? Could not find it in the 2 plugin files for contribution. And it was not obvious to someone like me >.<
it's the manual install guide


