#🧩-plugin-development

1 messages · Page 83 of 1

cedar olive
#

use an array, and before you update the setting transform into set, then array again and set it

#

it's simple

quick zephyr
#

I do set it?

dull magnet
#

just create a new array when you change it

#

instead of push, use [...arr, newElement]

#

same thing you would do with react state

quick zephyr
#

I dont push anywhere

cedar olive
#

if it's not reactive ur missing something

#

but instead of pushing make the set -> then turn into array again and settings.store.ids = newArrayFromSet

quick zephyr
#

oh yeah turns out checking if the quest is ignored by passing the quest name when you're checking for ids tends to fail

#

yeah im reading it as is, making it a set, doing validation, casting back to array, then setting it. seems to be working

humble tulip
#

Something like this will never be perfect because people don't generally chat exclusively in replies but it comes in handy every now and then

silk sorrel
#

ohh that's cool ngl

#

does it also fetch older replies?

humble tulip
#

Should do

#

Seems like it doesn't necessarily load users though, I should look into that

#

Well, members

silk sorrel
#

You need to run ```js
GuildMemberRequesterStore.requestMember(guildId, id)

for every user
humble tulip
#

Nice, thanks

jagged briar
#

pretty fire

quick zephyr
#

tired spent too long playing around with trying to dynamically group different plugin context menu items cause the context menu is kind of a mess 😭

#

works though MRun

joinOrCreateGuildContextGroup(
    children,
    downloadifyItems,
    "guild-content-group",
    "download-guild-context",
    "Download",
    [{ id: { child: "devmode-copy-id" }, type: "BEFORE_GROUP" }]
);
joinOrCreateGuildContextGroup(
    children,
    [viewRawItem],
    "guild-content-group",
    "view-guild-context",
    "View",
    [{ id: { child: "devmode-copy-id" }, type: "BEFORE_GROUP" }]
);
lone moat
#

Does anyone know if a plugin akin to discrub is available for vencord?

#

Would be nice if similar functionality existed on-client

quick zephyr
#

that sounds like api abuse so no

lone moat
#

It works fine as a tool

#

has for a long time

quick zephyr
#

Perhaps but Vencord is already breaking TOS by existing so they don't take chances on making Discord break their "we'll pretend that's not happening" streak by allowing automation involving the API. That's the invisible line in the sand afaik.

quick zephyr
# humble tulip Nice, thanks

how did you make use of GuildMemberRequesterStore? it doesnt seem to return anything for me. or change the data my client has cached.

specifically my client isnt loading guild specific profile data (per-guild banner, etc) in the profile modal until I click through to the bigger "view full bio" modal. then any time I check that specific profile it will show the guild specific data. so like discord is just failing to do an api call to the profile endpoint. 🤔 if I can't do this with a store imma need to use the rest api I guess.

humble tulip
quick zephyr
#

damn

#

just realized I cant even rely on an api call cause I wouldnt know if the user was supposed to have a guild banner or not so it would be a blind api call and I'd need some way to only call it once. agony. why cant discord just return a full user object 😔

quick zephyr
#

was able to fix it with a patch. pass the guildId along properly.

quick zephyr
#

thats enough of that for today peepoSleep

hoary pilot
#

@quick zephyr you should put questify in userplugns

#

if it’s finished

quick zephyr
#

it is but I don't really like the requirement of it needing its own repo

#

will think about it

hoary pilot
#

do u just push to your vencord fork

quick zephyr
#

github wouldnt let me fork a fork cause I already had the upstream forked so this was my solution

quick zephyr
quick zephyr
#

clean :)

frosty mesa
#

you made this .??

quick zephyr
#

working on it yeah

frosty mesa
quick zephyr
#

$1,000 PayPal

austere mauve
#

v- programming 494602722029469706

#

weird

quick zephyr
#

there goes my job opportunity smh

oak sundial
#

i wouldn't have KEKW

hoary pilot
#

true

dull magnet
#

yeah that modmail should have been an instant rejection

#

anyone who knows how to code would also know proper English

hoary pilot
#

how do i reject that tho 😭

#

"uhh you do not know how to speak the english language therefore you may not write vencord plugins thank you next"

oak sundial
#

maybe just don',t give the progra,mming role out straight away then just closing the modmail lol

#

no questions asked type shit

#

esp because they didn't ask for dev channel access they just asked how to make plugins

dull magnet
#

just send them to sadans dms

#

he will love

oak sundial
#

can we just do that with everyone

#

scammer in dms? redirect to sadan

hoary pilot
#

@hushed loom we will do that

eternal sparrow
#

Hellooo neuroWaveA
First time working with webpack injection and I was wondering how exactly I can find the code for a React element in order to patch it. For instance, I want to add a div right under "Member since" (I'm using React Dev Tools - do I need other tools as well? NijikaThink)
I've been trying everything but been stuck for 2 days MizukiVibin

#

also ty ven for access :D

dull magnet
#

click "view component source in devtools"

humble tulip
#

There's some helpful messages in pins

urban granite
#

been trying to make a simple plugin for an inside joke that replaces all instances of the word "blue" in messages to "crust" (don't ask, again it's an inside joke) in both read and sent messages, and i'm focusing on the other messages first because i know i can lean from the plugin that strips canary and ptb links for the sent one
it feels like i have to use the flux functions but i cannot find documentation for it anywhere and the only thing i can find in the vencord code is a list of strings of the functions but not their arguments or anything

silk sorrel
#

You'll have to find the event arguments yourself
Just run ```js
FluxDispatcher.subscribe("SOME_EVENT", console.log)

and see what data it is receiving
dull magnet
#

enable experiments plugin then use discord's own devtools (not the chrome devtools), it has a page that shows all flux events that happen in the app

eternal sparrow
#

seyana followed sunnniee's guide as a training but instead of finding an array it's just

t

tried looking everywhere for t but no hope KitaDefeated

#

tried other components, it's all just t

silk sorrel
#

t is passed down from the props (e), so try checking the parent component
Also the variable names are generally random

#

Also if you just want to add something after the original children, you can do [t, <YourComponent/>]
React will figure it out

eternal sparrow
urban granite
#

and what is \i in the regex i don't remember that being a normal regex escape character

eternal sparrow
urban granite
#

thank you so much! never found this somehow, will have a look

eternal sparrow
#

patch went so well can't even open someone's profile no more

#

LES GOOOO

#

now using variable names but hopefully it's not that bad BocchiPray

tropic ice
eternal sparrow
#

nope

#

in the big one

tropic ice
#

wait did they remove it from there??

#

can you not see it at all now?

#

by these I meant the member since

eternal sparrow
#

I'm specifically talking about the "uwu" under it

tropic ice
#

oh
I thought that was just the about me

eternal sparrow
#

injection so good it was added to everything

silk sorrel
eternal sparrow
quick zephyr
eternal sparrow
#

EmuWoa tysm

static jewel
#

Hi, can anyone help me with "Error while starting UserDevCompanion"

oak sundial
#

to use that fork you need the forked Vencord plugin by the same author

eternal sparrow
#

silly question, but isn't $1?.startsWith('members') always true? since that's where the child is trying to get added to, just one div

(MemberCount plugin)

#

a wait why also there LenThinkMMJ

#

how did it get form the members wrap all the way to the channels wrap

#

does it mean the same function gets used in creation of both containers?

#

the only solution I see when actually making it is failing at first and then making the replacement even more specific

