#🧩-plugin-development

1 messages Β· Page 45 of 1

green vessel
#

:)

gritty sparrow
#

it has been recreated from our screenshots anyway

#

or at least the user page

green vessel
#

The one currently is different,

#

it's the updated 2024 one.

#

They changed some stuff around.

gritty sparrow
green vessel
#

"Discord"

#

or at least it's suspected

#

but its not true

gritty sparrow
#

dawg what???

green vessel
#

Most users think the admin panel is on that top button,

gritty sparrow
#

idk who is your so called "most users" but no its not

green vessel
#

etc

gritty sparrow
#

the website they're using

green vessel
#

Only few amounts of people know about it,

gritty sparrow
gritty sparrow
green vessel
#

You should know it :)

#

Wouldn't you?

gritty sparrow
#

just curious

green vessel
#

I do, but again. not willing to break h1 policies over a skid on Discord.com trying to compare code for code.

#

Which is more cringe.

#

Would of expected better from someone,

#

Β―_(ツ)_/Β―

gritty sparrow
green vessel
#

If it's reported. it's policies of H1.

#

Safe Harbor moment.

gritty sparrow
#

oh no!

#

i will get now banned from their h1

#

scary

green vessel
#

so real!

gritty sparrow
#

i sure hope no one reports it!!! pleading

green vessel
#

It's legit cf's auth for 0 trust πŸ’€

gritty sparrow
#

yeah no shit

green vessel
#

Meaning shit

gritty sparrow
#

it wouldn't be open

green vessel
#

let me get it

#

one sec

gritty sparrow
#

what will bro get πŸ’―

potent fox
#

@gritty sparrow give me admin panel credidentals

#

I need for one important job

potent fox
gritty sparrow
#

nuh uh

potent fox
#

you are so bad

gritty sparrow
#

ikr pleading

green vessel
#

crazy!

dull magnet
#

Locked out? Message IT in the #it-team channel.

gritty sparrow
#

what is the purpose of this screenshot

#

idg

gritty sparrow
dull magnet
#

you both need to stfu tbh

gritty sparrow
#

:3

dull magnet
#

who cares bro

gritty sparrow
#

πŸ˜”

potent fox
signal hemlock
#

@green vessel did you seriously just send my screenshot of the admin panel

#

πŸ’€

green vessel
#

I got IT to reset it πŸ₯Ά

signal hemlock
#

bro cropped out application name

dull magnet
gritty sparrow
potent fox
#

dont worry its secret of mine

gritty sparrow
#

its still up there

signal hemlock
#

explod

gritty sparrow
#

@dull magnet send 2fa code pls πŸ™

dull magnet
#

273891

potent fox
#

husk is this 5 year old admin panel or smthn

gritty sparrow
#

thx worked

gritty sparrow
#

the same one the osinted guy sent

dull magnet
#

don't let discord know i gave you my login

gritty sparrow
#

i wonder where he got that one from

dull magnet
#

they will fire me

gritty sparrow
#

erik wont know

#

πŸ™

signal hemlock
#

erik doesn’t snitch you can tell him

#

trust me bro

gritty sparrow
#

awww he left

#

