#🧩-plugin-development

1 messages · Page 43 of 1

dull magnet
#

it's pretty good

uncut iron
#

how to hide this?

orchid scaffold
uncut iron
#

that isn't really helping

green vessel
#
*:before {
    content: "balls"
}
#

guys this is such good code! change it to your css rn!

dull magnet
uncut iron
#

Thank you

vast karma
floral plaza
light hazel
#

using the plugin api how do i detect this window appearing

#

do i just use dom apis

vast karma
#

Find what component that is and patch it

light hazel
#

sorry but how do i do that

#

i have looked through the source code

#

can't really get my head around

dull magnet
dull magnet
light hazel
#

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

dull magnet
#

not possible

vital path
#

sorry if this is a stupid question but how could i send an ephemeral message with the author showing as me

vital path
#

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?

jagged briar
#

look at MessageTags

vital path
#

tysm

vital path
#

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?

proud parrotBOT
vital path
#

yes i get it for clyde but i want the author to be myself

jagged briar
#

not sure about that one tbh

#

there is for sure a way tho

proud parrotBOT
vital path
coarse cypress
serene cape
#

almost looks decent

rocky jackal
#

Is there a way to intercept discord's router?

#

welp that's a nice to have

stuck herald
rocky jackal
#

yes

stuck herald
#

oh nice

floral plaza
pure temple
#

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)

minor jolt
#

What's the consensus on .net maui (ex-xamarin) ?

#

Compared to eg react native

potent fox
#

its not javascript

#

as a result good

#

also doesnt have herpes

viral roost
#

(do not expect a serious answer here)

frigid bay
#

coding

jagged briar
#

@narrow fable can you post your full plugin code here

narrow fable
jagged briar
#

i'll admit there's a lot your doing wrong

narrow fable
#

yea this is like second time I'm using typescript oof

jagged briar
#

like you dont need classes for everything

#

especially CommandExecutor

#

just stick the function into execute

narrow fable
#

I'm coming from C# so yea... 😄

jagged briar
#

Also inputType: ApplicationCommandInputType.BOT, should be inputType: ApplicationCommandInputType.BUILT_IN,

#

that might fix your actual issue

narrow fable
#

Alright

narrow fable
#

Is findOption not the correct way to parse attachments? 🤔

narrow fable
slender trail
#

coding.

dull magnet
#

look at petpet

narrow fable
#

I consoled loged petpet command on the image switch case and that results in undefined as well

dull magnet
#

read better then

chrome elbow
#

slash command draft type is 5 not 0

dull magnet
#

petpet works fine

#

soo

narrow fable
#

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

vast karma
#

I found a TOCTOU bug in discord's user note loading

dull magnet
#

a what

vast karma
#

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

dull magnet
#

dont do that then

vast karma
#

Well yeah but I happen to have use for that function

woven lion
#

why do you have to call it multiple times with the same argument

#

that seems silly

kind dome
#

yo im interested in trying to make a plugin for vencord for myself is this possible?

cedar marsh
#

Yes

kind dome
#

any tutorials about it or docs u reccomend me check out?

cedar marsh
kind dome
#

tysm

cedar marsh
#

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

jagged briar
#

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

cedar marsh
jagged briar
#

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

cedar marsh
#

Looking at that, 25x faster package install seems enough for me to try

jagged briar
#

Pnpm is really fast too

cedar marsh
jagged briar
#

Like ~15s to download all of vencord’s

jagged briar
cedar marsh
#

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 .

jagged briar
#

Files between normal windows and wsl

#

I’ve had some cases where it desuncs

#

Desyncs

cedar marsh
#

Ah

#

Explorer loves desyncing

#

There is a refresh button in Explorer at least

frigid bay
rocky jackal
#

pnpm has made my life so much easier with how fast it is

cedar marsh
warped bronze
#

how to get vencord contributor

jagged matrix
#

step 1: dont be a child

slow charm
#

