#🧩-plugin-development
1 messages · Page 43 of 1
how to hide this?
Maybe you’ll find something in #🎨-css-snippets
oh alr
that isn't really helping
*:before {
content: "balls"
}
guys this is such good code! change it to your css rn!
[href="/shop"], [href="/store"] {
display: none;
}
also use #🏥-vencord-support-🏥 or #🎨-css-snippets next time
or do it yourself, it's really easy, you just gotta learn inspect elements
alr sorry I’m new here
Thank you
Wait do both /shop and /store exist what's the difference
store is the nitro button
and css :p
Find what component that is and patch it
sorry but how do i do that
i have looked through the source code
can't really get my head around
no
explain what you're trying to do
https://xyproblem.info
I’m trying to make a plugin that attempts to fix the screen sharing issues on Wayland Linux
I’m thinking about overriding the screen sharing button and have it trigger the native chrome screen sharing dialog
not possible
sorry if this is a stupid question but how could i send an ephemeral message with the author showing as me
oh also how can i change the name of a slash command argument, as well as add a description to what the expected value should be?
look at MessageTags
tysm
what ab this one tho?
or actually, i guess a better question would be what would be more standard (forgot the word), but sending an epehmeral via clyde or yourself?
**index.ts: **Lines 158-160
return sendBotMessage(ctx.channel.id, {
content: `${EMOTE} A Tag with the name **${name}** already exists!`
});
yes i get it for clyde but i want the author to be myself
**index.tsx: **Lines 103-110
sendBotMessage(
channelId,
{
content: getDraft(channelId),
author: UserStore.getCurrentUser(),
attachments: hasAttachments ? await getAttachments(channelId) : undefined,
}
)}
looks perfect thank u so so much
almost looks decent
does that like handle channel switches and stuff ?
yes
oh nice
if you haven’t got it yet, try looking at transitionTo
anybody know a good chunky font to use in icons - or good icons i can steal?
I promise this relates to programming 😇
i just wanted circles with numbers on them to represent different types of integer
(8, 16, 32, 64; they're all signed)
(do not expect a serious answer here)
coding
@narrow fable can you post your full plugin code here
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
i'll admit there's a lot your doing wrong
yea this is like second time I'm using typescript oof
like you dont need classes for everything
especially CommandExecutor
just stick the function into execute
I'm coming from C# so yea... 😄
Also inputType: ApplicationCommandInputType.BOT, should be inputType: ApplicationCommandInputType.BUILT_IN,
that might fix your actual issue
Alright
Nope
Is findOption not the correct way to parse attachments? 🤔
I'm not able to parse it with it
coding.
I did that but I'm still getting undefined
I consoled loged petpet command on the image switch case and that results in undefined as well
read better then
slash command draft type is 5 not 0
Thank you!
I was trying out petpet command (only added console.log) seems like it's broken too... 🤔
I changed petpet to use draft_type 5 and that fixed it as well
I found a TOCTOU bug in discord's user note loading
a what
If you try to use the function (that I call) useNote() with the same argument several times in the same render cycle, it will send several fetch-note request
dont do that then
Well yeah but I happen to have use for that function
yo im interested in trying to make a plugin for vencord for myself is this possible?
Yes
any tutorials about it or docs u reccomend me check out?
tysm
Hi people. Quick question. I know bun/pnpm/yarn exist and are good.
But like how good. Is it worth the time switching from npm.
And also which is better. Bun says it's better, but it's really new
Bun is a node replacement, not npm
Pnpm is my favorite personally
Just cause its fast and doesn’t use a shit ton of storage
And idk how to use yarn
Bun also says it has a faster node compatible package manager
https://bun.sh/docs/cli/install
Oh I forgor it’s a package manager too
I’ve never used it tbh
I probably should
I’ve been putting it off cause I have to use wsl
Looking at that, 25x faster package install seems enough for me to try
Pnpm is really fast too
WSL makes everything like this easier not harder imo
Like ~15s to download all of vencord’s
Just dealing with file stuff has been a downside for me
how so?
File stiff as in?
editing files is fine with code and nano
managing/moving is fine because you can just do explorer.exe .
Files between normal windows and wsl
I’ve had some cases where it desuncs
Desyncs
i feel like this should be pinned or something
yarn is shit, change my ming
pnpm has made my life so much easier with how fast it is
Just search for "from: f53 gist" every time someone asks
how to get vencord contributor
step 1: dont be a child
manifest it really hard
next
uh huh you totally pass that one
uh huh i believe that one
Okay, but what else is ?
one only a child would ask
Touché
Can anyone think of any modal in vanilla discord that contains a checkbox or switch next to a button in the footer? Want to steal its looks and spacing if possible
?
I was thinking something like this but not crappy
Putting it in the body would be possible too of course, but I think it'd be a bit of a waste of space
i dont think you will ever make this look good
i would do it like here
For more context, the modal looks something like this
i mean
thats never gonna get merged so the design is fully up to u
personally for my private tweaks i dont bother making the ui pretty cause idc
WOO IT SUPPORTS .mcfunction
you make bl*ecord UI in your tweaks
we need less profile effects, not more of them
does anyone know how you interpret discord's stored shortcuts as keys? by which i mean the keybinds key in local storage. each id has a shortcuts array of which each item consists of an array of numbers. how do you interpret that as keys?
You mean get as in understand or
how many people beg for plugins a day?
femboys.getFirst()
can't count
wanna know if it's possible before I start making it: is there a way to add something to the right click menu, that works like chrome?
i wanted to port an extension I made the other day over
among us quick chat moment
😭
Wait clubpeng is disney?
tbf, it was added since around 2007
they bought rights a while back, originally wasnt
what
Contributions are always welcome, see the github repo
check what he replied to..
horror
Oh 💀
ik mane
is there a property or method to change the visibility of settings?
elaborate
in the settings page for a plugin, is there a way to "expand" the list of settings based on another setting
or can settings be dynamically added and removed by changing the settings object?
something like this tsx test: { description: "This is a test setting", default: true, type: OptionType.COMPONENT, component: (props: any) => { const [value, setValue] = useState("0"); return <> {settings.store.dependency && <Forms.FormSection> <Forms.FormTitle>This is a test number</Forms.FormTitle> <TextInput type="number" pattern="-?[0-9]+" onChange={value => { props.setValue(value); setValue(value); }} value={value} /> </Forms.FormSection>} </>; } }
or like this tsx test: { description: "This is a test setting", default: true, type: OptionType.BOOLEAN, onChange: value => { otherSetting.hidden = !value; } }
i am still indecisive on what language to use for a discord bot
maybe C++ because it has async and await now
(don't cry)
i tried java but it was looking messy
make it in a vencord plugin
javascr-
C++ is the best 🥰
C++ stockholm syndrome
my bot will have 40 vulerabilities
JS stockholm syndrome
tbh to use a lot of languages you need stockholm syndrome
just write good code.. (half joke
)
i'm not super experienced with C++
but i know what not to do
i feel like i always notice when theres something insecure
never actually used those tbh
oh no...
i usually avoid cpp stl
sti? stl?
fuck whatever
i know i kjnow
so is std
so yeah

oh i didn't realise how nsfw that was lmao
in a video, right?
why not :waaaah:
idk never had the need, also havent really written any code in a while (unmotivated af :c)
you know what they are right?
yea roughly
if you're not using them you're probably duplicating functionality
e.g.
CoolClass::CoolClass() {
whatever = new Whatever();
}
CoolClass::~CoolClass() {
delete whatever;
}
and it's pretty ugly tbh
CoolClass::CoolClass() {
whatever = std::make_unique<Whatever>();
}
this feels nicer because you won't make any mistakes if you have a lot of values, right?
it's a necessary evil
true
i avoid it as much as i can
i think i used shared ptr once ever in like a very small app
you'll get a stackoverflow if you never use new lol
yeah ik
static also works
i just use that
dont need to allocate anything in runtime
How do you check if you can send a message in a certain channel_id ? Like if you have send message perms
sure, it has it's uses, but static on local variables feels like something to be used sparingly
why not try searching for "you do not have permission to send messages in this channel"
what if a function is run on multiple threads
first of all you'd need to google what happens - or at least i would lmao

i suppose it probably just behaves like a global but locally scoped
i've never used it and i don't know much about it but maybe TLS could work, idk if it's a windows thing or if it's on linux too
could be totaly wrong but yeah fair point
that would be thread unsafe
dynamically allocating would be better then
i think the inititialisation is thread safe
but after that you're on your own
how were you using it, again?
i mean.. just static char example[BIG_NUMBER] :p
err
i don't think context is really needed
yeah that's an example where the only way to make it thread safe would be to make a local variable for every thread
just put static in there
:p
yeah it would be thread unsafe
since it's basically the same as using a global variable
usually you'd use a mutex or something, right? but even then the threads would interfere
yeah better to just dynamically allocate then
not sure if i'm remembering the syntax but
char *example = new char[BIG_NUMBER];
delete example;
is not ideal
i mean it would work i think
imagine if you have some guards which return early
now you have to copy the delete call there
yeah so that's why you use a unique ptr lol
you might be able to use a custom deleter?
yeah i made a little class that does it for me
or goto

yeah it's not very readable but it works i guess
i need to learn x86 assembly one day
it's cool, not very useful but it depends on what you do
writing gui applications
unless you wanna write everything in x86 then uhh good luck lmao
i should write more code i've been super unproductive lately
i rarely write anything
i think i know c++ decently well but i don't write much in it
or any lang
(i was joking, i don't think you should use assembly on modern hardware)
i feel like i've never really had a big project, i wanna work on one and wrote some cool things for it already but im sooo lazy
is it dumb to write a discord bot in C++?
mm maybe
if you do it and it's not totally awful then i guess that's good
thing is i don't write code often but i only really know c++, lua and basic python lmao
so lately i've been thinking of learning some higher level lang
like c# or something
or maybe i could just get better at python
javascript seems jank but idk
ehh i'd probably go with c# instead
what IDE though
🦀
i just use visual studio :p
you use windows??
don't ban me please
i feel sorry for you
everyoone must use kodeOS
the self-ban was removed after 8 people banned themselves
lmao
(regular members)
but since as i said i rarely write things i feel like learning anything new would be a waste of time so idk
i need to get motivated
and i probably would never use it anyway
write an NES emulator!!
fun!!!
i actually have some decent ish knowledge of the NES so maybe it would be ok
my friend was talking about how he struggles to create actual projects
so i said make an nes emulator!!
i also tried making an nes emulator in java
and didn't get farther than an unfinished ines parser
even games as simple as the first super mario bros require counting cycles for accuracy
doesn't frighten me that much but
it's silly
ah so, cycle accuracy isn't even that special
the emulators say it like it's super cool
i remember that 1 cpu cycle is 3 ppu cycles or something
and some games count cycles for graphical things
including smb1
for the status bar on top
so that scrolling the screen doesn't make the text move
it uses an "interrupt" (not actually an interrupt but let's go with that) that gets hit when the 1st sprite is being drawn i believe
then when that gets hit it waits some cpu cycles
then modifies the scroll register
or some ppu register but i'm p sure it was scroll
tbh i'm not too familiar with concepts like registers and cycles which no normal programmer needs to worry about
i think it's the opposite for me
i think stuff like that is really cool and things like the internals of an operating system and stuff
but i think that i'm so focused on that that my actual programming skills might be average
it's probably just impostor syndrome (i hope)
what does average mean
(not as in dictionary definitely in case you took that literally)
idk i feel like if i got a programming job i would struggle with basics meanwhile i know nerd shit like asm and reverse engineering etc etc
it's probably not true but it's kinda a constant fear
it's good to actually create a lot of programs to help learn stuff :p
yeah true
i made a little x86 disassembler kind of
and function hooking library
but never tried making simple things like a gui app in c++
so that's what worries me a little
it would probably be fairly simple tho (?)
try qt
yeah that's what i've been thinking of
it can't be too hard to learn so maybe i shouldn't worry
i tried imgui before and that's pretty simple but i'm pretty sure qt works wayy different
i've been trying to create an nbt editor with qt
totally real world experience
for some reason all of the nbt editors seem to be made with winforms which looks dreadful 😭
(nbt is the data format of minecraft, you seem like enough of a nerd to know that but)
:p yeah i knew it was minecraft related
that's pretty cool good luck with that!
i really wanna work on a project but god i've been so unproductive i think i've said that like 3 times by now lol
not sure what to do about it
i usually just take caffeine and feel much more motivated, then by the time it comes down i haven't done a single thing
need to stop doing that and maybe i'll be good :p
might also be the fact my sleep schedule sucks but i'm working on fixing that
I'm wondering the best way to keep the data view and the data in sync
I think I saw an image of a font that replaced all words with lines of varying length
Anyone got a link to that?
try saucer
🛸
Imgui is immediate mode, qt is retained so it's really different
Use C++20 ranges, that'll make it way simpler
What the fuck why
No :)
What's the point of using C++ when not using the STL? That's not even C++ anymore that's just C with classes
some cpp features are nice
classes, namespaces, templates etc
i dont hate the cpp stl but im fine without it
most of the time
so it kinda is c with classes like you said :p
im fine with that
Well it's one of the most important things (apart from meta-programming which also kind of goes hand in hand with the STL) and is really useful because it has implementations for almost everything (except for some things that you'd sometimes expect to exist lol)
yeah vectors for example are good to have
cpp exceptions in msvc also piss me off
i've used forceinline and noexcept on a function before but with cpp exceptions enabled in compiler settings, it just gets completely ignored for no apparent reason
and i dont use them anyway so i usually just turn them off
You can avoid exceptions almost all always (I always prefer <expected>)
yeah i don't like exceptions i avoid them whenever possible and so far i never had to use them
this is annoying tho i hope there's a fix for this
it doesn't matter that much i guess but eh
In what regard ignored? Afaik it's mostly used for optimization purposes
the func was inlined with some exception handling in it even though when compiled it only results in like a few x86 instructions
not inlined*
sorry
even though i used noexcept
i think i tried declspec nothrow as well? i think that's a thing? i'm not sure
was a couple years ago now i think
idk it's not a massive deal but i don't see why it did that especially since i had both noexcept and forceinline
Well inline is a hint
with cpp exceptions disabled in compiler settings it stopped doing that
The compiler is still free to decide if he wants to inline
You can however force inline (may be compiler specific though)
In case you've only tried with MSVC I'd suggest to also try another compiler because MSVC is mostly garbage imho
never had an issue with msvc but i might maybe try clang someday
In case you can check with a short code example try godbolt
Then MSVC is being stupid
yeah i guess so
maybe i just did something wrong somewhere, it's been like 2-3 years
can't really check now
since i gave up and removed all noexcepts etc lmao
90% of the compiler (or tooling) bugs I've submitted were on MSVC
lol
yeah i should try clang sometime maybe
Hey i was trying to develope a plugin and i'm not really sure how it's done
after i run pnpm test
what should i do ?
check pins in #1032200195582197831 it tells you how to build and how to start with plugin dev
thanks for the info
and how do we get a plugin to be approved in the main app itself ?
hey, how could i add a new toggle option when u right click on something like the screenshare button when ur in a call? and would it also work on the screenshare button in the call menu above the user profile mute deafen thing?
whar
ok so lets say u right click the video button and it shows u a list of the devices or wtv it is, how could i add on a section to that like for example "enable low res" with a checkbox
weird way of seeing it. can't you just write your own vector, map, pointer etc. classes?
it'd be weird to use C++ without the STL or any equivilent though
You can but the STL is so enormous that you'd either spend ages writing most of the stuff or be missing out on a lot of useful features
aren't there libraries which sometimes act as a drop in replacement?
But yeah C++ is more than just the STL I exaggerated that a little
A few, mostly for embedded afaik
I've heard performance is not great in the STL - but surely it depends on implementation?
uhh... i've also heard std::regex is terrible... but again...
Yeah depends on implementation but there were some not optimal choices somewhere down the road which can't be changed because of ABI
Std regex really isn't great, there's ctre which is quite nice
I've heard std::regex is slower than spinning up a perl instance and letting that do the regex for you but don't trust me on that.
how does it work??
The Clang or MSVC implementation (can't quite remember) also has issues with large regex inputs with std::regex which will segfault you
surely it depends on complexity
Debugging that was fun :) because back then I didn't expect the stdlib to be just broken
i thought these things would be standardised
The implementation? No.
Only the API is standardized, implementation is up to vendor
Or well more or less
i mean some implementation details
Some details may be enforced but generally the implementation is up to the vendor
the general behaviour of everything is described, right?
well how are you write something that uses regex and doesn't rely on implementation defined behaviour?
because technically a three character string could segfault

Afaik the c++ spec makes some statements (I think about string copying and/or CoW, and the char traits) that make it impossible to implement std::regex efficiently
Yeah
That's called boost::regex I think
hahaha
That's what a lot of people recommend to do
oh, is it an actual thing?
But Committee is sometimes weird
No but many propose to do something like that
True
That's why we just wait for an ABI break now
The Committee has stated that they also want an abi break sometime down the road
But no specifics on when
So true lmao
tbh regex is an actually useful functional language 🎉
does it count?
regex is often much nicer than the procedural counterpart
Regex is more declarative I'd say
it's not like it makes shapes or text appear on the screen?
it's has no side effects
(unless it's some cursed impl)
I mean functional languages also don't have side effects
yeah

declarrative languages usually have side-effects?
that being cool stuff appearing on your screen?? 😭
What
i was actually just asking.. is regex a functional language?
No
Ohhh
That is not a term I'm familiar with
Unless you mean as an opposite to dysfunctional languages like brainfuck
lmao
I was just thinking of HTML and Markdown
do they count as having side-effects
They're languages though
What the fuck
Just not programming languages
is json a language
Hm yeah
If HTML is then yes
yes, json is a language if you want it to be
Does json have syntax?
simply use it to encode java bytecode or assembly
Is english a language
Yeah I was more focused on programming languages, but everything that has some convention on how to write it (i.e. syntax) is ofc a language in that sense
From a computer science perspective, yes
From a real human being perspective, probably not
I mean in the most basic sense probably yes but we'd rather call it an encoding
For something to be a real human being language it's usually some kind of text
maybe a language has to be built on top of a character encoding
Everything that expressed some sort of meaning and has any convention of being expressed is a language
That lines up with what I said about it having to be text
what about the image based languages
You mean like Piet?
Fuck those
but not necessarily
Well images are the character encoding there
Isn't that just nft?
do y'all consider yaml as a language
Of course it is
then html and json are also languages
no
Meriam Webster: (2)
: a systematic means of communicating ideas or feelings by the use of conventionalized signs, sounds, gestures, or marks having understood meanings
While not a language in the same sense as Python or rust it’s still a structured system to convey information :D
It's not a programming language, but it is a language
A language used by programs :)
FORMAT
yaml has language in it
Me when I scroll up in chat and realize I just repeated what had already been said
so does html
minecraft redstone is a language
I feel like we need an alignment chart
It is Turing complete
does anybody here use tracking pixels? i need one for proof that an email was read and don't have any recollection of proper programs to do one
i learned it like once and then basically just wiped it from my brain
i'm stupid it's canary tokens i found it
Any good mail client will refuse to load those anyway
is this cursed? (commander is a command framework because C++ developers always make their own frameworks)
you know i never though of using python...
true it's an outlook server based on what i've seen... hopefully they're habitually downloading images
(oh and of course i'm creating my own DSL)
is it normal, in discord bot development to create a framework and DSL in your codebase?
Some mail servers download all linked images and rehost them
oh true
So the image being loaded isn't proof that it's read, only that the server received it
yea I forgot about that
i mean ultimately sending classified mail would be the proof or requesting a reply would be the move ig
unless somebody brute forced
You mean someone tries to load every possible id on the tracking server
I feel like the logs would reveal quite quickly if that's the case, if one cares to look
imagine if the ids are sequential
make the server destroy itself if there are any incorrect attempts
I'm 100% on board with tracking pixel servers destroying themselves
Saves me the effort
all ik is im scared because its code i dont know or understand yet and no most dc bot devs dont create an entire framework and dsl for stuff they normally expand off of whats given and such to my knowledge and my experience of coding and contributing to projects to do with stuff like that.
b|ban|yeet user... --reason|r string? --no-dm ? --dm ?
k|kick|kick user... --reason|r string? --no-dm ? --dm ?
h|help command?
command: [alternatives] [space separated [type]s] [space separated [flag]s]
flag: --[alternatives] [type]
type: [class] (no suffix = required; ? suffix = optional; ... suffix = greedy list) or ? (optional without value)
class: void, bool, string, user, role, channel or enum with [alternatives]
alternatives: pipe separated words, the first considered default for documentation
you love
Discord bot with unix command syntax? I approve
I prefer std::nullopt instead of {} and simply result instead of {result},
also maybe add braces instead of the one line if / while
but that's all just personal preference
In case you can use newer standards you may also be interested in std::ranges::views::split instead of std::getline for this particular use-case
C++ has way too many implicit conversions
oh i see
tbh i'd rather write "aaa" than String("aaa") but imo C++ should have an implicit keyword, not the other way round
Kind of true but in the given code there are actually none as far as I can see (except for one)
I prefer {result} because you're explicitly calling std::optional(T)
Yeah but your suggested edits would be to implicitly Some() the result, wouldn't it?
Well writing result would still cause the constructor of std::optional to be invoked because the method returns std::optional so in that case both mean the same
That's what an implicit conversion is, yes
Yes
for some reason i only manage to get any motivation by the time it's midnight 
Relatable
It fucks up my sleep schedule pretty bad though
I'd rather have the motivation during the day lmao
Then you're not writing enough cursed C++ code
Ramp it up
if I open discord and the code side-by-side will i get distracted by discord less 
A good sourcerer can write curses in any language
i wonder what's a good alternative to Result in rust
Rust does have Result though?
Or do you mean what the c++ counterpart of rust's Result is?
yes
Std expected
Probably some kinda chainsaw juggling
which version?
23 or use tl/expected to get it in 17/20
is 23 stable?
Is 23 stale?
i wanna use coroutines
:3
but are they even stable
just about every program i've used that was written in C++ has crashed. is C++ even stable?
I don't think any major compiler has full feature coverage yet but it's good enough
I personally feel that the less c++ the better, but I understand that that is subjective
thing is
i switched to java because i thought it'll be nicer because it's higher-level!
i did not find it very nice
I started with java (because minecraft), but nowadays it's mostly python or rust
No segfaults in python
rust is decent but i'm not very proficient
Makes it feel more safe than c++
Though that's not true; I've gotten plenty of segfaults in python
Some not even on purpose
i've in javascript commited code which had syntax errors because i wasn't able to reach every path
i imagine python is the same
maybe not syntax
that would probably be caught earlier xd
type error probably
i like things appearing in the ide
well, i wasn't using an ide at the time
just atom
Python does have type annotations nowadays, but they kinda suck
Especially since they don't do anything, you need external tools to check them
No type safety
Rust is more self-consistent than most languages I've seen
=> Also not that great
the way if statements can evaluate to something feels like it encourages bad practice
whereas ternary operators look so ugly that nobody would nest them! right?? (okay, some people do)
Writing rust feels really slow
There so many (in my opinion) superfluous calls and weird Syntax that it just obfuscated the code
But that's rather subjective
it's not as bad as kotlin imo
should i learn rust
I mean I don't think many people would agree with me that c++ code is way more readable than rust
(Mostly) doing away with the distinction between statements and expressions is one of the more beautiful parts of rust imo
Having completely different syntax for conditional statement and conditional expression doesn't make sense
is it not?
i guess
i read some random example rust code and some of it made zero sense to me personally
but yeah im not familiar with the syntax or anything
I can usually get a rough gist of what a piece of c++ code is doing, but it's not easy
The thing keeping me away from rust is that it's meta-programming is not nearly as powerful as c++', if it ever catches up I'll give it another go but I don't think I'll ever prefer rust over c++ because I just love c++ too much xd
i need to start coding again
In what way?
I'd take rust proc macros over c++ template bullshittery any day
But again, part of that is due to familiarity
oh you were replying to noah nvm
maybe i should learn c++ more since as i said i kinda pretty much just write c code with some c++ features sprinkled on top lmao
Depending on what you want to do templates will get things done much quicker imo, also some things I tried out when playing around with rust were out right impossible unless I would've made a macro that parses the AST which would've been like hundreds of lines of code for something that was almost a one liner with templates
I'd be curious to see such a thing
Also rust generics don't have (partial) specialization I believe
I haven't found much lacking in the combo of (proc) macros and traits, but that doesn't mean it doesn't exist
Yeah, specialization is unstable for the foreseeable future
Is it even in consideration?
Definitely
Last I knew was that it was deliberately left out
But it seems to be difficult to come up with a sound formulation in the presence of lifetimes
/ not supported
How does lifetime affect specialization?
It's used in various places in the stdlib, but for regular users it's nightly only
Or rather the other way around
isn't c++'s kinda weird
I'm not too clear on the details, but I think it's things like impl<'a, 'b> SomeTrait for Foo<'a, 'b> and impl<'a> SomeTrait for Foo<'a, 'a>, which would mean a different impl if two fields have the same lifetime
It's beautiful
In some cases Foo<'a> and Foo<'b> are treated as the same type but in others as different, so it could end up mixing up the two impls in strange ways
I think it's that kind of things that are causing trouble
Everything template related
Even the compiler errors?
lol
With concepts or proper static asserts in SFINAEs they're pretty tame
Yeah but that's assuming the code is well written
Yes, bad written code will always be bad
True
C++ tempaltes are kind of cursed imo
theyre weird but they work and can be pretty useful
Hm, what's wrong with the C++ approach of just treating them as completely different types?
Tbh I miss writing fucked up SFINAE stuff since concepts are a thing
Just about every variable has a different lifetime, so that'd end up very wasteful in codegen
I'm gonna go back to my anime, so laterz
i love rust
there has to be a way
More macros
if you care about performance
then it might be slightly faster
actually im not so sure
i care about saving 0.5ns in startup performance
since youre comparing bytes
0.00001ns
i'm trying to split it in to paths so it doesn't have to keep starting at the beginning of the string to find out stuff it already knew...

reminds me of this @stray imp quote
*(uint32_t*)&word[0] == 'tni'
word == "int" could be doing that under the hood and it should be faster
sorry i meant ==
i know that some functions do that
still, it's going down a ladder of string comparisons
which is extremely slow!!!
the bot will take 5 years to start
i was thinking maybe it inlines this
idk about std::string
but i think strcmp would do that
**dirtylist.c: **Line 128
int dirtylist_deduplicate_unsafe(void *_self, int bytes_checked) {
lmao
fucket gimme all the lines
i will use that
I'd just go with a straightforward strcmp until profiler says different
**dirtylist.c: **Lines 128-149
int dirtylist_deduplicate_unsafe(void *_self, int bytes_checked) {
FLASH(_self, self, DirtyList, DIRTYLIST)
int removed = 0;
int index = 0;
while ( index < self->count ) {
void *ptr = self->items + (index * self->itemSize);
int i2 = index + 1;
int doNextPtr = 1;
while (i2 < self->count) {
void *optr = self->items + (self->itemSize * i2);
if (memcmp(ptr, optr, bytes_checked) == 0) {
self->remove(self, ptr);
removed++;
doNextPtr = 0;
break;
}
i2++;
}
index += doNextPtr;
}
return removed;
}
oh wait
yeah lol
it should be inlined
i think msvc would inline it
single quotes?
other compilers should too
confusion
yep
is that to encode as i32
why with \0
it's a char constant which doesn't have \0
surely?
oh, or maybe it's just filled in
awhrfkjahsfjhfs
if your string isn't null terminated then it wouldn't work p sure
so why not do a switch on the string reinterpreted as a 758378753-bit integer
'tni' includes the null terminator
does that depend on little endian or big endian
😭
why back to front
this is so cursed
yeah it's 'tni' instead of 'int\0' because of endianness
you could cast it to a 128bit integer, not sure what type that is but x86 has that
128bit is a thing bc of SSE i think but im not sure
true
but seriously
'tni' has to be 32bit cus theres no 3 byte type
Write discord bot in asm yes
im p sure it does
It does
i feel like u could
so if it's 4 chars it would be missing a nul?
i heard somebody call somebody's java code javascript code because it had equals ladders
ladders?
yknow the thing
:yesyes:
not rly but act like i do
If you're doing *(uint32_t*)&word[0] == 'tni' or whatever you end up with, you have to remember to check the string length or you'll end up reading uninitialized memory
Which I'm pretty sure is ub
i mean unless the string is less than 4 bytes long it should be fine i think
lmao
python programmers reading this: [censored]
Yeah but especially if you're dealing with user input, you absolutely cannot assume that
this is why people use garbage collected memory safe languages
:p idk just strcmp and ur fine or maybe just doing == is fine
u can always read the disassembly and check how dumb the resulting code is
You're reading uninitialized memory though
i don't speak assembly
So the ub might end up stealing your car
All of them
i dont use linux idk how it would work there but on windows u should be fine
just or just
unless the string is like 1 or 2 characters long and right next to the end of the memory page
Ub is to be avoided regardless of platform
it shouldnt have any side effect tho idk
if it reads garbage then that means the string is too short which means its not "int" anyway, so in the end it doesnt matter
thats how i look at it anyway
That's not how compilers view ub though
but anyway just use strcmp unless its not null terminated, it should be inlined and optimized by the compiler anyway
It's very possible that the code would work despite the ub
would u even get a warning tho
this should be fine, ig do some profiling to see how much worse it is
strcmp
it literally does not matter at all
:p
idk i was guessing, hashing would make sense too
probably more sense
but probably with magic handling for collisions
"magic" = double checking maybe?
idk
brain hurts
Pretty sure java's switch first does an int-switch over .hashCode() and then checks equality in each of the cases
yeah but cases do clever optimisation stuff.. riggght?
Or at least does that on some compilers/versions
switch is really simple
if it just compares the hash then thats just comparing two numbers
step 1) hash the value
step 2) check if there is a case for this int
step 3) if yes, compare value to the value of this case
step 4) if equal, we have a match
in c++ i bet it compiles to the same thing
compilers are smart
a switch is very efficient
it does not compare to the cases
it just looks up address in table and jumps to the address
jump table yeah
consider buying a new table
but the hash matching does not guarantee equality so u need one comparison
yeah, that's what i guessed ^^
want me to check disassembly for it? lmao
If the cases are consecutive numbers it just uses a lookup table
If they're widely disjoint like for hashcodes, I dunno
hmm, that's probably what actually happens
multiple tables?
idek how hashmaps work tbh
switch (hash(value)) {
case hash("banana"):
if ("banana".equals(value)) block();
case hash("strawberry"):
if ("strawberry".equals(value)) block();
}
}
not a hashmap
similar problem to solve though?
anyway hashmaps use multiple arrays under the hood
jump tables are basically just
In computer programming, a branch table or jump table is a method of transferring program control (branching) to another part of a program (or a different program that may have been dynamically loaded) using a table of branch or jump instructions. It is a form of multiway branch. The branch table construction is commonly used when programming in...
think of it as an array of functions
its not exactly functions but
think of it that way
then you index the switch value thing i dont know the terminology im dumb
int number = 5;
switch (number) {
case 5:
System.out.println("Woah, that's my favourite number dude!")
break;
case 358953:
System.out.println("How did you guess?? that's the most arbitrary number out there man");
break;
}
yeah theres holes im not too sure how that works
no
im not sure i dont remember
i can check disassembly
if you want
for a random switch
No 358957 is arbitrarier
well kinda
ig the concept would be pretty similar
if the difference between the values is large it would likely use some sort of remainder and then differentiate, which is essentially also what a hashmap does
(but im mostly just guessing)
thats what i assumed too
I'm pretty sure it picks between half a dozen different methods based on some heuristics
Like lookup table, linear scan, binary search, phf, and others
yeah, just checked and depending on the cases it can use two tables
or it can separately check for bigger cases
like if there's a gap of like 1000
hey what happened to premed plgin in #1032200195582197831 ??
im doing AoC stuff from after I stopped because holiday family stuff and aaaa I hate pathfinding so much
it kinda works but also not at all
advent of djikstra
is there a custom prefix for slash command bots plugin
me when hash collision
there was a new plugin named premid what happened to that
all strings are default null terminated
Yes, they'll use jump tables (given enough compares are performed, for like two entries it's gonna be the same as if)
I love x86 endianness 😍
Hii, any guide for plugin dev for vencord? I dunno the API i can use
Check how other plugins do things and grep for stuff
There's not much docs beyond that
You can find some guides in the main repo https://github.com/Vendicated/Vencord/blob/main/CONTRIBUTING.md
iirc there are a few more you can probably find just by searching around in the server
i dunno how to access html class and Discord UI stuff
Helped so much 
there's also this https://gist.github.com/sunnniee/28bd595f8c07992f6d03289911289ba8
Do u know how i access Discord API base route
smth like ```js
${DISCORD_API_BASE}/channels/${channelId}/messages
That'd be with import RestAPI from "@webpack/common";
whooaa that's gold 
hmmmm
All discord stuff come from there then
There's a buncha predefined things there, yeah
I dunno why it isn't pinned or linked anywhere, does @viral roost have any reason why it's not very public?
If you want to find more obscure modules, you need findByPropsLazy
i thought it wouldn't need to be that public because official docs would be coming soon
soon™️
tessie w

I just find it funny how I've seen you also just linking the official docs instead of the better guide you made
that's why it does a comparison to check if it's a correct match
literally included in the code u replied to
oh right
anyone think this would be worth pushing as a plugin once I finish it? Added coin collection to oneko lol
Blasted webm file!
Lmao that's quite nice