:(

signal hemlock
#

:(

dull magnet
#

made him leave

#

bully

gritty sparrow
dull magnet
#

no way bro forked every discord repo and starred his fork

glass oracle
#

self appreciation πŸ™

gritty sparrow
#

so from my knowledge of discord staff

potent fox
#

his only id is 203526789849415680

gritty sparrow
#

i tracked him down

potent fox
#

@chrome umbra

gritty sparrow
#

that discord staff is 1112974718518186075 - erik.burbulla

#

also i was preparing a ban gif for him

dull magnet
potent fox
#

I still dont get why people think discord admin panel is so hidden

dull magnet
#

why would he censor so poorly

glass oracle
potent fox
#

like it of course exists

dull magnet
#

at least hide the bio as well

gritty sparrow
gritty sparrow
#

got it from the start of the snowflake

potent fox
#

this is only for discord staff testing

dull magnet
potent fox
#

(only readme file)

gritty sparrow
glass oracle
dull magnet
#

discord staff use that repo don't you know

gritty sparrow
glass oracle
#

yeah they totally upload their DB migrations on a public repo

#

no shit sherlock

gritty sparrow
#

they love their gists

potent fox
#

what if this guy was actually discord employee

#

and he is gonna ban all of us now

gritty sparrow
#

:3

glass oracle
#

bro would know

austere mauve
#

inside tetr.io's asar theres a readme thats supposed to be for their repo lol

gritty sparrow
#

and why would erik ask him if he has access to admin panel

#

duh

austere mauve
#

it had a snarky message at the bottom like "if you have a feeling you shouldn't be seeing this, go away"

dull magnet
#

adding that to all vencord repos

#

brb

austere mauve
#

true

gritty sparrow
#

he would get 50 rep for high/crit

#
  • 7 for triage
#

he would have 57

#

unfortunate

glass oracle
gritty sparrow
#

he wouldnt be on the h1 list

gritty sparrow
glass oracle
#

well it's 170 employees less now

gritty sparrow
#

its 830 now

glass oracle
#

bro's got count

dull magnet
#

831

potent fox
gritty sparrow
#

h1 rep

dull magnet
gritty sparrow
#

yeah

dull magnet
#

remember tencent bought discord

potent fox
#

how do I incrfease

dull magnet
#

post china propagands

dull magnet
#

every time you post this song you get 2 reputation

gritty sparrow
dull magnet
#

for every person that clicks the link you get an extra 0.5 reputation

pliant pasture
glass oracle
gritty sparrow
#

i tried that one

glass oracle
#

kedas jumpscare

glass oracle
#

GET THE FUCK OUT

austere mauve
glass oracle
#

gonna add that to all my repos

dull magnet
#

amazing alt text

austere mauve
proud parrotBOT
dull magnet
#

they should make better rust

glass oracle
#

use even better toml

austere mauve
#

why did they do that

gritty sparrow
austere mauve
#

bettertoml is just taplo lsp

dull magnet
glass oracle
#

better rust deprecated since 0.1.0 use even better rust instead

potent fox
#

wth is discord_ai

glass oracle
#

clyde

gritty sparrow
#

yuh

glass oracle
potent fox
#

isnt that only gpt

green vessel
potent fox
#

venbot is dumb as hell

gritty sparrow
#

yeah venbot is actually hosted on discords servers

austere mauve
#

im the experiment

gritty sparrow
#

you're clyde

potent fox
#

okay

pliant pasture
#

Use the Even better TOML extension!

glass oracle
carmine spade
#

discord_cuties

glass oracle
#

someone should've leaked discord_api when being layed off

austere mauve
#

agony

gritty sparrow
#

3

glass oracle
carmine spade
#

no u

glass oracle
dull magnet
#

only noobs need source code

gritty sparrow
#

you know chat

dull magnet
#

true chads reverse engineer the minified code

carmine spade
#

real

austere mauve
#

discord_nsa

#

you will be banned

gritty sparrow
#

we should've asked brandon about admin panel guys

austere mauve
#

2ho the hell is tachiyommyo

dull magnet
#

jason to brandon the day he gets laid off: let's go brandon

gritty sparrow
#

(real)

viral roost
dull magnet
#

idk why i always think of let's go brandon when someone mentions brandon

#

secret maga supporter

glass oracle
#

discord_watchlist

viral roost
#

the fuck is a lets go brandon

glass oracle
#

you will code in s-expressions

gritty sparrow
glass oracle
#

(write eww widgets)

dull magnet
#

google it

glass oracle
gritty sparrow
#

:3

glass oracle
#

oh right summaries too

carmine spade
gritty sparrow
glass oracle
#

leaving rn

carmine spade
#

true

gritty sparrow
#

(people that joined before nick incident)

glass oracle
#

husk

carmine spade
#

UNKNOWN_FLAG_23 - hn member

gritty sparrow
#

fuck that flag

glass oracle
carmine spade
#

overflow

glass oracle
#

works on my machine

carmine spade
viral roost
#

mhm yeah i respect the tos

potent fox
glass oracle
#

what theme is that

viral roost
#

i am totally not actively breaking it nop i am a good discord citizen

dull magnet
carmine spade
glass oracle
#

thanks

gritty sparrow
#

sad shit

carmine spade
#

(apply HAS_UNREAD_URGENT_MESSAGES to yourself to make it more realistic πŸ’―)

sand portal
nocturne apex
#

vencord shikiblocks not available ?

fluid fjord
#

my plugin is in the userplugins folder, I assume that should work too.
I ran pnpm build and it built the files in the dist folder.
can I make VencordInstaller.exe use these files instead of the main vencord ones?

dull magnet
#

pnpm inject

fluid fjord
#

yea that works for me but I didn't know how I can make my friend install it without having nodejs etc. installed
I see now that there's a VENCORD_DEV_INSTALL env var for the installer, I think that's what I needed. I'll try that thanks

dawn echo
#

is it just me or did discord discontinue the "streaming" activity type

#

"type must be one of [0,2,3]"

frigid bay
#

unless that works differently now

#

then idk

dawn echo
#

man what the hell

fluid fjord
dawn echo
frigid bay
#

do it

dawn echo
#

like discord is just telling me to fuck off lol

#

"type must be one of [0,2,3]" πŸ€“

gritty sparrow
dawn echo
#

WHAT THE FUCK

#

FIELD TYPE DESCRIPTION
name string Activity's name

ITS RIGHT THERE

#

ITS REQUIRED

#

WDYM "NO"

#

the documentation is gaslighting me

frigid bay
#

theres unofficial docs for discord stuff

#

maybe those are better

#

πŸ›Έ

dawn echo
#

discord.sex manface

#

gahhhhh it copied the official documentation

frigid bay
#

its not 1:1

#

theres additional stuff

dawn echo
#

is my discord application sterilized or smth

frigid bay
#

maybe

dawn echo
#

why cant i use like 90% of the features

#

"id" is not allowed, "created_at" is not allowed, "name" is not allowed, "url" is not allowed

viral roost
frigid bay
#

btw i dont actually know how to help you so dont feel lost when i cant help bleh

#

i dont do discord stuff its just that ive heard of unofficial docs and thought those might help

dawn echo
#

k

#

ill go cry in a corner or smth

#

my ass is NEVER developing discord stuff again

#

wait i can leech off of other peoples discord applications xdd

gusty maple
clear parcel
#

rpc?

#

because rpc never allowed streaming

dawn echo
#

a

#

alrighty

#

what allows streaming

clear parcel
#

what are you tryna do

dawn echo
#

the goal is to make a streaming thingy

#

basically rip off the vencord rpc thing

#

so i can change the status to streaming without actually streaming anything

clear parcel
#

as in a plugin?

dawn echo
#

yeah

clear parcel
#

why duplicate it lol

#

but either way set the activity within the client

dawn echo
#

k

clear parcel
#

don't try to use rpc

dawn echo
dawn echo
#

back to hunting for solutions!!!

green vessel
#

For some reason can't talk in #πŸ‘Ύ-core-development but is it possible to stop the client from compressing images upon upload?

frigid bay
#

only changes metadata

#

i tried with a jpeg

warm gulch
balmy sky
#

Is there a way i can use the .split() method without removing the split character? if i split "one. Two" by . for example, it will return one and two but i want it to include the punctuation in the array element

dull magnet
#

users can do this globally

warm gulch
dull magnet
#

yes soon

dull magnet
#

holy shit @trail ginkgo you gave me a good scare

#

i was skimming vencord bundle.js

#

and i got a mini heart attack from this

#

thinking i messed up bundler somehow

trail ginkgo
#

LOL

#

how is that even there

#

ohh its the shiki example

dull magnet
#

its the shiki example

#

xd

austere mauve
#

the eslint disable header goes hard

trail ginkgo
#

LMAO

#

functional and helpful

austere mauve
#

big part of the example

dawn echo
#

(that took WAY too fucking long)

clear parcel
#

np meowlien

dull magnet
#

@grim hare btw, plugins now can have their own native code

you can likely use electron frame created event to patch the frames src and it likely can automatically bypass csp

#1032200195582197831 message

grim hare
#

ooo

#

i'll take a look maybe tomorrow since I have a holiday

#

anywhere I could quickly reference to see a plugin with native code?

dull magnet
#

fixspotifyvolume

#

it does exactly what you need

#

patching iframe

#

it's incredibly simple you just create a native.ts file and that will be bundled with native code

any exported functions will automatically be turned into ipc methods

#

really need to work on docs

grim hare
#

got pulled away but

#

that sounds great

#

I'll definitely take a look tomorrow

grim hare
#

sad day

#

frame.url is readonly so I can't assign to it to change the frame URL

#

I can use JS to redirect (what I tried above) but that hits CSP still

#

unless I'm missing something pretty obvious I don't know that there's another way to patch the frame's src property

#

oh wait I have an idea

#

nvm, since vencord's csp patcher noops webrequest.onHeadersReceived I can't do what I was planning to

#

however

#

since plugins now have an easier way to hook into native I think building that csp api thing that has been thrown around in the past would be pretty easy

#

I might see if there's something I can do

grim hare
#

alright I got something that works but it does require some slight changes to src/main/index.ts

dull magnet
#

i honestly don't know much about the frame api

#

Also can you change webframe options? if yes you could disable csp enforcement for it

vast karma
#

I'm trying doing import traverse from "@babel/traverse"; in a node project, which according to docs should give a function, but instead it gives an object where .default is that function

#

What am I doing wrong?

dull magnet
#

nothing

vast karma
#

Are the docs wrong then?

dull magnet
#

the module is bundled wrong it seems

#
// le scuffed module
import * as babelTraverse from "@babel/traverse";
const traverse = babelTraverse.default;
vast karma
#

I love the js ecosystem

dull magnet
#

wait

#

nvm it would be .default.default

#
// le scuffed module
import babelTraverse from "@babel/traverse";
const traverse = babelTraverse.default;
#

funny

grim hare
#

admittedly the event kinda feels like a glorified way to tell if an iframe has been created on the page or not, it's incredibly limited aside from being able to execute some js or send a message to the frame

dull magnet
#

hmm

#

i think i know a way

#

hmmmm

#

but

#

you can't actually use that because you will overwrite discords handler

grim hare
#

that also doesn't apply here unfortunately

#

the heiarchy as I can tell is BrowserWindow -> webContents -> webFrameMain (what an iframe is)

#

I can't change the webSecurity property on an iframe directly, it's only on webContents

#

an iframe doesn't have its own webContents

verbal blaze
#

can i share programs i made in here?

thorn drift
verbal blaze
#

alright so i made a program that makes markiplier name soundalikesπŸ’€

jagged briar
#

As long as they aren’t viruses

thorn drift
#

most sane use of python i've seen this year

verbal blaze
verbal blaze
thorn drift
#

How do you guys feel about committing documentation changes directly to main without creating a PR and then merging it yourself? Is it bad or is it fine?

verbal blaze
#

if only i knew what that means😭

thorn drift
verbal blaze
#

ohhhh

thorn drift
#

the tradeoff is it being more of a pain to see who changed what and when vs having a cleaner pull request history.

#

I think its fine but I also thought a lot of other things were fine that aren't so that's why I'm asking chat.

#

example I realized was bad today: leaving a super long error dump log fully expanded when opening an issue instead of collapsing it

#

(I went back and fixed all of them) sparklee

thorn drift
rocky idol
#

how do you get members in a server

vast karma
#

Kidnapping is efficient

high thistle
thorn drift
#

writing a function somewhere else that only ever gets used once to call it is taking clean code too far @frigid bay

dull magnet
#

not necessarily

#

splitting your code into separate functions is good

#

even if you only call the function once

#

its easier to read if you split every section of the "pipeline" into separate functions

thorn drift
dull magnet
#

completely different file is weird

#

it should be same file if its use is related

frigid bay
#

maybe I should've kept the messages my bad, I deleted cus I thought question was vague and think I decided I'll keep it for now at least

#

I have a function that inits everything but there's groups of things that are inited if that makes any sense

#

something like this for example (pseudocode)```cpp
// all the init functions return a status that can be success or failure
status init_x() {
if (init_xx() != success) return failure;
if (init_xy() != success) return failure;
if (init_xz() != success) return failure;
return success;
}

status init_y() {
// similar to init_x
}
status init_z() {
// similar to init_x
}

status init() {
if (init_x() != success) return failure;
if (init_y() != success) return failure;
if (init_z() != success) return failure;
return success;
}

#

then init_x inits things related to x, init_y inits things related to y, and so on

dull magnet
#

whats success defined as

frigid bay
#

i was wondering if i should have it like that, or if i should inline them

frigid bay
#

ik its a bit ugly but

#

oh well

#

offtopic anyway

#

its dumb but shush

dull magnet
#

then why not

bool init() {
  return init_x() && init_y() && init_z();
}
frigid bay
#

ig something like that could work too yea, didnt think of that

frigid bay
#

idk if i like it but

#

oh well

frigid bay
#

i was wondering if instead of this i should do this: (give me a minute to write it :p)

#
status init() {
    if (init_xx() != success) return failure;
    if (init_xy() != success) return failure;
    if (init_xz() != success) return failure;

    if (init_yx() != success) return failure;
    if (init_yy() != success) return failure;
    if (init_yz() != success) return failure;

    if (init_zx() != success) return failure;
    if (init_zy() != success) return failure;
    if (init_zz() != success) return failure;

    return success;
}
#

thjere would be more than just 3 of each

#

doesnt rly matter in the end but i cant decide which is nicer

#

actually the code could be different than just similar copies of if (init_stuff != success) return failure

#

and it would init/do different things too

#

thats why i was thinking of separating it

#

ill just keep the separate functions at least for now

frigid bay
dull magnet
#

you could make an array with ur init funcs

#

and loop over it

pure temple
#

cleaner if you inline :)

dull magnet
#
#define INIT(NAME) if ((init_ ## NAME)() != success) return failure;

status init() {
  INIT(xx)
  INIT(xy)
  INIT(xz)

  return success;
}
#

maybe too cursed?

pure temple
#

i don't think you know what "clean code" means

#

you love :3

std::optional<CommandSpec> commander_parse(const std::string &in) {
    CommandSpec result;

    std::istringstream stream(in);

    std::string ids;
    if (!std::getline(stream, ids, ' '))
        return {};

    std::istringstream ids_stream(ids);
    std::string id;
    while (std::getline(ids_stream, id, '|'))
        result.ids.emplace_back(std::move(id));

    std::string word;
    while (std::getline(stream, word, ' ')) {
        std::string name;
        if (word.starts_with("--")) {
            name = std::move(word.substr(2));
            if (!std::getline(stream, word, ' '))
                return {};
        }

        FlagSpec flag{};
        if (word == "?")
            flag.type = FlagType::Void;
        else {
            if (word.ends_with('?')) {
                word.resize(word.length() - 1);
                flag.mode = FlagMode::Optional;
            } else if (word.ends_with("...")) {
                word.resize(word.length() - 3);
                flag.mode = FlagMode::Greedy;
            }

            if (!FLAG_TYPES.contains(word))
                return {};

            flag.type = FLAG_TYPES[word];
        }

        if (name.length() != 0)
            result.named_flags[name] = flag;
        else {
            if (result.unnamed_flag.has_value())
                return {};

            result.unnamed_flag = {flag};
        }
    }


    return {result};
}
frigid bay
#

there's init funcs on top of init funcs lmao

#

idk its kinda shit now but its consistent

#

or maybe not shit idk

#

im not quite happy with it but its either that or no error handling (or exceptions.. which i wanna avoid)

pure temple
#

if you do this, what's wrong with you

frigid bay
#

the macros? nah

#

i did at first

#

now its.. template functions

pure temple
#

why would you segment your init function like that

frigid bay
#

theres a lot of different stuff i init inside it

#

i dont wanna inline it all cus it would be a bit of a mess

pure temple
#

aren't they operating on different data anyway so you'd need to use a different function :p

#

unless this is C(-style)

frigid bay
#

ill maybe show some more code in a moment

#

so its easier to understnad

#

but maybe there is just a better way to do it and im dumb

balmy sky
#

Why is this

#

What

#

Just the entire codeblock being shown in replies NAH

frigid bay
#

lol

flint bronze
#

this is why I don't make Vencord plugins (I was going to make a "force show member safety page" plugin but the API behind it is locked and I can't be bothered finding members normally)

trim cedar
trim cedar
flint bronze
#

I wouldn't've needed to even call the functions to do it

#

All I wanted to do was always show a button/enable a menu without permissions

#

and the menu calls stuff that definitely needs the permissions :/

#

Back to looking at other stuff to improve :)

#

I will also confess that I have never submitted a PR to Vencord before

spare sky
#

hi
I'm coding a plugin
I'd like to know if it's possible to get a tampermonkey script, instead of injecting vencord.

dull magnet
#

pnpm buildWeb

spare sky
#

thx

frigid bay
grand haven
#

external plugins when

viral roost
#

never

grand haven
#

cri

#

external plugins plugin time it is

vast karma
#

That's probably not impossible tbh

#

The major obstacles, as I see it, are

  • I don't think all apis are exposed at runtime (i.e. only via import, not in window.Vencord)
  • Making a nice ui for it
  • Fending off the angry vees
jagged briar
#

If we wanted to we probably could but obviously we don’t want to

#

That’s the whole point of vencord

vast karma
#

A plugin for loading plugins would be rather meaningless tbh
Such a plugin has approximately negative 47% chance of being accepted upstream, so you can't use it without building from source
And if you're already building from source, you don't need a plugin for loading stuff

jagged briar
#

Exactly

spare sky
#

Is it possible to launch a console script (web) from a vencord plugin?

frigid bay
#

;

spare sky
#

?

frigid bay
#

'\

spare sky
#

β€Ž Β―_(?)_/Β―

frigid bay
#

;;;;m

spare sky
#

(_/)
( β€’.β€’)
/>?????

frigid bay
#

i think they just want to run js through a plugin

#

which i thought was the point of a plugin..

#

except for the regex patches

vast karma
#

Plugins are indeed capable of executing javascript

jagged briar
#

If it’s user input good luck if not then use exec

#

Oops

frigid bay
#

.info i believe

jagged briar
#

Thanks lol

frigid bay
#

:p

jagged briar
spare sky
#

Haaaaaaa

#

Ty !

pure temple
#

textreplace scripting will change everyone's life πŸš€

jagged briar
#

True

balmy sky
#

Grammar corrector thingy

#

Idk

#

Im just too lazy to add an apostrophe

frigid bay
vast karma
#

Apostrophe's are pointles's an'way

jagged briar
#

dont tell me you made a plugin for this

frigid bay
#

i assume its textreplace

balmy sky
frigid bay
#

prob not

jagged briar
#

textreplace is your friend

balmy sky
#

Would textreplace even work for this

jagged briar
#

yes

balmy sky
#

What about capitalisation

#

Like if i type dON't

#

It does it correctly

#

You might be able to do that with textreplace regex idfk

jagged briar
#

you can totally do that

#

it's not hard

balmy sky
#

Welp too late now

floral plaza
#

i mean if you can use a case insensitive regex it will

vast karma
#

(\b[dD][oO][nN])([tT]\b) β†’ $1'$2

#

Or yeah insensitive

balmy sky
#

I mean eh it's fine, if it works it works

weak idol
#

tessie w

hushed bloomBOT
raw portal
#

do third party plugins you make get added to to the offical menu

#

like if u want or somthing

vast karma
#

They're in the same page in the settings, yes

raw portal
#

no i mean do they add them to the offical thingy

vast karma
#

If you make a pull request and it is accepted, I guess

raw portal
#

gotcha

#

also is there like a template i can use to try out

vast karma
#

Just check what all the other plugins do

raw portal
#

can i just xopy and paste e, like a third party one or are they made diffrently

trim cedar
amber basin
#

wtf

#

trying to patch a website and

#

its webpack but without the webpack

#

??????????

dull magnet
#

yeah

#

that's when they don't use chunks

#

it's still webpack tho

amber basin
#

how would i go about webpack patching then

dull magnet
#

you can use prototype pollution to get access to the webpack instance

frigid bay
vast karma
#

I thought that was obvious

amber basin
#

webpackgrabber doesnt get it :c

#

i put a console.log in it and it looks like its not setting Function.m

dull magnet
#

send website

#

if wpgrabber doesn't get it then it's likely a different bundler

#

ill check soon once i get on pc

amber basin
#

its the vrchat website

#

trying to fix a bug that crashes the ui

vast karma
#

Yep, that thing doesn't define any m

balmy sky
#

Which part of the code is responsible for zooming in/out the client? I'm trying to modify it so that the scaling is linear and smooth instead of snapping, but i'm having trouble finding the relevant code. nya

amber basin
#

its using some mangled form of webpack, but all the variables are renamed i think

balmy sky
#

Oh boy

vast karma
balmy sky
frigid bay
balmy sky
#

True

frigid bay
#

on web its handled by the browser

#

and it looks the same as on app

#

nearly 1:1 same

vast karma
#

Why would electron make their own zoom function when the browser it's wrapping already has one

dull magnet
frigid bay
#

i tried asking gpt 3.5 if it can make my code cleaner to see what it can do but all it did was change the naming convention and indentation 😭 this ai is so useless for code

#

"Your original code seems fine in terms of functionality." fuck offf

dull magnet
#

yes

#

ai suxx

#

so dumb

thorn drift
#

if anyone speaks github actions please help. it brokey. 😭

on: [push]

jobs: 
 build:
  runs-on: ubuntu-latest  
  steps: 

    - name: Automated XPI build process
      uses: TheDoctor0/zip-release@0.7.6
      uses: my/extension/directory
      with:

        filename: nightly-release.xpi
        type: 'zip'

        exclusions: '*.git* *.ps1* */gre-resources/* */other-tools-and-tests/* *.editorconfig'
        directory: .
        path: .```
frigid bay
#

idk if its even valid code because it uses types im not familiar with

#

i should really learn the c++ stl...

floral plaza
frigid bay
#

i wonder how much better gpt4 is, id like to try it but im definitely not gonna pay for it and neither do i write code that often so i wouldnt even use it that much

floral plaza
#

wait nvm comments

thorn drift
#
on: [push]

jobs: 
 build:
  runs-on: ubuntu-latest  
  steps: 

    - name: Automated XPI build process
      uses: TheDoctor0/zip-release@0.7.6
      with:
        filename: nightly-release.xpi
        type: 'zip'

        exclusions: '*.git* *.ps1* */gre-resources/* */other-tools-and-tests/* *.editorconfig'
        directory: .
        path: my/extension/directory```
this version is marginally less broken but still fails with a nothing to zip error
#

I tried 17 times lol

dull magnet
#

oh my god

#

remove the useless comments

#

terrible

thorn drift
#

1 useless comments removed later

#

but how do i fix it 😭

floral plaza
#

why aren't you checking out the repo

thorn drift
#

because I have no idea what I'm doing

thorn drift
#

IT WORKED OMG TYSM

thorn drift
frigid bay
dull magnet
#

yeah how do u expect it to do anything without a checkout 😭

#

also i recommend using long commit hash instead of tags

#

TheDoctor0/zip-release@0.7.6

#

this is unsafe

amber mantle
#

horror

#

make vrchat website client mod

#

the time has come and so have i

frigid bay
#

ik this sounds like a big xyproblem but does anyone know how i could make a global variable in a header file that is only accessible from said file in c++

#

i tried the static keyword and unnamed namespaces

#

idk if its possible but if it is then @ me

pliant pasture
# frigid bay idk if its possible but if it is then @ me

Have you tried using static variables inside a function?

Or you could also try at managing how global variables link up by splitting where you declare and define them into different files, blobcatcozy It's a bit on the advanced side though

#

you can manually control the linkage of global variables by separating the declaration and definition of the variable in different files

frigid bay
#

I mean the static var in func

mystic sable
#

what is the error ur getting?

#

cause there's like 10 kajillion things u can do but what is the problem created by the one that works and why does other methods not work

#

stackoverflow rule appreciation moment WHAT

frigid bay
#

I don't like the assembly generated by the static var it's pointless maybe clang does a better job at making it not shit tho I haven't tried

mystic sable
#

dude

frigid bay
#

Yo

mystic sable
#

then write the assembly

frigid bay
#

there should not be any assembly

#

global var does the job

mystic sable
#

why is there assembly then

#

also

#

what kind of c++ file is this

#

static is one thing but also assigning a variable as private

#

which is stupid ik but like

#

micro-optimization is the killer of code lol

#

and if static vars are creating issues in ur code then it could be an actual code problem not a var type problem

frigid bay
#

because it initializes stuff for no reason when it can just be a value in .rdata bleh idk how else I can describe it

mystic sable
#

okay so this is a using c++ problem

#

since quite frankly it's a quirky language

frigid bay
#

it's probably a compiler problem idk I use msvc

#

i tried making it const static but it treats it like it isn't const

#

and does some bs

mystic sable
#

send me ur fucking code in a dm i'll check it for stupid shit

#

cause if it's ignoring const you might have bigger problems

frigid bay
#

It's a 2 line template function maybe the template is an issue

mystic sable
#

yes

#

correct

frigid bay
#

I'm on mobile I can't send shit

#

πŸ’”

mystic sable
#

bro writing c++ on mobile?!?

frigid bay
#

no I'm just not on my pc

#

lol

mystic sable
#

lol

#

yea templates are

#

weird

frigid bay
#

templates are silly but it should still just put the thing in rdata which is basically just read only stuff that doesn't need to be inited or anything

#

I just want to pass a pointer to a const 32 bit value

#

to a func

#

and have it not be dumb

#

that's all

mystic sable
#

c++ is not good with passing shit inherently

#

it's extremely hard typed

frigid bay
#

idk why it's like that, I don't care about small optimization THAT much but I wanted to see if I could make it a bit less dumb nonetheless :P

#

because it does not need to be doing whatever it's doing

mystic sable
#

idk look it up on the c++ creators q&a

frigid bay
#

like it's a very simple thing idk why it's so overcomplicated

mystic sable
#

probably has a reason

pliant pasture
# mystic sable c++ is not good with passing shit inherently

I fucking love header files. Truly i need truly, I need more header files in my life like I need a hole in my head. There's nothing quite like the thrill of scrolling through hundreds of lines of declarations, searching for that one elusive function prototype. It's like a treasure hunt, but instead of treasure, it's a pointer to a function you can't remember writing. Ah, the sweet, sweet smell of a build breaking because of a missing semicolon in a header file you didn't even know you were using. Truly, header files are the gift that keeps on giving ❀️

frigid bay
#

also when I make it a global const variable it just like.. makes duplicates of the value? for some fucking reason?

mystic sable
#

what are you using to debug

mystic sable
#

i'm the anti-java

frigid bay
#

I'm just dropping the binary into a static disassembler/decompiler LMAO I know it's dumb but I'm used to it

pliant pasture
frigid bay
#

oh I don't use it to debug don't worry

#

only for dumb shit like this

mystic sable
#

are u a college student

frigid bay
#

no

mystic sable
#

are you a student

#

of any kind

frigid bay
#

no

mystic sable
#

okay then just find a debugging program or plugin made for c++

frigid bay
#

i know how to debug

#

I don't wanna debug I wanted to analyze stuff statically to see if the compiler was doing dumb shit to a func I wrote

mystic sable
#

okay but a debugger can do that better than you looking at that shit

frigid bay
#

I wanna look at code not debug it

mystic sable
#

okay

frigid bay
#

in this specific case

mystic sable
#

do you understand what a debugger does

frigid bay
#

yes

mystic sable
#

what does it do

frigid bay
#

dude

#

what is this lmfao

mystic sable
#

i feel like you don't understand that a debugger can point you to exactly where the thing you want to figure out is happening

#

like looking under the hood

frigid bay
#

I don't want to run any code and neither is there a bug anywhere in the code

mystic sable
#

that's not the only reason to use a debugger!

#

debugging programs also allow you to easily see where shit is happening

#

like if your function is generating this stuff and you don't like it

#

you can look under the hood and see "oh c++'s blah blah blah file is creating this blah blah blah and the forums say blah blah blah avoids this"

frigid bay
#

by generating I don't mean it's doing something wrong

#

the result is as expected

mystic sable
#

of course but it's doing something you don't desire, correct?

frigid bay
#

in the generated asm it's doing stuff that I feel like should be optimized but is not

mystic sable
#

so you can see, when using a debugger, where the asm generation is doing what you don't want to do

#

debugging is a bad term

#

refactoring is a better term

#

because your code works, but you're optimizing it

#

debuggers can be both used to debugged but are even better for advanced refactoring if used optimally

frigid bay
#

yea but it's not even really related to my code, it's just that declaring a const static variable is doing dumb stuff that it doesn't have to be doing :p so idk if there's anything I can do about that

#

ik what causes it to be doing what it's doing I just don't know what to do about it

#

other than a global const variable

mystic sable
#

again using a debugger may show you the answer in allowing you to look up how to avoid the specific thing you're seeing from generation as the c++ insides

#

like "file **.c line *****"

frigid bay
#

well idk whats possibly avoidable in const static uint32_t test = 0xffff7fff; i might just be completely misunderstanding and being stupid if that's the case then I'm sorry

mystic sable
#

so when the compiler compiles that, it's converting a pointer to another value

#

a debugger will show you where that conversion is

frigid bay
#

no pointers in the code I sent

mystic sable
#

well besides the pointer, it will show you what file the asm is being generated in

frigid bay
#

if u mean the specific line of code I sent then there are no pointers there

mystic sable
#

yes but the compiler isn't magical with curtains close

#

it has to reference another file to understand the input

#

a debugger can show you where in another file the magic is happening

frigid bay
#

not sure how this relates to anything if I gotta be honest, this is all done at compile time anyway

mystic sable
#

😭 im too tired to explain better

frigid bay
#

me using unsigned long instead of uint32_t won't change anything :p

#

if that's not what u mean then idk

mystic sable
#

i mean the debugger can show you where ur asm code is being generated from as in where the conversion from ur typed function, as in the middle man

#

like ur code -> msvc (debugger shows u here) -> asm

frigid bay
#

I don't think any kind of conversion is related to the issue tho :P I'm only declaring a static const 32 bit variable then passing a pointer to it

#

I could try doing uh

#

const static unsigned long test = 0xffff7ffful; this should have no conversions, unless ur describing some other kind of conversion but I dont think anything else would be related to this anyway

#

passing a pointer shouldn't convert anything and actually using the variable doesn't cause the issue I think, I'm p sure it's just that the declaration causes some avoidable nonsense since it's const but there's some weird bs being done that would only matter if it wasn't const

#

idk I wanted to sleep more but I'll prob just get up maybe I can send some code and maybe it can clear things up

#

godbolt compiler explorer my beloved might be able to help maybe

#

cus I think I can show the issue in 2 lines of code

#

"issue" not even rly an issue just lack of optimization I guess

#

I could also just completely ignore this because in the end it makes basically zero difference but I'm a bit of a nerd about this kind of stuff so might as well try to optimize it :p

mystic sable
#

ignore it, get sleep, goodnight

frigid bay
#

Compiler.. From OHIO!! 🀣🀣🀣

frigid bay
#

I appreciate you helping though

trim cedar
trim cedar
trim cedar
trim cedar
frigid bay
#

msvc

#

I'll show code and stuff soon

frigid bay
#

the thing is not compile time

#

global variable works but its a bit weird

trim cedar
#

so the value is not fixed?

frigid bay
#

ill explain from scratch in a moment

trim cedar
#

Meaning you initialize it like that: static const auto something = some_func()?

#

or how are you gonna initialize a const global?

frigid bay
#

const static uint32_t a = 12859071;

#

does constexpr differ from const here? if its used in runtime

trim cedar
#

depends on the compiler, but if that is your actual line why would you not make it constexpr?

frigid bay
#

fair point

trim cedar
frigid bay
#

yeah lol

#

ill see if i can show waht the "issue" is in godbolt

#

im yet to try clang still

trim cedar
frigid bay
#

yeah i was tired and went to bed

trim cedar
frigid bay
#

and also kind of fixed it with that global var anyway

trim cedar
#

no copy on gcc

frigid bay
#

yeah thats not exactly the issue ill explain in a moment

#

its like that in msvc too (but for some reason theres multiple deadbeef copies in rdata, even if unused...? idk what thats about.. but oh well

frigid bay
#

in my binary

#

ill show what i mean in a moment

#

could be template func dumbness

trim cedar
#

if it's not constexpr and in a header (and not inline) that's to be expected when you include the header from multiple places

frigid bay
#

hm true that could be it

trim cedar
#

remember

frigid bay
#

idk why theres unused ones tho

trim cedar
#

the compiler just copy pastes it (the header) into your source file when you include it

frigid bay
#

yea true

trim cedar
frigid bay
#

🫨 i think literally making it constexpr instead of const fixed the issue i had, i feel really stupid idk why i hadnt tried that

#

ok so the issue i had is i had a const static variable in a func but it was being initialized for some reason instead of just being a value somewhere in .rdata

#

if that makes any sense? sry if im being dumb about this

trim cedar
#

in a func

frigid bay
#

yep

#

i know

#

but its const

trim cedar
#

That is different from other static initialization

frigid bay
#

yea

#

ik

trim cedar
#

Doesn't matter

frigid bay
#

im aware

trim cedar
#

It gets initialized the first time it's seen

frigid bay
#

yep

trim cedar
#

even if it's const

#

const doesn't matter here

#

The initialization could have side effects

frigid bay
#

ok i think i get it now actually

trim cedar
#

in cases like that simply make it constexpr, especially since it's just a primitive

frigid bay
#

yeah it was 5am and i half forgot what constexpr did i guess bleh

#

i was confused because i just made it a constant that was known at compile time

#

so i wasnt sure why it was initialized

#

but i guess the compiler needs to be told that its a constexpr

#

which makes sense

#

i kinda forgot

#

now its doing exactly what i expected it to do

trim cedar
#

The "hard part" of C++ is to know how to express to the compiler that you want this one specific thing to happen

#

Which can get quite tricky sometimes, especially with all the rules there are

frigid bay
#

:P that thing with forceinline noexcept i mentioned some days ago still pisses me off bc its the only reason i entirely disabled c++ exceptions

trim cedar
#

not sure what that was to be honest xd

frigid bay
#

ah yea fair

#

it just refused to do what i wanted to do is my point

#

idk if it was me being stupid (the code is over 2 years old and lost now because version control is for losers) or if it was a msvc moment

trim cedar
#

I mean in the worst case there's always compiler specific attributes that can force the compiler to do something

frigid bay
#

ig but the thing is that i tried to do just that and it wouldnt do it, probably just me being dumb tho as i said, cant check now

#

either way thanks for reminding me to try constexpr lmao i told myself "no way that it makes a difference here" and just never tried it until now loll

#

lesson learned

trim cedar
#

The __forceinline keyword overrides the cost-benefit analysis and relies on the judgment of the programmer instead. Exercise caution when using __forceinline. Indiscriminate use of __forceinline can result in larger code with only marginal performance gains or, in some cases, even performance losses (because of the increased paging of a larger executable, for example).

#

(MSVC specific though!)

frigid bay
#

yea it just wouldnt inline it even tho i used that for some reason

#

if i remember it right

trim cedar
#

You can't force the compiler to inline a particular function, even with the __forceinline keyword

#

that probably explains it

frigid bay
#

The function and the caller use different types of exception handling (C++ exception handling in one, structured exception handling in the other).

#

arrgh

#

it s probably the caller

#

that was the issue

trim cedar
#

is the caller winapi?

frigid bay
#

thats what i was thinking but as i said i cant check now bc the code is gone

trim cedar
#

If the compiler can't inline a function declared with __forceinline, it generates a level 1 warning, except when:

#

Should check your warnings :P

frigid bay
#

huh, i swear i wouldve noticed if i got one

#

ugh lol oh well

#

im actually writing something very similar to that old project now

#

might see if its still an issue

#

maybe

#

idk i dont use anything that uses c++ exceptions right now anyway

#

so no need

trim cedar
#

may I ask what? Because forcing inlining is usually nothing you'd care too much about even in performance critical software

frigid bay
#

the func in question was a helper func for calling vmethods

trim cedar
#

ah, well I guess that would make sense there

frigid bay
#

yeah

#

i prob forgot a noexcept somewhere

#

that one time

flint bronze
#

bruh

#

Discord does NOT want me to make plugins (The functionality exists in the normal client but hidden away behind a keyboard shortcut)

frigid bay
#

Sorry to hear

flint bronze
#

i guess I can still patch that to be a smaller number

trim cedar
#

oh wow is that a notification mute shortcut?

flint bronze
#

Timeout member button

trim cedar
#

ah lol

flint bronze
#

I was gonna put a quick timeout button below it

#

but you can press control to do the same thing

trim cedar
#

could still be useful to have a plugin to patch out the key requirement

#

in case you need it a lot

flint bronze
#

i mostly just want to lower the 60 seconds down to something like 15 seconds

#

i mean overhaul that UI that pops up with a slider too

viral roost
#

discord doesnt let you go below 60s normally right

#

passing a duration you cant set through the client could be a bit face_with_raised_eyebrow but kinda doubt it now that i think about it

flint bronze
flint bronze
#

I will probably put a disclaimer

pure temple
#

couldn't you change your time xd

#

wait no probably not

flint bronze
#

yes you could

shadow ruin
#

guh

#

right

frigid bay
shadow ruin
#

/run c #include <stdio.h> int main() { char s1[] = "guh"; s1[0] = 'b'; printf(s1); }

worldly oxideBOT
#

Here is your c(10.2.0) output @shadow ruin

buh```
shadow ruin
#

ok so

#

buh

#

/run c #include <stdio.h> int main() { char s1* = "guh"; s1[0] = "b"; printf(s1); }

worldly oxideBOT
#

@shadow ruin I received c(10.2.0) compile errors

file0.code.c: In function 'main':
file0.code.c:3:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
    3 |   char s1* = "guh";
      |          ^
file0.code.c:3:12: error: expected expression before '=' token
    3 |   char s1* = "guh";
      |            ^
file0.code.c:4:3: error: 's1' undeclared (first use in this function)
    4 |   s1[0] = "b";
      |   ^~
file0.code.c:4:3: note: each undeclared identifier is reported only once for each function it appears in
chmod: cannot access 'a.out': No such file or directory
/piston/packages/gcc/10.2.0/run: line 6: ./a.out: No such file or directory
shadow ruin
#

ye

#

why

frigid bay
#

char *s1

#

not

#

char s1*

shadow ruin
#

guh

#

/run c #include <stdio.h> int main() { char *s1 = "guh"; s1[0] = "b"; printf(s1); }

worldly oxideBOT
#

@shadow ruin I received c(10.2.0) compile errors

file0.code.c: In function 'main':
file0.code.c:4:9: warning: assignment to 'char' from 'char *' makes integer from pointer without a cast [-Wint-conversion]
    4 |   s1[0] = "b";
      |         ^
/piston/packages/gcc/10.2.0/run: line 6: 31408 Segmentation fault      (core dumped) ./a.out "$@"
shadow ruin
#

ye

#

this was my question

frigid bay
#

ur setting the 1st character to the LSB of the address of "b"

shadow ruin
#

please talk in stupid language

frigid bay
#

you code bad write

#

is error bad unexpect behavior

mild ermine
flint bronze
viral roost
#

(usually, unless the theme def specifies that's what you should use)

mild ermine
viral roost
#

fair

flint bronze
#

does it not follow redirects to the raw subdomain due to csp or something

viral roost
#

the issue is not sending proper content type but vencord fixes that

mild ermine
#

I don't think it matters if it's https or http

#

It's just it can't not include it

#

Like it has to have the https://www. as www. will use Vencord//www.

trim cedar
#

this no work

shadow ruin
#

oh that was just a typo

#

what i was trying to do is

#

/run c #include <stdio.h> int main() { char *s1 = "guh"; s1[0] = 'b'; printf(s1); }

worldly oxideBOT
#

@shadow ruin I only received c(10.2.0) error output

/piston/packages/gcc/10.2.0/run: line 6: 32607 Segmentation fault      (core dumped) ./a.out "$@"
trim cedar
#

the string may reside in read only memory because it's actually a constant

#

/run ```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

char* strdup(const char* src)
{
char* rtn = malloc(strlen(src) + 1);
strcpy(rtn, src);
return rtn;
}

int main() {
char *s1 = strdup("guh");
s1[0] = 'b';
printf(s1);
free(s1);
}```

worldly oxideBOT
#

Here is your c(10.2.0) output @trim cedar

buh```
trim cedar
#

bruh where is strdup

shadow ruin
#

/run bash man strdup

worldly oxideBOT
#

@shadow ruin I only received bash(5.2.0) error output

file0.code: line 1: man: command not found
shadow ruin
#

WHAT

trim cedar
#

???

#

ah

#

it's not a standard c func

trim cedar
#

gnus libc should have strdup though

#

you're normally only allowed to treat strings defined in code (not dynamically allocated) as const, however I think C has extensions where it is allowed to not do that - however as you can see that's not a good idea

dull magnet
#

C polyfills wtf

#

is this why autoconf and shit exists

trim cedar
#

not really I think

pure temple
#

something i have concerns with with writing a discord bot in C++
is security 😭

#

it couldn't be that bad, could it?

#

i imagine use after free can create vulerabilities, that's the main thing i might end up doing

#

yeah i should just use the crap out of shared pointers and the code will be totally safe

#

i guess this is why rust has the lifetime stuff

#

my bot "idea" is esentially dyno/carl/mee6/whatever generic thing but good trolley

frigid bay
#

theres a compiler thing to detect buffer overflows

flint bronze
#

jk all the existing ones suck

pure temple
#

and as you can imagine people give bots like that admin (for no reason)

flint bronze
pure temple
pure temple
#

C++ experience

pure temple
#

i guess sometimes you need them to avoid copying (they are more explicit than references so maybe better)

#

actually if you're just using a value and not storing it anywhere else references are fine...

#

introducing multithreading...! trolley

trim cedar
#

won't be worse than with any other language

pure temple
#

can you give some examples of screwing up

#

because i've still only been writing cursed C++ for a few years...

trim cedar
pure temple
#

LOL

trim cedar
#

jk