manifest it really hard

warped bronze
jagged matrix
#

uh huh you totally pass that one

warped bronze
#

...

#

truth

jagged matrix
#

uh huh i believe that one

warped bronze
#

Okay, but what else is ?

stiff cargo
#

Contribute?

#

What kind of question is this…

jagged matrix
#

one only a child would ask

stiff cargo
#

Touché

exotic valve
#

yay i finished 2020

#

now i have game of life utils for every possible scenario

vast karma
#

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

dull magnet
vast karma
#

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

dull magnet
dull magnet
vast karma
#

For more context, the modal looks something like this

dull magnet
#

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

lost narwhal
#

WOO IT SUPPORTS .mcfunction

potent fox
frigid bay
#

we need less profile effects, not more of them

dry plinth
#

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?

vast karma
#

You mean get as in understand or

sturdy shard
#

how many people beg for plugins a day?

tawdry jasper
#
femboys.getFirst()
zinc mural
tame ether
#

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

dull magnet
#

wtf is that

#

but yes

tame ether
#

ty though!! :D

oblique lark
#

among us quick chat moment

tame ether
#

😭

amber mantle
#

that looks like safechat out of a disney game

#

toontown/clubpeng

vast karma
#

Wait clubpeng is disney?

tame ether
#

tbf, it was added since around 2007

spare hawk
weak ledge
#

a

#

How is the project looking? trynna contribute

austere mauve
#

what

jagged briar
dull magnet
#

check what he replied to..

amber mantle
#

horror

jagged briar
#

Oh 💀

weak ledge
#

😭

#

how that project going

dull magnet
#

it was joking

weak ledge
pseudo tiger
#

is there a property or method to change the visibility of settings?

pseudo tiger
#

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?

pseudo tiger
#

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; } }

pure temple
#

i am still indecisive on what language to use for a discord bot
maybe C++ because it has async and await now trolley (don't cry)

#

i tried java but it was looking messy

austere mauve
#

make it in a vencord plugin

pure temple
#

horror

#

i literally had to write a string split function

#

such fun!!

pure temple
#

C++ is the best 🥰

stiff cargo
#

C++ stockholm syndrome

pure temple
#

my bot will have 40 vulerabilities

frigid bay
pure temple
#

tbh to use a lot of languages you need stockholm syndrome

frigid bay
pure temple
#

i'm not super experienced with C++

frigid bay
#

ah fair

#

idk im a bit of a nerd about that kind of stuff

pure temple
#

but i know what not to do

frigid bay
#

i feel like i always notice when theres something insecure

pure temple
#

you should use shared_ptrs and unique_ptrs like everywhere for secure code :)

frigid bay
#

never actually used those tbh

pure temple
#

oh no...

frigid bay
#

i usually avoid cpp stl

#

sti? stl?

#

fuck whatever

#

i know i kjnow

#

so is std

#

so yeah

pure temple
#

oh i didn't realise how nsfw that was lmao

frigid bay
#

ive seen worse

#

in here

#

also vee posting a racial slur

pure temple
#

in a video, right?

frigid bay
#

in a screenshot

pure temple
frigid bay
pure temple
#

you know what they are right?

frigid bay
#

yea roughly

pure temple
#

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?

frigid bay
#

dynamically allocating things is lame!!

#

/s

pure temple
#

it's a necessary evil

frigid bay
#

true

#

i avoid it as much as i can

#

i think i used shared ptr once ever in like a very small app

pure temple
#

you'll get a stackoverflow if you never use new lol

frigid bay
#

yeah ik

#

static also works

#

i just use that

#

dont need to allocate anything in runtime

pure temple
#

give an example?

#

that sounds like it could be smelly

narrow fable
#

How do you check if you can send a message in a certain channel_id ? Like if you have send message perms

pure temple
#

sure, it has it's uses, but static on local variables feels like something to be used sparingly

pure temple
pure temple
#

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

