#π§©-plugin-development
1 messages Β· Page 45 of 1
insane
thats the admin panel
nothing else
it has been recreated from our screenshots anyway
or at least the user page
Send me it rq
The one currently is different,
it's the updated 2024 one.
They changed some stuff around.
its closed source i dont have access to it duh
Well anyway, it's embeded into here:
"Discord"
or at least it's suspected
but its not true
dawg what???
?
Most users think the admin panel is on that top button,
idk who is your so called "most users" but no its not
Meaning most users who have no idea into the Discord Data Mining community
etc
okay, tell me where the admin panel is then
the website they're using
Ask someone in the DDM
Only few amounts of people know about it,
@carmine spade
yeah and that would be me
moving on, give me the link
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,
Β―_(γ)_/Β―
buddy the admin panel is no secret
It doesn't matter,
If it's reported. it's policies of H1.
Safe Harbor moment.
oh no!
i will get now banned from their h1
scary
so real!
i sure hope no one reports it!!! 
It's legit cf's auth for 0 trust π
yeah no shit
Meaning shit
it wouldn't be open
what will bro get π―
never
I think we can make a agreement
nuh uh
you are so bad
ikr 
Locked out? Message IT in the #it-team channel.
i will
you both need to stfu tbh
:3
who cares bro
awful
π―
bro cropped out application name
password is EpicDiscordoPassword24. don't tell anyone else
he actually didnt
dont worry its secret of mine
its still up there
explod
@dull magnet send 2fa code pls π
273891
husk is this 5 year old admin panel or smthn
thx worked
6 actually
the same one the osinted guy sent