eternal sparrow
hushed loom
oak sundial
#

is it?

#

oh right yeah it is for the user plugin

hushed loom
eternal sparrow
#

quick question before I start wasting multiple days searching:>
I'm trying to find the function that spawns discord's native picture in picture and for that I thought checking all components of a channel (since it only appears when clicking on a channel for the first time while already watching someone's stream)

but is this even the appropriate approach? since there are so many hooks it might take more than 10 hours (willing to do) and still not sure if what I'm doing is right MizukiVibin

hushed loom
#

@eternal sparrow check out the module that this patches (ignore the patch itself)

eternal sparrow
#

EmuWoa ty

swift spear
humble tulip
#

I just picked a random old reply chain to test on lol

raw spindle
#

Hiiiiii !!!! I'm trying to make my very first Vencord custom plugin and since I'm a complete beginner I'd need some advice ^^

In particular, I would like to know if there is a hook for received messages because I'd like my plugin to react to the content of received messages

Would you help me ? 🥺

oak sundial
#

MESSAGE_CREATE flux event or smth, look at other plugins

raw spindle
#

Hmmmm these ?

noBlockedMessages\index.ts:73:                    match: /(?<=function (\i)\((\i)\){)(?=.*MESSAGE_CREATE:\1)/,
xsOverlay\index.tsx:203:        MESSAGE_CREATE({ message, optimistic }: { message: Message; optimistic: boolean; }) {
hushed loom
#

first one is a patch

raw spindle
#

Thank you !!

#

Both of you uwu

unkempt pollen
#

Hi, guys. I finally have access to this channel. So, I got my plugin to work. @silk sorrel @stone wedge @ everyone

But I believe I can benefit from the scrutinizing eyes of an expert.

Do I go ahead and share a pastebin link to the code? It's about 300 lines long.

hoary pilot
#

make a git repo

unkempt pollen
hoary pilot
hushed loom
#

least vibecoded plugin

oak sundial
#

AI slop and blatantly against server rules

hoary pilot
hushed loom
unkempt pollen
hushed loom
#

ai can't write vencord plugins

hushed loom
#

it doesn't have the knowlage required

heavy granite
#

Ai assisted code should explode

#

(it will explode when run)

silk sorrel
#

@clear parcel implicitRelationships sends an invalid gw payload and doesn't actually load any users
idk if the structure changed at some point, but userIds should be a raw user ids array (toRequest.map((u) => u.otherUserId))

#

sadan is my top implicit friend love

crystal jacinth
#

Hello there, I noticed that the openInApp plugin does not (or at least not like I would expect) support spotify jam invites. So I edited the getRedirect method of the native.ts from the openInApp plugin to make it work (somehow). Anyone mind to give their opinion on the code?

https://pastebin.com/aruffRXt

crystal jacinth
#

Hey, how can I find the correct parts for "find" when writing a patch? My goal was to add an option to the popout that comes up when you press the plus circle on the left side of the chat box (where you can select attachments etc).

#

Like such

silk sorrel
#

You can inject into that menu without using (your own) patches at all

#

vp VoiceMessages

shrewd tundraBOT
silk sorrel
#

see how this plugin does it

crystal jacinth
#

I will, thanks a lot!

quick zephyr
#

any way to mark a plugin as desktop only without naming the folder plugin.desktop

empty sundial
quick zephyr
#

I just didnt want to have to name the github repo like that

#

ugly

#
    contextMenus: IS_DISCORD_DESKTOP ? {
        ...
    } : {},
   
    patches: IS_DISCORD_DESKTOP ? [
        ...
    ] : [],

thoughts 🫴

#

side note, electron functions like showOpenDialog should work fine in vesktop right? it's based on electron too 🤔

empty sundial
quick zephyr
#

huh

empty sundial
quick zephyr
#

man I tried looking in the definePlugin and didnt see that option 😭

#

yeah im blind. thanks

quick zephyr
hoary pilot
quick zephyr
#

yeah I am

#

ok guess I'll be using hidden: IS_EXTENSION || IS_USERSCRIPT,

#

btw what is IS_WEB I could find literally nothing that explained what all it applies to

#

is it just a shortcut for IS_EXTENSION || IS_USERSCRIPT or does it have some separate meaning

hoary pilot
dull magnet
#

IS_WEB = running in a web browser (not electron) => no natives available

dull magnet
#

just make a github organisation

quick zephyr
#

oh so I actually want IS_WEB

quick zephyr
quick zephyr
dull magnet
#

no

quick zephyr
#

sad

dull magnet
crystal jacinth
#

Can you create a standalone installer yourself with the userplugins?

#

Just to make it easy to share a userplugin with a non-technical friend without them having to do all the pnpm setup etc?

oak sundial
#

its the way it is intentionally

crystal jacinth
#

Ah I see ok thanks

crystal jacinth
#

huh

oak sundial
#

we don't want people to use userplugins easily because it just makes it way more accessible to shoot yourself in the foot by giving yourself malware or break your discord

#

and then people will complain to us about it and we don't want that

#

but you could fork vencord or whatever if you wanted but you would have to maintain it

dull magnet
proud parrotBOT
# dull magnet you need to publish your builds to a github repo the same way vencord does, then...

constants.go: Lines 14-19

const ReleaseUrl = "https://api.github.com/repos/Vendicated/Vencord/releases/latest"
const ReleaseUrlFallback = "https://vencord.dev/releases/vencord"
const InstallerReleaseUrl = "https://api.github.com/repos/Vencord/Installer/releases/latest"
const InstallerReleaseUrlFallback = "https://vencord.dev/releases/installer"

var UserAgent = "VencordInstaller/" + buildinfo.InstallerGitHash + " (https://github.com/Vencord/Installer)"
crystal jacinth
#

Alright I will look into that, thank you :)

vast karma
tropic ice
#

But can you git clone it like that?

quick zephyr
humble tulip
#

To make the url people actually send match to what the unfurler returns, so if I'm going to be cataloguing that anyway, I may as well use the same logic to link batched embed requests back to the url

#

If it fails it fails

#

Who knows, maybe there are extra params I can send and get nonces or ids back or something

tropic ice
vast karma
#

Heck if I know

tropic ice
#

didn't you make it

vast karma
#

Yeah and I use all of them

tropic ice
#

I don't really completely understand it

vast karma
#

It deletes nothing

#

It just inserts several other plugins in the plugins array

tropic ice
#

So it's just a plugin called vencordplugins that loads other plugins?

#

You can't actually just clone one folder of it?

vast karma
#

That's a git question, not a my repo question

#

You can copypaste or symlink individual folders just fine

eternal sparrow
#

I was looking into expressionCloner and wondering when itemHref is even used NijikaThink I've tried a bunch of scenarios including with/without fakenitro and itemHref always returns undefined

#

taking side quests since picture in picture defeated me BocchiDead

#

wait I found out

#

makes sense with that name

eternal sparrow
#

so itemHref is never actually used KitaNotLikeThis

#

I'm genuinely confused about what scenario has favoriteableType and also itemHref

humble tulip
#

Discord might have just changed it since that was written

quick zephyr
#

maybe just a generic safety net

#

"might never get used but oh well"

hushed loom
#

XY

#

you can detect most things if you try hard enough

#

what are you trying to detect

dull magnet
#

sadan detector

eternal sparrow
#

also is there a reason why StickerExt[data.format_type] could be first undefined and then png 2 times? Is Discord's API acoustic?

#

also I saw emojis use cdn.discordapp.com/emojis/
while stickers use media.discordapp.net/stickers/
tho afaik both endpoints work for emojis and stickers, so why not use window.GLOBAL_ENV.CDN_HOST for both? NijikaThink

#

is there a difference between the responses perhaps?

quick zephyr
#

For emojis I'm pretty sure both domains work the same but for stickers they do not.

#

TLDR gif stickers are only available on the media proxy and lottie stickers are only available on the cdn

eternal sparrow
eternal sparrow
#

discord moment

#

so ig in this scenario window.GLOBAL_ENV.MEDIA_PROXY_ENDPOINT works for both since lottie stickers are ignored anyway

quick zephyr
#

the var isnt available by the time the plugin loads so if you're trying to set it to a global plugin variable it will error. but if you're using it inline it should work

quick zephyr
quick zephyr
eternal sparrow
#

test & pray

#

tysm yotsubaYay

quick zephyr
#

well so far the only things not available on media proxy afaik are default avatars (primary domain), unicode emoji svgs (primary domain), lottie stickers (CDN), and nameplates (CDN).

#

havent come across anything else

azure fossil
#

on the topic of embed that recently come, i'm trying to solve my own issues with them, since some of you have knowledge maybe you know smth
discord isn't embedding my website, i'd be interested to know why
i first checked the client i case it was smth there, but no, so i did go up and weirdly the discord dev embed debugger seems to strip the thumbnail URL, but iframely's debugger show me that it's valid, i tried changing the size, serving the image myself, but nothing does it
i already work around discord not fully supporting the omebed spec by specially for discord serving HTML since it doesn't care about the HTTP Link header so i wonder if there's smth else i have to do
-# screenshot of curl so you can quickly see what i'm serving discord

quick zephyr
#

Can find examples on stackoverflow and reddit.

azure fossil
dull magnet
#

just copy paste the markup from a site that has it working TenmaStare

#

and how is this plugin dev

azure fossil
#

eeeeh

azure fossil
azure fossil
#

i did that

#

like i've looked at other issues

dull magnet
#

send the site here

azure fossil
#

i tried so much

azure fossil
dull magnet
#

ye

quick zephyr
#

is it completely not embedding your site or partially failing

azure fossil
quick zephyr
#

such as

azure fossil
#

if it was stripping the html from rich, i would understand

#

but stripping the thumbnail URL is weird

#

especially when it's their own domain

azure fossil
quick zephyr
#

it's not even returning any metadata for me

#

<head></head> completely empty

azure fossil
dull magnet
#

always send the data

#

don't do weird ua checks

#

discord uses multiple user agents

quick zephyr
#

no as I said it only supports twitter card for images

dull magnet
azure fossil
azure fossil
dull magnet
#

just remove the checks

#

it will work then trust

azure fossil
quick zephyr
#

they dont. if you google it you'll notice nowhere do they list the tags they support

azure fossil
#
location /blog {
    add_header link "<https://$host/oembed$uri.json>; rel=\"alternate\"; type=\"application/json+oembed\"";
    if ($http_user_agent ~* "Discord") {
        more_set_headers "content-type: text/html";
        return 200 "<html><head><link rel=\"alternate\" type=\"application/json+oembed\" href=\"https://$host/oembed$uri.json\"/></head></html>";
    }
    return 302 https://youtu.be/dQw4w9WgXcQ;
}

this by example is only doable because websites who fully implement oembed support link header it allow me to have my own embed, but redirect the user

quick zephyr
#

oh checked my site and I use og:image too actually. but you also need <meta name="twitter:card" content="summary_large_image"> to tell it to make it a big image

#

what

#

why are you conditionally returning html

azure fossil
#
location / {
    add_header link "<https://$host/oembed$uri.json>; rel=\"alternate\"; type=\"application/json+oembed\"";
    if ($http_user_agent ~* "Discord") {
        more_set_headers "content-type: text/html";
        return 200 "<html><head><link rel=\"alternate\" type=\"application/json+oembed\" href=\"https://$host/oembed$uri.json\" /></head></html>";
    }
    try_files $uri $uri/ =404;
}

same here, i just can't remove the UA check, because i need the embed to actually be a link header if i want the content to be served

#

the idea is that my whole stick is built as a fully static thing
and the served file does not need to be modified for it to have an embed

#

which allow myself to do smth very powerful

#

ANY file that i serve can have an embed

quick zephyr
#

im so lost why cant you just put metadata in your <head> block

azure fossil
#

and an exe has no head block

#

but it can have an HTTP Link header

quick zephyr
#

why do you need an embed for an exe

azure fossil
#

because the idea is that i'll be able to serve application artifacts and have metadata be shown in embed

#

lemme create you an example

#

i can do this by example

#

dummy is not a text file and yet it can have an embed

#

hence the use of the link header

quick zephyr
#

and the goal of this is to just share a file with someone?

azure fossil
#

it actually is a text file but ignore that

azure fossil
quick zephyr
#

my point is does the link need to go directly to the file

azure fossil
#

stuff that yes will be shared on discord

quick zephyr
#

just add a download button on that page and add the file metadata and a description next to it if the goal is to share it

azure fossil
#

🤦‍♂️

#

the idea is to be able to see the metadata without leaving whatever platform the thing is shared on

#

that's the point of embeds

#

quick preview of what's behind the link

quick zephyr
#

yeah you can still do that

azure fossil
#

anyway

#

that's drifting

quick zephyr
azure fossil
#

the point is why is discord basically stripping the thumbnail part of the embed

#

what i return here clearly work, with the link to the resource, it finds the embed, it then correctly parse my json embed but when it transform into its own output yeet thumbnail gone despite respecting the spec
it's fine if you don't have an answer i was asking generally since some people clearly know discord here

quick zephyr
#

gotta use og tags for images

azure fossil
#

oh also since i noticed that they also support one last thing that is documented nowhere which is using the html title and meta description, i tried mixing that with oembed and actually they do combine, altho in an unexpected way, the HTML stuff shadow the oembed and not the opposite

azure fossil
quick zephyr
#

why cant you do it statically

azure fossil
#

also technically this is not the image, this is the thumbnail

azure fossil
# quick zephyr why cant you do it statically

because i'd have to add one new block to the nginx config for each image
or basically only serve HTML, which is not the point
anyway unless someone has a magic trick or the explanation to why the spec is being handled so weird, i guess i'll write a big issue on the discord repo

quick zephyr
#

the explanation is they only use opengraph for images

azure fossil
#

lemme find you the oembed website i had found that discord support

quick zephyr
#

legend has it he never found that site

azure fossil
#

my history is so filled that yes it's hard to find
and the big names obv implement all of the methods
like meta (facebook and instagram) have an oembed API, but actually also use ogp and twitter to serve the metadata, instafix use ogp and oembed, etc, etc and i want to find the ones that truly only used oembed

#

wait

#

no

#

i found one

#

fucking spotify

azure fossil
quick zephyr
azure fossil
#

but i'll find another instance of it

quick zephyr
#

it doesnt go through the embed tester

azure fossil
#

the thing is, when you test it, clearly the embed tester use the standard process for it

quick zephyr
#

idk why you cant comprehend discord has special handling for spotify that is not available for your website

#

well hopefully someone else has a solution for you but im pretty sure og tags is your only option. good luck

azure fossil
#

the point is discord should not say they support oembed if they don't

quick zephyr
#

yeah I should have rephrased that to "idk why you can't comprehend discord only supports open graph for images"

azure fossil
#

well because they say they don't

quick zephyr
#

yeah discord is pretty stupid

azure fossil
#

it's like if i told you that you can choose 1M$, 1k$ or nothing

#

and you ask me for $ and i told you actually no, it's just nothing

quick zephyr
azure fossil
# quick zephyr you tried setting type to rich or photo?

i did try the photo type with url instead of thumbnail_url and with both url and thumbnail_url
as for rich type i've found in the discord API issue tracker that they only allow whitelisted sites to use it because it allow embedding arbitrary HTML

quick zephyr
#

oh I saw that post and saw they had a working embed with an image so assumed they did rich type

#

but reading closer now I see they say they use open graph tags for that

azure fossil
#

i swear i'm gonna go crazy

quick zephyr
#

has an image this time. except it's broken

azure fossil
#

why the fuck

#

i don't get why

quick zephyr
#

why it's broken?

azure fossil
#

iframely says it's good

#

why does it fail to fetch the image

#

i'm gonna slap discord
it's trying to use the non-thumbnail as thumbnail
and if i'm lucky it's fucking cached the wrong thing

#

i can see in my logs it's not even trying to fetch the thumbnail

quick zephyr
#

cause your width and height are wrong?

azure fossil
quick zephyr
#

?

azure fossil
#

the thumbnail sizes are right

#

but it used the wrong URL

#

the thumbnail URL ends with thumbnail

quick zephyr
#

your image is 2560x1440 not 480x270

azure fossil
#

look

#

the url and thumbnail URL are the same

#

but not in what i provided discord

quick zephyr
#

yeah the embed unfurler returns an incorrectly structured embed idk why. it says thumbnail but it definitely is not resolved that way

azure fossil
quick zephyr
#

here's mine. it says thumbnail but if you actually send the link it uses it as the main image and the internal embed data has it as the image not thumbnail

#

so thats not your issue

azure fossil
#

this is crazy

#

i swear they hooked up the embed shit to GPT

quick zephyr
#

the unfurl endpoint does the same thing for some reason

azure fossil
#

hey please make use valid embeds

quick zephyr
#

there must be some post processing done on the unfurled embeds

#

anyways your image not loading is a separate issue

azure fossil
#

please please please

#

i swear what is wrong this time...

#

like this time it cannot be wrong

quick zephyr
#

looks to me like discord is being blocked from accessing it

azure fossil
#

holy mothertrucker

#

it's the cache that's F

quick zephyr
#

you can force embeds to not use cache by adding random query parameters though

azure fossil
quick zephyr
#

cause it's not loading the image

#

but the image exists at the url

#

it cant generate a content type for the image

#

so it cant access the image

azure fossil
#

i'm gonna try smth again

#

surely third time will be the charm

quick zephyr
#

oh wait so the file is located at https://julienraptor01.ddns.net/example_photo_thumbnail.jpg. for users you serve the image but for discord you serve the html

#

so thats why it cant access the image, it's getting the html at that location

azure fossil
#

well yes the first time i'm forced to serve them the html since it doesn't support link headers...

#

also it's supposed to fetch the image with another UA which is macintosh

#

because "it represents" the user

quick zephyr
#

thats why content type is empty cause html doesnt have an image content type

azure fossil
#

:pain:

#

oh the pain

#

so i can't make discord have embeds unless i serve it HTML because it doesn't read HTTP Link headers
but i can't serve it HTML because i need to serve it the file, otherwise obviously it's not getting the file

#

wait no

#

i'm thinking

#

this isn't even my problem

#

oh i'm gonna try a last thing

#

so this works

quick zephyr
#

congrats

#

points to a dif image I see

azure fossil
#

ok so clearly they suppress thumbnails

#

and only allow photos

#

so they also don't support the thumbnail part of the spec

#

they use the oembed photo as discord thumbnail

#

and they trash the oembed thumbnail

quick zephyr
#

whats your oembed code look like

azure fossil
#

gimme a sec

#

https://julienraptor01.ddns.net/test4

{"type":"photo","version":"1.0","title":"Example Photo","url":"https://cdn.discordapp.com/avatars/94597845868355584/ee22dc4da38afa53158c1434bc5fa842.png?size=4096","width":4096,"height":4096,"thumbnail_url":"https://a","thumbnail_width":64,"thumbnail_height":64,"provider_name":"oembed-example","provider_url":"https://lachee.dev/","author_name":"Julienraptor01","author_url":"https://julienraptor01.ddns.net"}
#

this is cursed

#

it uses the url, discord the width and height, needs the thumbnail url to be valid, but discard it and use the thumbnail height and width

azure fossil
#

situation is wild

azure fossil
#

yes so after all these tries
when an oembed is served when it's in photo type :

  • the oembed photo url is used as discord thumbnail URL (which is the one that gets proxied)
  • the oembed photo width and height are discarded (and do not need to be present which is wrong according to the oembed spec)
  • the oembed thumbnail url is required and needs to be a valid URL but does not need to lead to anything since it's unuused (the thumbnail URL is actually optional in the oembed spec for all types of embed, so again, not respecting the spec)
  • the oembed thumbnail width and height are required gets used as discord thumbnail sized which technically is wrong as it's supposed to be the oembed photo that gets used if it was coherent or the oembed thumbnail url and then using these would make sense (again the oembed thumbnail sizes are optional for all types of oembed, so again not respecting the spec)

and i'm gonna go sleep because it's 5AM and i did not realize

#

also i'll probably make a user plugin when you can whitelist some links and those will get a client-side embed cause fuck it

dry reef
#

when making commands, how do i get the reference msg?

oak sundial
#

commands?

#

oh right builtin commands

humble tulip
#

PendingReplyStore.getPendingReply(channelId) has the message you're currently replying to in that channel

#

If that's what you mean

glad radish
#

Question. How long is the verification process??? On the pr?

humble tulip
#

There is no set time, just whenever someone gets to it

#

Best to just submit and forget

modern oak
#

hey, how can i get all messages that are rendered on a client?

#

im trying to make something that replaces text of existing messages

dull magnet
modern oak
#

are there any similar plugins that i can check to see how something like that is done? i tried looking at TextReplace but it replaces the text for the user who sends it

modern oak
#

i believe i've found what i need, could it be that the component is named g ?

#

i see how it works, how can i get the actual component name?

humble tulip
#

You can't, it's pretty much all minified

modern oak
#

yeah i've scrolled a bit through messages here and figured that out, how can i patch this message component then if i dont know the name of it?

#

im very new to all of this lmao

quick zephyr
#

you click to inspect the code and write a patch for that code. if you can't inspect it, you're on the wrong element.

#

the parent of g is G. you can inspect that

modern oak
#

that makes sense yeah thanks

quick zephyr
#

however G looks like a generic function. definitely not gonna want to patch that. really in this case you want to go up to Anonymous where it has the key which is the message id

#

you'd patch that

#

you can see it has a message object you can mess with

modern oak
#

yep nice

quick zephyr
#

although if your goal is to modify messages already rendered you're gonna need some way to rerender them once you've edited them. not really sure how you'd do that off the top of my head

modern oak
#

what do you mean edit?

quick zephyr
#

well you want to change the text in messages right

modern oak
#

only for the client using the plugin tbh

humble tulip
#

There's a utility function to rerender messages

quick zephyr
#

yeah exactly

humble tulip
#

I think it's just called updateMessage

quick zephyr
#

you're going to be patching in something to modify message.content

modern oak
#

yeah

#

check if message.content contains something, then change it

valid portal
#

hey there, this might be a stupid question but how does one get stuff like icons into messgae modals.
So for instance this:

#

tryna get the icon into the file name modal but I'm not sure how lmfao.

#

trying to do it like so:

valid portal
#

figured it out, nevermind

#

i am not good at CSS at all 😭

eternal sparrow
#

quick question, in expressionCloner plugin why is there no need to check for sticker slots available like emojis below NijikaDerp

#

wait but even for emojis it's only counting the animated ones ElivLoading

#

I'm so confused

cedar olive
#

pay attention to emoji.animated === isAnimated

#

you are reading it wrong

eternal sparrow
#

wait you're right think

#

I forgor that isAnimated comes from the emoji's own data

#

still begs the question with stickers tho

eternal sparrow
hoary pilot
#

veediot

modern oak
#

uh

#

i lost my react developer tools

#

💀 what

silk sorrel
#

restart discord using ctrl-R

modern oak
#

oh nice

#

thanks a lot thumbsup

modern oak
#

hey, so yesterday we discovered that its possible to use this as message component. it has a content property. but when i go to the minified code of this component i am greeted with a long as fuck minified line of code, how do i know what i can use in this minified code?

#

yeah its a 9500 character functionn

vast karma
#

Same as with any other minified code?

#

Run your favorite code formatter over it

humble tulip
#

Click the {} in the bottom left of the window in dev tools

#

It'll format for you

modern oak
#

oh yeah i just threw it in a un minifier website and it actually looks readable now, the next step is to figure out, what do i need and how can i use it

#

trying to see if that gist guide can help me understand

modern oak
#

i cant figure it out for the life of me 💀.. im looking at other plugins to find if they do something with rendered messages or so but i cant seem to find anything..

quick zephyr
#

I must have clicked it one day and then forgot it was a thing cause ever since it's been prettified lol

quick zephyr
# modern oak i cant figure it out for the life of me 💀.. im looking at other plugins to find...

scuffed proof of concept. you'll have to put the pieces together into your plugin to test it though. I've been mangling messagelogger to test this lol

// in settings object
    stringToReplace: {
        type: OptionType.STRING,
        description: "type something",
        default: "do not make the default value an empty string nightmare fuel awaits if you do",
    },
// top level function
function replaceTextInMessage(message: Message) {
    const { stringToReplace } = settings.use(["stringToReplace"]);

    message.content = (message as any).originalContent ?? message.content;
    (message as any).originalContent = message.content;
    message.content = message.content.replaceAll(stringToReplace, "replacement text");
}
// plugin def
export default definePlugin({
    // yada yada ...
    replaceTextInMessage,
    // yada yada ...
    patches: [
        {
            find: "ChatMessage\"),",
            replacement: {
                match: /(message:(\i),message:{id:.{0,125}?;)/,
                replace: "$1$self.replaceTextInMessage($2);"
            }
        },
    ]
})

this'll change the code to something like

let l, {id: o, message: x, message: {id: P}, channel: Q, channel: {id: et}, compact: en=!1, className: er, flashKey: ei, groupId: el, renderContentOnly: ea} = e;
Vencord.Plugins.plugins["MessageLogger"].replaceTextInMessage(x);
#

holy shit do not use an empty value for that setting.

#

nightmare

modern oak
quick zephyr
#

pnpm build --dev

modern oak
#

every time i make a change to my plugin i need to do that?

#

or --watch i guess

quick zephyr
#

yeah. while working on it you can pnpm watch --dev but at the end you'll want to do a final build

modern oak
#

and then restart discord or does it hot reload?

quick zephyr
#

gotta ctrl r

#

if you do anything with native files in the future it'll require a full taskmanager restart but anything else reload is enough

modern oak
#

awesome thanks a lot for your efforts

quick zephyr
#

yeah hence the "dont use an empty string" 😭

#

would be better to add a check in the replace function for that lol

modern oak
#

yeah the idea is gonna be that the user can define what words to replace in a sentence

modern oak
#

hell yeah trolled

hoary pilot
modern oak
#

well just every rendered message

hoary pilot
modern oak
#

ah ok

#

we will see

modern oak
#

im gonna have to think of a way to make this more user friendly

hoary pilot
#

just parse the existing TextReplace rules

modern oak
#

i have read that code, let me check again

quick zephyr
#

hm adding this to textreplace would need a bit of care though cause theres a big difference between changing your own text before it sends out vs client side modifying everyone else's messages for yourself

hoary pilot
#

eh i guess you could add a per rule toggle to also apply to incoming messages

modern oak
#

This is kinda spammy tho

#

I added a console log and as i was hovering over messaging it was spamming the print lol

quick zephyr
#

yeah cause discord rerenders messages in real time if you're hovering it

modern oak
#

Ah

#

No issue for performance?

quick zephyr
#

I mean the only part of the code that I provided that would itself trigger a rerender would be when you update the setting so any rerenders it's doing otherwise is default discord

#

thats why I had to add the originalContent variable

#

without it it would compound replace

modern oak
#

I was printing the result of one of the string options from the cog ui

quick zephyr
# hoary pilot how

hm yeah actually simple. I more meant like it might confuse people the difference between your message actually being modified but others' messages only visually being modified but not actually being changed for anyone else but I guess that's basic common sense

hoary pilot
quick zephyr
#

not sure where thet option should be placed. not much room left 🤔

#

maybe move the delete button down and have 2 equal width buttons below each rule?

#

or well a delete button and a dropdown where you select between apply to my own, apply to others, apply to all

modern oak
#

I'll see what i can do

tropic ice
#

does it work across everywhere on discord (like channel names or nicknames etc.)?
or just messages

#

that would be epic if it worked across everywhere

quick zephyr
#

thats a lot more work to work everywhere

#

there's no universal text interceptor

#

you'd need a patch everywhere there is text

hoary pilot
#

but only for system strings

tropic ice
#

wtf

#

lmao

quick zephyr
#

🤔 would replace one of the deletes with a dropdown but 🤔

#

idk how else to fit in another setting for "this rule applies to mine, to others, or to both"

#

oof it double replaces

#

cause once on send and then once on render

#

fixed with a message.author == me check I think

quick zephyr
#

thoughts 🤔

hoary pilot
#

yea that’s great

quick zephyr
#

bottom border between rules or no bottom border? 🤔

swift delta
quick zephyr
#

I was more worried about rules themselves blending together but 🤔

swift delta
quick zephyr
#

smaller line or smaller spacing around the line

#

oh

#

I see what you mean. not talking about the lines up there lol

quick zephyr
swift delta
quick zephyr
#

invisible on light mode smg text-invert useless

swift delta
#

Maybe a little brighter

quick zephyr
#

no large line might be the play tbh. with it it kinda becomes line overload

dull magnet
#

use the divider component instead of making ur own 😭

quick zephyr
#

is it called divider

#

I searched for separator 😭

dull magnet
#

FormDivider or smth like that

quick zephyr
#

well it wouldnt work here anyways

#

nvm

#

you can margin left/right the divider

#

wtf

#

margining it is pushing it off the page

#

agony

#

does this mf have a default minwidth

#

no a default width of 100% ok

#

bit light but Shrug

#

love when auto linting on save randomly stops working in vscode

dull magnet
#

if you're adding a border it should span the entire width

#

don't add insane margins

quick zephyr
#

?

#

it's a divider

#

and the margin allows it to imply a soft separation from the next item instead of a full on "this is unrelated to whats next"

dull magnet
#

just don't

quick zephyr
urban granite
#

so i'm still a little confused with how specifically the find entry in a patch works, when you enter a string does it search for the function that matches and then let you modify anything in that function via regex or does it just look in the general area? when i see a patch it seems like it selects a bit of code and then modifies a completely different area of code in the general vicinity

vast karma
#

It finds webpack modules, not functions

#

They largely correspond to source code files

eternal sparrow
#

so Erm
I've been trying all day to find the function that uploads emojis as practice (I'm looking again at expressionCloner with findByCodeLazy(".GUILD_EMOJIS(", "EMOJI_UPLOAD_START")) but the more I try the more confused I get
I tried everything from setting breakpoints on the onClick function, to XHR/fetch breakpoints, to checking the call stack, but I genuinely have no idea where I'm going
How else could I try to find it besides brute forcing with search? MizukiVibin

cedar olive
#

you are using the find in expressionCloner as a base to what ur supposed to find?

eternal sparrow
#

I'm trying to reach the same thing expressionCloner reaches

#

instead of just copy pasting it

#

I wanna understand how the person that made the plugin got to ".GUILD_EMOJIS(", "EMOJI_UPLOAD_START"

cedar olive
#

ye that's what I meant

quick zephyr
# eternal sparrow so <a:Erm:1174963919203340398> I've been trying all day to find the function tha...

I just gave it a shot trying to find it myself out of curiosity. Here's how I did it.

||I first fumbled with the call stack for 10 minutes before getting tired of that. Then I uploaded an emoji with the network tab open to find the endpoint/parameters it used. I saw it send a post with payload of image and name. So I global regex searched for image:.*?name: which is image: followed by whatever followed by name:.

Didn't go too well cause of how broad it was. So I just tried searching for the endpoint from the network tab instead /emojis which led me to a file with GUILD_EMOJIS: e => "/guilds/".concat(e, "/emojis"),. Then I searched for GUILD_EMOJIS which brought me to

function v(e) {
  let {guildId: t, image: n, name: r, roles: i, analyticsLocation: o} = e;
  return s.Z.dispatch({
    type: "EMOJI_UPLOAD_START",
    guildId: t
  }),
  a.tn.post({
    url: g.ANM.GUILD_EMOJIS(t),
    body: {
      image: n,
      name: r,
      roles: i
    },
```||

If you just wanted hints and not my process of finding it then I'd say take a look at the network tab while you upload an emoji.
eternal sparrow
#

I'll try the network tab first

#

tysm

eternal sparrow
#

I found it neuroHypers

eternal sparrow
#

tho a bit differently
I found processFiles in the initiator tab of the post request which had the perfect name (so lucky that it wasn't obfuscated I guess) which led me to this

                    return e => (0,
                    n.jsx)(t, u({
                        processFiles: () => P(a)
                    }, e))

which then I inspected P with a breakpoint which led me to d(t, s) which upon inspection I saw that s is actually the function needed which also led me to a function I.G which was pretty big because of file size checks and name sanitization stuff but I eventually found a.rS which finally it was what I was looking for, the function that sends the post request

#

so from a function to function to a function to ...

eternal sparrow
#

speaking of luck, it's not the same with stickers agonyimg

#

I know that the actual code kinda skips this by directly using RestAPI.post, but I still need to go thorugh the same process to truly know what to dispatch with flux don't I?

quick zephyr
#

you can just use the rest api

#
await Vencord.Webpack.Common.RestAPI.post({
    url: "/guiilds/${guild.id}/stickers",
    body: {
        name: "sheep",
        tags: "🐑",
        description: "sheep",
        file: binarydata
    }
})
#

it'll automatically use your token n stuff to authenticate everything

eternal sparrow
#

But what about dispatching afterwards

quick zephyr
#

dispatching what

eternal sparrow
#
FluxDispatcher.dispatch({
    type: "GUILD_STICKERS_CREATE_SUCCESS",
    guildId,
    sticker: {
        ...body,
        user: UserStore.getCurrentUser()
    }
});
quick zephyr
#

you have the debug menu enabled?

#

do that then upload a sticker and check the flux event

#

then just mimic however that does it

#

Im not sure you really need to do that though

eternal sparrow
eternal sparrow
quick zephyr
#

try using the restapi and seeing if it automatically dispatches

#

oh checked expression cloner and it uses the restapi for stickers lol

#

ah it does dispatch

#

idk I commented out the dispatch and cloned a sticker and discord automatically sent out a GUILD_STICKERS_UPDATE

#

which isnt even the same event the plugin dispatches

#

so idk what use GUILD_STICKERS_CREATE_SUCCESS is

eternal sparrow
#

lmao

#

you were right

#

when creating a sticker naturally it sends both GUILD_STICKERS_CREATE_SUCCESS and GUILD_STICKERS_UPDATE

#

makes me question the whole purpose of ever dispatching

#

I'm gonna try to see if I can use the same RestAPI approach with emojis too, since it's clearly much easier than trying to find the actual function

quick zephyr
#

hm I went through the process of what GUILD_STICKERS_CREATE_SUCCESS ends up doing and it looked like it was doing something with cache/sticker store idk

#

really this is a try it and see moment

#

try dispatching one, the other, neither, both, and is everything you need everywhere you need it afterwards

eternal sparrow
#

so really there isn't a direct answer to dispatching

quick zephyr
#

wdym

#

discord expects specific data in their dispatch handlers so you test it to see what it needs and then mimic it properly

eternal sparrow
#

used the link directly since I'm not that familiar with the constants MizukiVibin

eternal sparrow
quick zephyr
#

yeah idk

eternal sparrow
#

purely based on luck

dull magnet
#

idk why i even did that

#

crypto.randomUUID() exists

silk sorrel
#

crypto.randomUUID doesn't work in unsafe http contexts but that shouldn't be an issue with a discord client 😭

silk sorrel
#

no idea 💀

#

other crypto methods work

#

you can use crypto.getRandomValues() to polyfill randomUUID

modern oak
#

Just checking, does it mean anything when Discord logs me out after ctrl + R to test a vencord change?

shrewd tundraBOT
modern oak
#

ahh

#

I expect these default values to be visible in the UI, is that not the case?

hushed loom
modern oak
#

sorry, yeah i added some values to it

#

but they didnt appear in the UI

#

now i just did it like this but still no worky

bronze dove
#

yeah cuz you had a non nullish value already at that setting

modern oak
#

and the value was still not there

#

unless i am mis-understanding something

bronze dove
#

yes

#

do you expect a setting to delete itself when toggling the plugin

#

or that changing the default value for a setting to overwrite the existing setting

dull magnet
#

aka an empty string

modern oak
dull magnet
#

no

#

it's already stored in your settings

modern oak
cedar olive
#

the default value is used once when the setting is first needed and no value has been saved yet

#

after that it just becomes a normal setting value like if the user did the input

#

so changing the default will have no effect

#

since you are still developing the plugin just open your settings file and delete the setting, then the default value will be used again

#

or just input the new default value you want

dull magnet
#
Vencord.Settings.plugins.YourPluginName = {}
#

run this

#

changing the name

azure fossil
#

idk if doable, but it would be nice if i could set the spellchecking languages in discord cause i speak in english and french and it seems to choose one at random each time

#

i'm sure i cannot be the only person to get this problem...

dull magnet
#

i should use this to make the menu saner

swift delta
#

Was about to mention that

#

Prolly saner way todo those names

azure fossil
swift delta
hoary pilot
#

streaming has always worked fine for me

swift delta
#

Only thing I dislike is streaming issue on Windows

#

Other then that it works

azure fossil
#

i mean

#

streaming issues would kinda really suck for me

vast karma
#

I'd put no game detection as a pro

azure fossil
azure fossil
dull magnet
#

no

azure fossil
#

😭

#

is it because it's pure pain / impossible to do, or because you don't want to ?
so that i know if i should try to do it or not

dull magnet
#

just make it a plugin

hushed loom
#

That's probably not a good way to indicate a setting is enabled but id look at the reply bar

molten oxide
#

How would i communicate between an
native.ts
and index.ts

more precisely

// index.ts
import definePlugin, { PluginNative } from "@utils/types";

const natives = VencordNative.pluginHelpers.GlobalShortcut as PluginNative<typeof import("./native")>;

export default definePlugin({
    name: "GlobalShortcut",
    description: "Global shortcut tester",
    authors: [],

    async start() {
        console.log("Start");
        natives.registerShortcuts();
    },

    doStuff() {
        console.log("This does some stuff");
    }
});
// native.ts
import { IpcMainInvokeEvent } from "electron";
import { globalShortcut } from "electron";

export function registerShortcuts(e: IpcMainInvokeEvent) {
    globalShortcut.register("CommandOrControl+A", async () => {
        // Run from index.ts doStuff()
    });
}
dull magnet
#

there's no intuitive way to send messages from native to renderer

#

you can define a method on your plugin and use evaluateJavascript

molten oxide
#

oh ok good to know

humble tulip
#

You're probably better off just adding a chat bar button that both toggles and indicates whether it's on or off

tame root
#

I have a question regarding the rules of plugin upload. Specifically "No raw DOM manipulation. Use proper patches and React." In the case of playing a sound, how is this done without using the HTMLMediaElement which is part of the DOM. I was not able to find a way to do this in React without using external lib/hooks.

any help is appreciated 🙏

quick zephyr
tame root
#

a custom one

quick zephyr
#

then I think new Audio() is the way you want to do it

tame root
#

Forgive me if i am wrong but doesnt that create a DOM element?

quick zephyr
#

I mean I think so? But you're not modifying the existing dom or attaching it anywhere. it just floats there in space til you delete it.

tame root
#

Ah okay, Thank you very much for your help 🙏

quick zephyr
#

also afaik no way to play audio in a browser context without using an audio element

tame root
#

goccha

dull magnet
#

creating an Audio or Image element or similar are perfectly fine

tame root
#

Oh awesome thank you for the clarification

hoary pilot
#

just use message accessories

swift harbor
#

how can i call an external api? its getting blocked by csp if i just do it with fetch 💀

#

i wanna notify a (non discord) webhook when specific things happen

cedar olive
#

add a csp rule using native

#

you can also request an override in your plugin settings

swift harbor
hushed loom
#

The function for requesting overrides at runtime is intended for user provided urls

swift harbor
hushed loom
swift harbor
#

ok 🙏

hushed loom
dry reef
#

On addMessagePreSendListener(...), can I somehow cancel the message?

hushed loom
eternal sparrow
#

another silly question teto_sillyhat, is it possible to create another fixed element using patches?
For example I'm trying to add a textarea right under the members tab. I could in theory make it position: fixed from anywhere but I want the background color to be good with any theme, meaning that I'd have to basically shrink the members tab and create a completely separate area
I tried going up the react tree until I found something above the whole tab, but only got to this class so I went even higher and tried to patch there but no result and I genuinely don't know where to go from here MizukiVibin

humble tulip
#

You can generally patch the children prop of the parent to add in your own components

eternal sparrow
#

wrapping the channel header, chat and members tab all in one

#

that's why I'm confused

cedar olive
#

you need to patch the children prop of the element which includes the member list

#

there is 100% one parent which has a child that is the member list with the whole scroller

eternal sparrow
#

wait I think I'm getting somewhere

eternal sparrow
#

I was able to add it right inside of the first layer of the members tab but members keep pushing it down

#

like it works fine when the members aren't taking 100%

humble tulip
#

Are you doing like channel notes or something

eternal sparrow
#

FINALLY

humble tulip
#

Congrats

eternal sparrow
#

tho the most shady patch in existence

eternal sparrow
humble tulip
#

You can probably just replace most of that with groups from the match

humble tulip
#

You'd have to use discord's background colour var

#

Probably blocks the bottom of the list as well, not sure

eternal sparrow
humble tulip
#

Nice

hushed loom
eternal sparrow
#

but even then, is this a viable solution?

#

doesn't sound that stable at first sight

eternal sparrow
#

I guess this makes much more sense

hushed loom
#

also that errorboundary makes no sense

eternal sparrow
hushed loom
eternal sparrow
#

idk I saw other plugins use it instead of normal divs

#

and with noop that's what I ended up thinking

hushed loom
#

error boundary is meant to catch errors in your react components

#

if your component errors, it won't take down the whole app with it

eternal sparrow
#

but ig it's impossible to get an error from just a textarea

#

so makes sense

hushed loom
#

in most cases, prefer ErrorBoundary.wrap(() => { /* jsx here */ }) over <ErrorBoundary />

eternal sparrow
#

isn't it the same thing tho?

hushed loom
#

no

#
export const WontError = ErrorBoundary.wrap(() => {
  throw new Error("foo");
});
export const WillError = () => {
  throw new Error("foo");
  return (
    <ErrorBoundary>
      <NonErroringComponent />
    </ErrorBoundary>
  );
}
eternal sparrow
#

That feels so specific but I get what you're saying

hushed loom
dull magnet
#

ErrorBoundary only catches errors in child components

#

even this will not be caught by the ErrorBoundary

function MyComponent() {
    const user = null;
    
    return <ErrorBoundary>
      <div>{user.name}</div>
    </ErrorBoundary>;
}
#

what you have to do is this:

function MyComponent() {
    // something that errors here...
}

const renderMyComponentSafely = props => (
    <ErrorBoundary>
        <MyComponent {...props} />
    </ErrorBoundary>
);
#

that's exactly what ErrorBoundary.wrap does for you (and it also has the nice side effect of turning your component into a function that can safely be called with component())

proud parrotBOT
eternal sparrow
#

way more useful than I expected

#

tysm

eternal sparrow
#

another silly question teto_sillyhat
is changing the profile theme colors considered api aboose? I'm basically trying to change the colors based on the rpc's image (like it would be kool to make the profile blend with the album cover if it's spotify for example) but what if that risks getting disabled seyana

#

changing the colors every ~3 minutes shouldn't be that bad should it glueless

hoary pilot
#

risky but not that bad ykyk

#

not sure if there's a special ratelimit on profile editing tho

#

may be

eternal sparrow
#

I've kept the script with a really risky interval on an alt for half an hour and so far so good

eternal sparrow
#

I think

eternal sparrow
hoary pilot
#

oh okay

eternal sparrow
#

I do plan on making it sync with any rpc if I can figure out that

hoary pilot
#

use that but yeah a bit risky

eternal sparrow
#

long live flux (but not the dispatcher)

eternal sparrow
#

not necessarily for unofficial plugins tho sux that it's risky

green vessel
#

Is there a way to use MessageActions to send a file or do I have to use the RestAPI to send a file?
I can't tell atm by reading the code tbh

dull magnet
#

you can

#

no

humble tulip
green vessel
# dull magnet you can

Could you point me in the right direction? I am reading the code and it is giving me cancer and I see nothing related to attachments, uploads or anything with SendMessage / MessageActions

eternal sparrow
#

best way look into other similar plugins

#

there has to be something like that

green vessel
# eternal sparrow there has to be something like that

There is one and that is where I get the RestAPI idea but no others
But if it is possible doing it a different way I want to do it that way because it just adds a mess into something that is kinda already fucked up

humble tulip
#

Have a look at petpet

#

That uploads a file

#

Or voiceMessages

green vessel
#

how petpet does it is how I have it atm it just puts the file as prompt to upload

#

voice messages does do it however I want to stay away from this because there are multiple instances of sending files and this is a mess, I could just make a function that will handle it however if I can just do it through sendMessage it is a lot easier for reading and adding onto at least imo

cedar olive
#

you can CloudUpload and then sendMessage with the attachment probably

green vessel
cedar olive
#

hm

#

it probably does

humble tulip
#

Breakpoint MessageActions.sendMessage and send a file

cedar olive
#

put a breakpoint on it and then send a message with a file

humble tulip
#

If you drag and drop a file while holding shift it insta sends so you can see what they do there too since it's not pre-uploading

quick zephyr
#

does the same thing

#

it just doesnt send a deletion post to the attachments endpoint if you cancel your message

#

cause it's already sent and cant be cancelled

quick zephyr
#

but the format that takes is what the attachments endpoint returns im assuming so

#

you'll have to chain something together

quick zephyr
#

in sources it only shows 2

#

takes up to 4 though

#

I guess that just means it can take between 2 and 4 Shrug wording not great but

dull magnet
#

use sendMessage from vencord utils bruh

quick zephyr
#

that is that

#

thats how I found it

cedar olive
quick zephyr
#

yeah

quick zephyr
dull magnet
#

use sendMessage from vencord utils bruh

green vessel
#

its sent in messageoptions

quick zephyr
#

idk why ven repeating themselves when I clearly dont know what they mean but good luck with your search x_x

green vessel
quick zephyr
# dull magnet

thats... literally the function I posted a screenshot of??

dull magnet
#

are you being dull on purpose

green vessel
#

for the love of fucking god this needs to be added to the MessageOptions interface

quick zephyr
#

I was just assuming you were omitting the MessageActions to be brief. Like [MessageActions.]sendMessage. Didn't realize it had a separate sendMessage of its own

quick zephyr
#

also the file is named utils.ts so my brain didnt compute

green vessel
#

no its the same thing

#

its the builder

quick zephyr
#

yeah but it's slightly more typed

green vessel
#

they are still tripping twin

#

NOT ENOUGH

quick zephyr
#

yeah not enough for what you need

green vessel
#

thats the most basic types ever

quick zephyr
#

but it shows you the structure

#

4 arguments

#

4th is the one you pass attachment data to

green vessel
#

That is what I was thinking already but if it was typed -_-

#

I gave up on it like "maybe im the dumbass and thats all there is"

quick zephyr
#

pr the change you want to see in the world

green vessel
#

gonna have to 😭

eternal sparrow
#

I saw that discord uses a get request to receive messages when searching (ofc makes sense) tho brings me a question think
is it theoretically possible to expand the functionalities like adding "not from ..." and maybe even regex? I doubt discord prepared an api for that and the cache of a channel on the client side seems to be only 50 messages (at least with MessageStore.getMessages())

#

negation seems fairly possible cuz I can just filter out on my side tho loading the pages would be a bit tricky

humble tulip
#

You're not gonna be able to add any parameters the endpoint doesn't support so you probably can't do much besides a local search which has the issues you mentioned

dull magnet
#

the only way to add that would be to fetch every single page from their api then do it locally

#

just download your data package and you can regex search that

eternal sparrow
humble tulip
#

Discord should just improve search tbh but I think they've said in the past that it's a limitation of how they index messages or something

#

authorType is a nice recent addition at least

eternal sparrow
#

at least one thing they could do is keep it one language

#

which I'm going to try to do

eternal sparrow
#

it's funny how discord only loads some in japanese meanwhile there's a module with all of them

green vessel
#

I am back with another dumbass question
Whenever you prompt and upload with a file it instantly uploaded to discords cdn
How could I go about patching that to prevent it from auto uploading to the cdn?
I am not the greatest using the devtools to find stuff like that tbh so if someone could help me out that would be great

dull magnet
#

why

#

what for

green vessel
#

For a plugin 😅

dull magnet
#

the question is what is your endgoal. what is it you're making. why do you need to prevent it from auto uploading to cdn

green vessel
dull magnet
#

there already exist such plugins

#

anyway you need to find the place in code where discord starts uploading the file

#

and before that just encrypt it

green vessel
#

mine is more advanced then all of those but anything related to reading how discord does thingss (like what was said above) is where I struggle that isn't where my experience is so im still learning

eternal sparrow
#

I was able to change the text but directly typing "mentions:" doesn't work, the whole purpose I'm even trying

#

what else could I try to do? MocoThink2

hushed loom
#

makes things eaiser to read

silk sorrel
silk sorrel
#

there were a couple places that needed to be patched for the search operators to actually function properly

eternal sparrow
eternal sparrow
#

FINALLY

#

IT WORKS

#

tho not sure which part, replaced the entire thing shadowomegaLUL

eternal sparrow
silk sorrel
#

it adds a dot I think

eternal sparrow
#

loll

#

so I can't use that here

#

have to stick with i9610z random thingy

eternal sparrow
#

life is so much better now

#

only a bit of manual labour

#

I could theoretically pull the values from the english module to make it future proof but Shrug

eternal sparrow
#

how can match alone find a module while the same expression in "find" is going to scream at me cuz of too many results

#

I'm basically trying to make it language independent, tho can't quite find peculiarities yet

eternal sparrow
#

I love regex

silk sorrel
#

yanderedev code

#

btw maybe instead of patching individual strings you could just add the properties you want to override at the end of the json string

#

this way you could also get the hashes at runtime using runtimeHashMessageKey

#

or remove the keys entirely, since that should theoretically fall back to the english translations

eternal sparrow
#

that makes so much sense

#

I have to try it out

#

you were right (tho still yandev moment seyana)

cedar olive
#

you could have just patched where they are used

#

and it would work for all languages

eternal sparrow
#

This was my last resort

cedar olive
#

it wasnt

#

the same way you are changing the language files u can change everywhere the string is used

eternal sparrow
#

Tried that for 5 hours yesterday without success, I genuinely don't know where else to look

eternal sparrow
# cedar olive

I need to double check that, tho I think I've looked into those before

cedar olive
#

you can do something like

green vessel
#

idk

cedar olive
#

match: /\i\.intl\.string\(\i\.\i#{intl::h2NzSU::raw}\)/g,
replace: '"during"'

#

in both of those modules

eternal sparrow
#

Tho why is changing the language module that bad?

#

I made it work with any language

cedar olive
#

ehh

quick zephyr
#

other plugins might rely on it not being changed?

eternal sparrow
cedar olive
#

you risk changing places which are unrelated