frigid bay
#

could be totaly wrong but yeah fair point

#

that would be thread unsafe

#

dynamically allocating would be better then

pure temple
#

i think the inititialisation is thread safe

#

but after that you're on your own

#

how were you using it, again?

frigid bay
#

i mean.. just static char example[BIG_NUMBER] :p

pure temple
#

err

frigid bay
#

i don't think context is really needed

pure temple
#

yeah that's an example where the only way to make it thread safe would be to make a local variable for every thread

frigid bay
#

just put static in there

pure temple
#

:p

frigid bay
#

yeah it would be thread unsafe

#

since it's basically the same as using a global variable

pure temple
#

usually you'd use a mutex or something, right? but even then the threads would interfere

frigid bay
#

yeah better to just dynamically allocate then

pure temple
#

not sure if i'm remembering the syntax but

char *example = new char[BIG_NUMBER];
delete example;

is not ideal

frigid bay
#

i mean it would work i think

pure temple
#

imagine if you have some guards which return early

#

now you have to copy the delete call there

frigid bay
#

oh yeah

#

i hate that

#

RAAI ftw

#

RAII*

pure temple
#

yeah so that's why you use a unique ptr lol

frigid bay
#

windows api makes you do that a lot

#

it's annoying

#

for handles and stuff

pure temple
#

you might be able to use a custom deleter?

frigid bay
#

yeah i made a little class that does it for me

pure temple
#

or goto

frigid bay
#

yeah goto works too

#

just a bit ugly

pure temple
frigid bay
#

i avoid it

#

i assume everyone does :p

pure temple
#

i really struggle to read code with goto

#

:p

frigid bay
#

yeah it's not very readable but it works i guess

pure temple
#

i need to learn x86 assembly one day

frigid bay
#

it's cool, not very useful but it depends on what you do

pure temple
#

writing gui applications

frigid bay
#

unless you wanna write everything in x86 then uhh good luck lmao

pure temple
#

🎉

#

gtk video player in asm

#

fun project

frigid bay
#

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

pure temple
#

(i was joking, i don't think you should use assembly on modern hardware)

frigid bay
#

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

pure temple
#

is it dumb to write a discord bot in C++?

frigid bay
#

mm maybe

pure temple
#

it's just in java you don't have await

#

but in c++ you do

frigid bay
#

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

pure temple
#

java!!

#

:dukedance:

frigid bay
#

ehh i'd probably go with c# instead

pure temple
#

what IDE though

vast karma
#

🦀

frigid bay
#

i just use visual studio :p

pure temple
#

you use windows??

frigid bay
#

don't ban me please

pure temple
#

i feel sorry for you

frigid bay
#

💔

#

i was gonna jokingly ban myself but i forgot that apparently actually works

pure temple
#

the self-ban was removed after 8 people banned themselves

frigid bay
#

lmao

pure temple
#

(regular members)

frigid bay
#

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

frigid bay
pure temple
#

fun!!!

frigid bay
#

i actually have some decent ish knowledge of the NES so maybe it would be ok

pure temple
#

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

frigid bay
#

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

pure temple
#

ah so, cycle accuracy isn't even that special

frigid bay
#

yeah true

#

6502 is pretty simple

pure temple
#

the emulators say it like it's super cool

frigid bay
#

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

pure temple
#

tbh i'm not too familiar with concepts like registers and cycles which no normal programmer needs to worry about

frigid bay
#

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)

pure temple
#

what does average mean

#

(not as in dictionary definitely in case you took that literally)

frigid bay
#

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

pure temple
#

it's good to actually create a lot of programs to help learn stuff :p

frigid bay
#

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 (?)

pure temple
#

try qt

frigid bay
#

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

pure temple
#

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)

frigid bay
#

:p yeah i knew it was minecraft related

frigid bay
#

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

pure temple
#

I'm wondering the best way to keep the data view and the data in sync

vast karma
#