don't let discord know i gave you my login
i wonder where he got that one from
they will fire me
dw my secret will be safe
erik wont know
π
:(
true...
he sent this
self appreciation π
so from my knowledge of discord staff
his only id is 203526789849415680
i tracked him down
@chrome umbra
that discord staff is 1112974718518186075 - erik.burbulla
also i was preparing a ban gif for him
i skimmed the bio and thought wow 15 year old staff they hire young nowadays
real.
I still dont get why people think discord admin panel is so hidden
why would he censor so poorly
me when post a screenshot of i <insert admin panel gif>
like it of course exists
at least hide the bio as well
unfortunately the original was deleted
all i needed was the join date
got it from the start of the snowflake
this is only for discord staff testing

(only readme file)
yeah literally
i could make a new one 
discord staff use that repo don't you know
chat is this real?
they would upload on a github gist
they love their gists
bro would know
it had a snarky message at the bottom like "if you have a feeling you shouldn't be seeing this, go away"
true
me when an employee doesn't know all other 999 employess
he wouldnt be on the h1 list
tin flashbacks:
well it's 170 employees less now
its 830 now
bro's got count
831
wth is reputation
h1 rep
china social credit system
yeah
remember tencent bought discord
how do I incrfease
post china propagands
every time you post this song you get 2 reputation
The second part where the woman is singing is called
Yanbian people love chairman Mao
lyrics:
eshang pajang hongya hong tong tonge
shinjong ditajang she Mao Zedonge.
Khali da women de ji pange
djengi pang shentang ja suo ju ren.
Hiyahi zu joh
jaja zu joah
djengi pang shentang ja suo ju ren.
Jeshang pajang hongya hong tong tong...
for every person that clicks the link you get an extra 0.5 reputation
hehehe :3
find discord_web source maps, send in my dms, report on h1
ez reputation
yeah
i tried that one
kedas jumpscare
GET THE FUCK OUT
true!
gonna add that to all my repos
amazing alt text
they should make better rust
use even better toml
why did they do that
while at it you can find
discord_api
discord_ai
discord_developers
discord_android
discord_ios
discord_analytics
discord_devtools_extension
bettertoml is just taplo lsp
when Best Toml
better rust deprecated since 0.1.0 use even better rust instead
wth is discord_ai
clyde
yuh

isnt that only gpt
@shrewd tundra
venbot is dumb as hell
yeah venbot is actually hosted on discords servers
you're clyde
okay
Use the Even better TOML extension!
discord_analytics
discord_android
discord_api
discord_app
discord_design_system
discord_devtools_extension
discord_ios
discord_media_proxy
discord_protos
discord_static
discord_web
discord_marketing
discord_tools

discord_cuties
as in this?

someone should've leaked discord_api when being layed off
agony
yuh uh now show folder size
you
3tb 
only noobs need source code
you know chat
true chads reverse engineer the minified code
real
we should've asked brandon about admin panel guys
2ho the hell is tachiyommyo
jason to brandon the day he gets laid off: let's go brandon
discord_pipebomb
idk why i always think of let's go brandon when someone mentions brandon
secret maga supporter
discord_watchlist
the fuck is a lets go brandon
you will code in s-expressions
me includeed
(write eww widgets)
youre the only one in that directory
and your alts
{"type":3,"name":"ai-target","description":"Specifies which target/model to build and deploy for discord_ai"}
:3
oh right summaries too
am i included too? π₯Ί
all of hn is
leaving rn
true
(people that joined before nick incident)
husk
UNKNOWN_FLAG_23 - hn member
fuck that flag
we all have 9999 π
overflow
works on my machine

mhm yeah i respect the tos
you need minified code first tho
what theme is that
i am totally not actively breaking it nop i am a good discord citizen
purple alien fart theme
we're all "breaking" it by using veecord 
(apply HAS_UNREAD_URGENT_MESSAGES to yourself to make it more realistic π―)
true

vencord shikiblocks not available ?
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?
pnpm inject
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
is it just me or did discord discontinue the "streaming" activity type
"type must be one of [0,2,3]"
theres someone streaming right now. so
unless that works differently now
then idk
man what the hell
okay that worked π
I made a zip file like this with the batch file being
set VENCORD_DEV_INSTALL=1
set "VENCORD_USER_DATA_DIR=%cd%"
start VencordInstaller.exe
the discord api makes me want to hurt people
do it
@clear parcel you love
https://discord.com/developers/docs/topics/gateway-events#activity-object
.....
"name" is not allowed..
WHAT THE FUCK
FIELD TYPE DESCRIPTION
name string Activity's name
ITS RIGHT THERE
ITS REQUIRED
WDYM "NO"
the documentation is gaslighting me
is my discord application sterilized or smth
maybe
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
nahhh who bought that
lol i just went on userdoccers and it redirected to that
btw i dont actually know how to help you so dont feel lost when i cant help 
i dont do discord stuff its just that ive heard of unofficial docs and thought those might help
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
Me
where are you getting this
rpc?
because rpc never allowed streaming
what are you tryna do
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
as in a plugin?
yeah
k
don't try to use rpc
because i am a filthy betterdiscord user addicted to betterdiscord plugins that dont work on vencord
welp that explains the errors..
back to hunting for solutions!!!
For some reason can't talk in #πΎ-core-development but is it possible to stop the client from compressing images upon upload?
it doesnt do that for me on pc
only changes metadata
i tried with a jpeg
(Flatpak Linux testing)
Hellou vencord users
I'm setting up Rich Presence (RPC) support to Flatpak Anki
If you want to test out see
https://github.com/flathub/net.ankiweb.Anki/pull/133#issuecomment-1891043930
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
i dont think pring this to a random flatpak is a good idea
users can do this globally
@dull magnet
Could we add Vesktop in Downloads
yes soon
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
the eslint disable header goes hard
big part of the example
np 
@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
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?
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
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
alright I got something that works but it does require some slight changes to src/main/index.ts
can you somehow cancel the frame creation and create a new one with the context from old one?
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
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?
nothing
Are the docs wrong then?
the module is bundled wrong it seems
// le scuffed module
import * as babelTraverse from "@babel/traverse";
const traverse = babelTraverse.default;

I love the js ecosystem
wait
nvm it would be .default.default
// le scuffed module
import babelTraverse from "@babel/traverse";
const traverse = babelTraverse.default;
funny
I can't seem to find a way to cancel frame creation (preventDefault doesn't do anything on the event object and stopPropogation doesn't exist contraray to what the types say) - even if I could cancel creation there's not a way for me to create a new frame
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
hmm
i think i know a way
hmmmm
you can disable csp for the frame via https://www.electronjs.org/docs/latest/api/web-contents#contentssetwindowopenhandlerhandler
Render and control web pages.
but
you can't actually use that because you will overwrite discords handler
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
can i share programs i made in here?
i wanna see 
alright so i made a program that makes markiplier name soundalikesπ
As long as they arenβt viruses
lmao
most sane use of python i've seen this year
idk how to make viruses idek how to make vencord themesπ
fr
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?
if only i knew what that meansπ
so basically updating the readme without asking nice
ohhhh
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) 
i've decided I'm just going to keep doing it and then say sorry if someone gets angy
how do you get members in a server
Kidnapping is efficient