I think I saw an image of a font that replaced all words with lines of varying length
Anyone got a link to that?

trim cedar
frigid bay
#

🛸

trim cedar
trim cedar
trim cedar
frigid bay
#

idk i prefer c libraries

trim cedar
trim cedar
frigid bay
#

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

trim cedar
#

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)

frigid bay
#

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

trim cedar
#

You can avoid exceptions almost all always (I always prefer <expected>)

frigid bay
#

yeah i don't like exceptions i avoid them whenever possible and so far i never had to use them

frigid bay
#

it doesn't matter that much i guess but eh

trim cedar
frigid bay
#

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

trim cedar
#

Well inline is a hint

frigid bay
#

with cpp exceptions disabled in compiler settings it stopped doing that

trim cedar
#

The compiler is still free to decide if he wants to inline

#

You can however force inline (may be compiler specific though)

frigid bay
#

yeah i did __forceinline, i use msvc

#

didn't make a difference though

trim cedar
frigid bay
#

never had an issue with msvc but i might maybe try clang someday

trim cedar
#

In case you can check with a short code example try godbolt

frigid bay
#

i was going to but i never ended up doing it

#

oh yeah godbolt is great

trim cedar
frigid bay
#

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

trim cedar
#

90% of the compiler (or tooling) bugs I've submitted were on MSVC

frigid bay
#

yeah i should try clang sometime maybe

dry osprey
#

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 ?

frigid bay
dry osprey
#

thanks for the info

#

and how do we get a plugin to be approved in the main app itself ?

junior cove
vital path
#

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?

wide parrot
#

whar

vital path
#

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

vast karma
#

There's an api for modifying context menus

#

Check the view raw plugin for example

pure temple
#

it'd be weird to use C++ without the STL or any equivilent though

trim cedar
pure temple
#

aren't there libraries which sometimes act as a drop in replacement?

trim cedar
#

But yeah C++ is more than just the STL I exaggerated that a little

trim cedar
pure temple
#

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...

trim cedar
#

Yeah depends on implementation but there were some not optimal choices somewhere down the road which can't be changed because of ABI

trim cedar
pure temple
#

:O

#

ooh

#

i liked the look of a library which uses JIT

#

but this is probably better

pastel cove
pure temple
#

how does it work??

trim cedar
pure temple
trim cedar
pure temple
trim cedar
#

The implementation? No.
Only the API is standardized, implementation is up to vendor

#

Or well more or less

pure temple
trim cedar
#

Some details may be enforced but generally the implementation is up to the vendor

pure temple
#

the general behaviour of everything is described, right?

trim cedar
#

Yes

#

But that still leaves a lot of implementation freedom

#

That's what I meant

pure temple
#

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

vast karma
#

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

trim cedar
#

Yeah

pure temple
#

why not have std::regex2

vast karma
#

That's called boost::regex I think

pure temple
#

hahaha

trim cedar
pure temple
#

oh, is it an actual thing?

trim cedar
#

But Committee is sometimes weird

pure temple
#

tbf

#

it's weird when languages have multiple classes for this

trim cedar
trim cedar
#

That's why we just wait for an ABI break now

pure temple
trim cedar
#

The Committee has stated that they also want an abi break sometime down the road

#

But no specifics on when

trim cedar
pure temple
#

tbh regex is an actually useful functional language 🎉

#

does it count?

#

regex is often much nicer than the procedural counterpart

vast karma
#

Regex is more declarative I'd say

pure temple
#

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)

trim cedar
#

I mean functional languages also don't have side effects

pure temple
#

yeah

pliant pasture
pure temple
#

declarrative languages usually have side-effects?

#

that being cool stuff appearing on your screen?? 😭

vast karma
#

What

pure temple
#

i was actually just asking.. is regex a functional language?

trim cedar
#

No

pure temple
#

not a functional programming language of course

#

but a functional language

trim cedar
#

Ohhh

vast karma
#

That is not a term I'm familiar with

trim cedar
#

Haha

#

I don't think so

vast karma
#

Unless you mean as an opposite to dysfunctional languages like brainfuck

pure temple
#

lmao

pure temple
#

do they count as having side-effects

trim cedar
#

They're not languages

#

They're markup

pure temple
#

don't people also sometimes call them declarative languages?

vast karma
trim cedar
#

What the fuck

vast karma
#

Just not programming languages

pure temple
#

is json a language

trim cedar
trim cedar
pure temple
#

yes, json is a language if you want it to be

vast karma
pure temple
vast karma
#

Is english a language

trim cedar
#

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

pure temple
#

is PNG a language?

#

is ZIP a language?

vast karma
#

From a computer science perspective, yes

#

From a real human being perspective, probably not

trim cedar
#

I mean in the most basic sense probably yes but we'd rather call it an encoding

pure temple
#

hmm

#

json is using UTF-8 - which is an encoding

vast karma
#

For something to be a real human being language it's usually some kind of text

pure temple
#

maybe a language has to be built on top of a character encoding

trim cedar
#

Everything that expressed some sort of meaning and has any convention of being expressed is a language

vast karma
pure temple
#

what about the image based languages

vast karma
#

You mean like Piet?

pure temple
#

i guess that could be png-based

vast karma
#

Fuck those

pure temple
#

but not necessarily

trim cedar
pure temple
#

you could take png and claim it's your own

#

and now the encoding and language is one

left tide
glass oracle
#

do y'all consider yaml as a language

vast karma
#

Of course it is

glass oracle
#

then html and json are also languages

vast karma
#

Yes?

#

Is that supposed to be a gotcha

glass oracle
#

no

stiff cargo
#

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

vast karma
#

It's not a programming language, but it is a language

stiff cargo
pure temple
austere mauve
#

yaml has language in it

stiff cargo
#

Me when I scroll up in chat and realize I just repeated what had already been said

austere mauve
#

so does html

oblique lark
#

minecraft redstone is a language

vast karma
#

I feel like we need an alignment chart

jagged briar
mystic sable
#

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

vast karma
#

Any good mail client will refuse to load those anyway

pure temple
#

is this cursed? (commander is a command framework because C++ developers always make their own frameworks)

#

you know i never though of using python...

mystic sable
pure temple
#