writing a function somewhere else that only ever gets used once to call it is taking clean code too far @frigid bay
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
so if the function is in a completely different file you can understand that faster than having it inline at the single location its needed?
I never said different file, it's the same file
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
whats success defined as
i was wondering if i should have it like that, or if i should inline them
i actually just make it a bool and its true on success, i wrote it like that so its easier to read for u
ik its a bit ugly but
oh well
offtopic anyway
its dumb but shush
ig something like that could work too yea, didnt think of that
although the init_x/y/z funcs are just more of this
idk if i like it but
oh well
i edited this a little
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
either way ty for helping and also ty for suggesting this even tho its unrelated to what i originally asked, i remember wondering what the cleanest way to do something like this would be, maybe ill end up using this in the future if its applicable
horror
cleaner if you inline :)
or make a macro
#define INIT(NAME) if ((init_ ## NAME)() != success) return failure;
status init() {
INIT(xx)
INIT(xy)
INIT(xz)
return success;
}
maybe too cursed?
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};
}
this is kind of what I did at first but inside the init funcs
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)
if you do this, what's wrong with you
why would you segment your init function like that
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
aren't they operating on different data anyway so you'd need to use a different function :p
unless this is C(-style)
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
lol
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)
Never
std::expected :)
Maybe you should restructure generally
You'd probably be better of calling the discord functions instead of the API?
I was testing to see if it would work in theory
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
hi
I'm coding a plugin
I'd like to know if it's possible to get a tampermonkey script, instead of injecting vencord.
pnpm buildWeb
thx
I was thinking the same, I'm rly stuck on this and can't end up with anything I'm satisfied with, but this is good enough
external plugins when
never
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 inwindow.Vencord) - Making a nice ui for it
- Fending off the angry vees
If we wanted to we probably could but obviously we donβt want to
Thatβs the whole point of vencord
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
Exactly
Is it possible to launch a console script (web) from a vencord plugin?
;
?
'\
β Β―_(?)_/Β―
;;;;m
(_/)
( β’.β’)
/>?????
Elaborate
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
Plugins are indeed capable of executing javascript
If itβs user input good luck if not then use exec
Also this sounds like https://xyproblem.info
Oops
How ?
.info i believe
Thanks lol
:p
Look up 2 messages
textreplace scripting will change everyone's life π
True
Im
Apostrophe's are pointles's an'way
dont tell me you made a plugin for this
i assume its textreplace
I did 
prob not
Would textreplace even work for this
yes
What about capitalisation
Like if i type dON't
It does it correctly

You might be able to do that with textreplace regex idfk
i mean if you can use a case insensitive regex it will
I mean eh it's fine, if it works it works
tessie w