(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?

vast karma
mystic sable
#

oh true

vast karma
#

So the image being loaded isn't proof that it's read, only that the server received it

mystic sable
#

yea I forgot about that

#

i mean ultimately sending classified mail would be the proof or requesting a reply would be the move ig

vast karma
#

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

pure temple
#

imagine if the ids are sequential

#

make the server destroy itself if there are any incorrect attempts

vast karma
#

I'm 100% on board with tracking pixel servers destroying themselves

#

Saves me the effort

signal goblet
pure temple
#
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

vast karma
#

Discord bot with unix command syntax? I approve

trim cedar
pure temple
#

nullopt

#

🤔

vast karma
#

C++ has way too many implicit conversions

pure temple
#

oh i see

pure temple
trim cedar
pure temple
#

I prefer {result} because you're explicitly calling std::optional(T)

vast karma
trim cedar
vast karma
#

That's what an implicit conversion is, yes

trim cedar
#

Yes

pure temple
#

for some reason i only manage to get any motivation by the time it's midnight blobcatcozy

trim cedar
#

Relatable

vast karma
#

You get motivation at midnight?

#

Jealous

trim cedar
#

I'd rather have the motivation during the day lmao

pure temple
#

but i'm still not very motivated

#

and also i'm very tired

trim cedar
#

Ramp it up

pure temple
#

if I open discord and the code side-by-side will i get distracted by discord less blobcatcozy

vast karma
#

A good sourcerer can write curses in any language

pure temple
#

i wonder what's a good alternative to Result in rust

vast karma
#

Rust does have Result though?

#

Or do you mean what the c++ counterpart of rust's Result is?

pure temple
#

yes

trim cedar
#

Std expected

vast karma
#

Probably some kinda chainsaw juggling

pure temple
trim cedar
#

23 or use tl/expected to get it in 17/20

pure temple
#

is 23 stable?

vast karma
#

Is 23 stale?

pure temple
#

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?

trim cedar
vast karma
#

I personally feel that the less c++ the better, but I understand that that is subjective

pure temple
#

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

vast karma
#

I started with java (because minecraft), but nowadays it's mostly python or rust

pure temple
#

no types in python

#

makes it feel less safe than c++

vast karma
#

No segfaults in python

pure temple
#

rust is decent but i'm not very proficient

vast karma
#

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

pure temple
#

i imagine python is the same

#

maybe not syntax

vast karma
#

That's not usually how syntax errors work

#

If you mean type errors, then sure

pure temple
#

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

vast karma
#

Python does have type annotations nowadays, but they kinda suck

#

Especially since they don't do anything, you need external tools to check them

pure temple
#

rust feels a bit quirky

#

why did they need to be special

trim cedar
vast karma
#

Rust is more self-consistent than most languages I've seen

trim cedar
pure temple
#

whereas ternary operators look so ugly that nobody would nest them! right?? (okay, some people do)

trim cedar
#

Writing rust feels really slow

pure temple
#

but i also like other things btw

#

:p

trim cedar
#

There so many (in my opinion) superfluous calls and weird Syntax that it just obfuscated the code

#

But that's rather subjective

pure temple
balmy sky
#

should i learn rust

trim cedar
#

I mean I don't think many people would agree with me that c++ code is way more readable than rust

vast karma
#

(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

vast karma
#

C++ is more readable to c++ people, rust is more readable to rust people

#

Mostly

frigid bay
#

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

vast karma
#

I can usually get a rough gist of what a piece of c++ code is doing, but it's not easy

trim cedar
#

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

frigid bay
#

i need to start coding again

vast karma
#

In what way?

frigid bay
#

all ways

#

i havent written any code ina while

vast karma
#

I'd take rust proc macros over c++ template bullshittery any day

#

But again, part of that is due to familiarity

frigid bay
#

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

trim cedar
# vast karma I'd take rust proc macros over c++ template bullshittery any day

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

vast karma
#

I'd be curious to see such a thing

trim cedar
#

Also rust generics don't have (partial) specialization I believe

vast karma
#

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

trim cedar
#

Is it even in consideration?

vast karma
#

Definitely

trim cedar
#

Last I knew was that it was deliberately left out

vast karma
#

But it seems to be difficult to come up with a sound formulation in the presence of lifetimes

trim cedar
#

/ not supported

trim cedar
vast karma
#

It's used in various places in the stdlib, but for regular users it's nightly only

trim cedar
vast karma
#

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

trim cedar
pure temple
#

what exactly are you refering to?

#

templates, macros?

#

codegen?

vast karma
#

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

trim cedar
vast karma
frigid bay
#

lol

trim cedar
vast karma
#

Yeah but that's assuming the code is well written

trim cedar
#

Yes, bad written code will always be bad

vast karma
#

True

pure temple
#

C++ tempaltes are kind of cursed imo

frigid bay
trim cedar
trim cedar
vast karma
#

I'm gonna go back to my anime, so laterz

pure temple
#

i don't see many bots using DPP

#

matybe for a reaosn

#

i have 2am typing skills

dull magnet
#

i love rust

pure temple
#

how can i make this code EVEN better

frigid bay
#

there has to be a way

vast karma
#

More macros

pure temple
#

this is much better than doing ==

#

(i think it's faster)

frigid bay
#

if you care about performance

#

then it might be slightly faster

#

actually im not so sure

pure temple
#

i care about saving 0.5ns in startup performance

frigid bay
#

since youre comparing bytes

pure temple
#

0.00001ns

frigid bay
#

while == could read it as dwords

#

or something

#

if that makes any sense

#

like

pure temple
#

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...

amber basin
#

reminds me of this @stray imp quote

frigid bay
frigid bay
#

sorry i meant ==

pure temple
#

__builtin_memcmp

frigid bay
#

i know that some functions do that

pure temple
#

still, it's going down a ladder of string comparisons

#

which is extremely slow!!!

#

the bot will take 5 years to start

frigid bay
#

idk about std::string

frigid bay
#

but i think strcmp would do that

proud parrotBOT
stray imp
#

fucket gimme all the lines

pure temple
#

i will use that

frigid bay
pure temple
#

perhaps that depends on byte ordering?

#

idk it's hurting my head

vast karma
#

I'd just go with a straightforward strcmp until profiler says different

proud parrotBOT
# stray imp https://github.com/aenriii/cs302/blob/main/utils/dirtylist.c#L128-L149

**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;
}
pure temple
#

oh wait

frigid bay
#

it should be inlined

#

i think msvc would inline it

pure temple
#

single quotes?

frigid bay
#

other compilers should too

pure temple
#

confusion

frigid bay
pure temple
#

is that to encode as i32

frigid bay
#

'tni' would be "int\0"

#

but

#

as a 32bit integer

pure temple
#

why with \0

#

it's a char constant which doesn't have \0

#

surely?

#

oh, or maybe it's just filled in

#

awhrfkjahsfjhfs

frigid bay
#

if your string isn't null terminated then it wouldn't work p sure

pure temple
#

so why not do a switch on the string reinterpreted as a 758378753-bit integer

frigid bay
#

'tni' includes the null terminator

pure temple
#

does that depend on little endian or big endian

#

😭

#

why back to front

#

this is so cursed

frigid bay
#

yeah it's 'tni' instead of 'int\0' because of endianness

pure temple
#

yea

#

but where is the \0 from

#

because it's not a string literal

frigid bay
pure temple
#

u128_t

#

isn't it a 64-bit processor for a reason??

frigid bay
#

128bit is a thing bc of SSE i think but im not sure

pure temple
#

you love premature optimisation

#

tbh i should just rwite in asm

frigid bay
#

true

pure temple
#

but seriously

frigid bay
pure temple
#

why can't you switch on strings like in java/js

#

does js even have switch

vast karma
#

Write discord bot in asm yes

frigid bay
vast karma
#

It does

frigid bay
pure temple
frigid bay
#

yea

#

'tni' is the same as uhh

#

1 sec

pure temple
#

ladders?

#

yknow the thing

#

:yesyes:

frigid bay
#

not rly but act like i do

vast karma
#

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

frigid bay
#

i mean unless the string is less than 4 bytes long it should be fine i think

pure temple
#

lmao

frigid bay
#

honestly just do strcmp tho

#

it should inline the dumb optimization i mentioned

pure temple
#

python programmers reading this: [censored]

vast karma
frigid bay
#

yep

#

but then its not equal to "int" anyway

#

so whatever

pure temple
#

this is why people use garbage collected memory safe languages

frigid bay
#

: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

vast karma
pure temple
#

i don't speak assembly

vast karma
#

So the ub might end up stealing your car

pure temple
#

should i just use python

#

or perl

#

or php

vast karma
#

All of them

frigid bay
pure temple
frigid bay
#

unless the string is like 1 or 2 characters long and right next to the end of the memory page

vast karma
#

Ub is to be avoided regardless of platform

frigid bay
#

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

vast karma
#

That's not how compilers view ub though

frigid bay
#

but anyway just use strcmp unless its not null terminated, it should be inlined and optimized by the compiler anyway

vast karma
#

It's very possible that the code would work despite the ub

pure temple
#

as painful as this is to read it's probably less painful?

#

lmao

frigid bay
pure temple
#

💀

#

how does java do switch on strings

frigid bay
frigid bay
pure temple
frigid bay
pure temple
#

or something

frigid bay
#

probably more sense

pure temple
#

but probably with magic handling for collisions

#

"magic" = double checking maybe?

#

trolley idk

#

brain hurts

vast karma
#

Pretty sure java's switch first does an int-switch over .hashCode() and then checks equality in each of the cases

pure temple
#

yeah but cases do clever optimisation stuff.. riggght?

vast karma
#

Or at least does that on some compilers/versions

dull magnet
#

switch is really simple

frigid bay
dull magnet
#

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

pure temple
#

nah, switch is more efficient that if statements

#

it's not top-to-bottom right?

frigid bay
#

compilers are smart

dull magnet
#

it does not compare to the cases

#

it just looks up address in table and jumps to the address

frigid bay
#

jump table yeah

pure temple
#

yeah

#

i thought it was something like that

#

what if there are holes in the table

frigid bay
#

oh

pure temple
#

consider buying a new table

dull magnet
#

but the hash matching does not guarantee equality so u need one comparison

pure temple
#

yeah, that's what i guessed ^^

frigid bay
#

want me to check disassembly for it? lmao

vast karma
#

If the cases are consecutive numbers it just uses a lookup table

#

If they're widely disjoint like for hashcodes, I dunno

pure temple
#

multiple tables?

#

idek how hashmaps work tbh

dull magnet
#
switch (hash(value)) {
  case hash("banana"):
    if ("banana".equals(value)) block();
  case hash("strawberry"):
    if ("strawberry".equals(value)) block();
  }
}
dull magnet
pure temple
#

similar problem to solve though?

dull magnet
#

anyway hashmaps use multiple arrays under the hood

frigid bay
#

jump tables are basically just

dull magnet
#

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...

frigid bay
#

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

pure temple
#
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;
}
frigid bay
#