do third party plugins you make get added to to the offical menu
like if u want or somthing
They're in the same page in the settings, yes
no i mean do they add them to the offical thingy
If you make a pull request and it is accepted, I guess
Just check what all the other plugins do
can i just xopy and paste e, like a third party one or are they made diffrently
the basic structure is the same
wtf
trying to patch a website and
its webpack but without the webpack
??????????
how would i go about webpack patching then
you can use prototype pollution to get access to the webpack instance
if you look closely it says "grabber" here.... further proof of vencord being malware..
I thought that was obvious
webpackgrabber doesnt get it :c
i put a console.log in it and it looks like its not setting Function.m
send website
if wpgrabber doesn't get it then it's likely a different bundler
ill check soon once i get on pc
its the vrchat website
trying to fix a bug that crashes the ui
Yep, that thing doesn't define any m
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. 
its using some mangled form of webpack, but all the variables are renamed i think
Isn't that handled by the browser
I don't think so? on desktop you can ctrl +/- to zoom
yeah but isnt desktop basically a web browser anyway 
True
Why would electron make their own zoom function when the browser it's wrapping already has one
their webpack is really interesting
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
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: .```
ok i got it to do something when i told it exactly what i was trying to achieve
idk if its even valid code because it uses types im not familiar with
i should really learn the c++ stl...
your items arent on the same indentation
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
wait nvm comments
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
why aren't you checking out the repo
because I have no idea what I'm doing
IT WORKED OMG TYSM
i tried and then when i got to page 4 of me not understanding i gave up and went to stack overlfow with my errors
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
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
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,
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
yup I have, that's the first thing I tried, it works but causes something dumb that I'm trying to optimize, maybe a better compiler can solve it tho idk
I mean the static var in func
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 
there is no error
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
dude
Yo
then write the assembly
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
because it initializes stuff for no reason when it can just be a value in .rdata
idk how else I can describe it
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
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
It's a 2 line template function maybe the template is an issue
bro writing c++ on mobile?!?
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
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
idk look it up on the c++ creators q&a
like it's a very simple thing idk why it's so overcomplicated
probably has a reason
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 β€οΈ
also when I make it a global const variable it just like.. makes duplicates of the value? for some fucking reason?
what are you using to debug
i unironically enjoy header files
i'm the anti-java
I'm just dropping the binary into a static disassembler/decompiler LMAO I know it's dumb but I'm used to it

bro
bro
bro
bro 
are u a college student
no
no
okay then just find a debugging program or plugin made for c++
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
okay but a debugger can do that better than you looking at that shit
I wanna look at code not debug it
okay
in this specific case
do you understand what a debugger does
yes
what does it do
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
I don't want to run any code and neither is there a bug anywhere in the code
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"
of course but it's doing something you don't desire, correct?
in the generated asm it's doing stuff that I feel like should be optimized but is not
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
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
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 *****"
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
so when the compiler compiles that, it's converting a pointer to another value
a debugger will show you where that conversion is
no pointers in the code I sent
well besides the pointer, it will show you what file the asm is being generated in
if u mean the specific line of code I sent then there are no pointers there
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
not sure how this relates to anything if I gotta be honest, this is all done at compile time anyway
π im too tired to explain better
me using unsigned long instead of uint32_t won't change anything :p
if that's not what u mean then idk
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
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
ignore it, get sleep, goodnight
Compiler.. From OHIO!! π€£π€£π€£
I honestly unironically feel bad for testing your patience all cause of a dumb meaningless thing the compiler won't do I want to apologize
I appreciate you helping though
no
if you don't need to modify it make it (static) constexpr?
if you pass it by value? that's to be expected, if you don't want that make it a macro or constexpr
have fun debugging the compiler lmao (especially when it's a propriatary one like msvc lol)
also - what compiler are you using?
pointer not value
msvc
I'll show code and stuff soon
tbh i have not tried that but i thought constexpr only differs from const for compiletime stuff
the thing is not compile time
global variable works but its a bit weird
uhm
so the value is not fixed?
ill explain from scratch in a moment
lol ur good
Meaning you initialize it like that: static const auto something = some_func()?
or how are you gonna initialize a const global?
const static uint32_t a = 12859071;
does constexpr differ from const here? if its used in runtime
depends on the compiler, but if that is your actual line why would you not make it constexpr?
fair point
that can already be the issue lmao
yeah lol
ill see if i can show waht the "issue" is in godbolt
im yet to try clang still
that should always be the first approach to issues like this
yeah i was tired and went to bed
and also kind of fixed it with that global var anyway
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
on godbolt? it's only one
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
hm true that could be it
remember
idk why theres unused ones tho
the compiler just copy pastes it (the header) into your source file when you include it
yea true
option a: the compiler is retarded (it's msvc so it might just be that)
option b: you're doing stuff where that needs to be done
𫨠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
in a func
That is different from other static initialization
Doesn't matter
im aware
It gets initialized the first time it's seen
yep
even if it's const
const doesn't matter here
The initialization could have side effects
ok i think i get it now actually
in cases like that simply make it constexpr, especially since it's just a primitive
yeah it was 5am and i half forgot what constexpr did i guess 
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
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
: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
not sure what that was to be honest xd
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
I mean in the worst case there's always compiler specific attributes that can force the compiler to do something
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
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!)
yea it just wouldnt inline it even tho i used that for some reason
if i remember it right
You can't force the compiler to inline a particular function, even with the __forceinline keyword
that probably explains it
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
is the caller winapi?
thats what i was thinking but as i said i cant check now bc the code is gone
If the compiler can't inline a function declared with __forceinline, it generates a level 1 warning, except when:
Should check your warnings :P
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
may I ask what? Because forcing inlining is usually nothing you'd care too much about even in performance critical software
the func in question was a helper func for calling vmethods
ah, well I guess that would make sense there
bruh
Discord does NOT want me to make plugins (The functionality exists in the normal client but hidden away behind a keyboard shortcut)
Sorry to hear
oh wow is that a notification mute shortcut?
Timeout member button
ah lol
I was gonna put a quick timeout button below it
but you can press control to do the same thing
could still be useful to have a plugin to patch out the key requirement
in case you need it a lot
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
discord doesnt let you go below 60s normally right
passing a duration you cant set through the client could be a bit
but kinda doubt it now that i think about it
that is true
remember that it is a timestamp that is sent, not a duration
that will have some amount of inaccuracy to the duration
I will probably put a disclaimer
yes you could
uh
/run c #include <stdio.h> int main() { char s1[] = "guh"; s1[0] = 'b'; printf(s1); }
Here is your c(10.2.0) output @shadow ruin
buh```
ok so
buh
/run c #include <stdio.h> int main() { char s1* = "guh"; s1[0] = "b"; printf(s1); }
@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
guh
/run c #include <stdio.h> int main() { char *s1 = "guh"; s1[0] = "b"; printf(s1); }
@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 "$@"
ur setting the 1st character to the LSB of the address of "b"
please talk in stupid language
Do the css imports need to be profile.github.io or does github.com work?
as long as its the raw link it should work iirc
not github.com
(usually, unless the theme def specifies that's what you should use)
Yeah I meant raw but was too lazy to type it on phone
fair
does it not follow redirects to the raw subdomain due to csp or something
the issue is not sending proper content type but vencord fixes that
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.
you try change character of word by setting character to word
this no work
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); }
@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 "$@"
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);
}```
Here is your c(10.2.0) output @trim cedar
buh```
bruh where is strdup
/run bash man strdup
@shadow ruin I only received bash(5.2.0) error output
file0.code: line 1: man: command not found
WHAT
@shadow ruin there you go
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
not really I think
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 
theres a compiler thing to detect buffer overflows
jk all the existing ones suck
and as you can imagine people give bots like that admin (for no reason)
"hello please put this bot at the top of the role list it will be fine"
imo for bot programming you should just use std::array or whatever
imagine finding a bug in the parser and finding a way to write a command and run machine code to give yourself admin

C++ experience
and try to be strict about stuff like not using raw pointers
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...! 
if you don't fuck up really bad then no
won't be worse than with any other language
can you give some examples of screwing up
because i've still only been writing cursed C++ for a few years...
using C
LOL
jk