yeah theres holes im not too sure how that works

pure temple
#

the array is very big

#

so wouldn't you use multiple arrays?

dull magnet
#

no

frigid bay
#

im not sure i dont remember

#

i can check disassembly

#

if you want

#

for a random switch

vast karma
frigid bay
#

oh wait, i dont have to compile anything

#

godbolt exists

dull magnet
#

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)

frigid bay
#

thats what i assumed too

dull magnet
#

that kinda stuff is probably best left to compiler devs

#

they know better than us

vast karma
#

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

frigid bay
#

or it can separately check for bigger cases

#

like if there's a gap of like 1000

green vessel
cinder wigeon
#

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

austere mauve
#

advent of djikstra

stuck herald
#

is there a custom prefix for slash command bots plugin

vast karma
#

Skill issue

#

I simply do not hash strings that's collide

green vessel
trim cedar
#

yes

trim cedar
trim cedar
#

Use a map lol

trim cedar
stuck herald
weak idol
#

Hii, any guide for plugin dev for vencord? I dunno the API i can use

vast karma
#

Check how other plugins do things and grep for stuff

#

There's not much docs beyond that

junior cove
weak idol
steady knot
weak idol
#

Do u know how i access Discord API base route

smth like ```js
${DISCORD_API_BASE}/channels/${channelId}/messages

vast karma
#

That'd be with import RestAPI from "@webpack/common";

weak idol
vast karma
#

There's a buncha predefined things there, yeah

steady knot
#

I dunno why it isn't pinned or linked anywhere, does @viral roost have any reason why it's not very public?

vast karma
#

If you want to find more obscure modules, you need findByPropsLazy

viral roost
chrome elbow
#

soon™️

green vessel
#

tessie w

hushed bloomBOT
steady knot
dull magnet
#

literally included in the code u replied to

glass oracle
#

oh right

rocky rune
#

anyone think this would be worth pushing as a plugin once I finish it? Added coin collection to oneko lol

stiff cargo
#

Blasted webm file!

frigid bay
#

should be an option in oneko