#development
1 messages · Page 150 of 1
remove the depend_on of the database from bot then
HttpGet
seems like database will already shut down if bot does
I'm not telling u to send a request from the code
since it already depends on it
How
wget is a program
Ohh ok
idk, what OS are u hosting the bot in?
haku they are using bdscript do you think they know how?
Bdfd
bdfd also hosts bots?
Bdfd is an app that can host and create custom command
well, then that makes thing more complicate
both depends on bot, but the services keep on running
as idk any good app to send http requests
Tell me u know how to make a vote code-
this is why I dont help people who use bdfd
whats the behaviour of:
- bot depends on database
- adminer depends on database
aka what you had before
the same
Not really, I've heard of this app somewhere before, but I've never used it myself
from a hindsight there's nothing there to cause an Unauthorized response
according to the docs depends on only say the startup order on up and the shutdown order on down, but has no effect when a specific service exits
it should
if the depends_on service exists, the one that has the depends_on should shutdown too
or just use --abort-on-container-exit i suppose
could always have your bot call to a service outside the container to call docker compose down for ya 
but is it such a niche use-case?
I don't suppose many want to actually do something like this
then again I could be wrong
most projects i've seen that use docker just let it happen if a service goes down
they don't bother bringing the entire container down and just wait for the service to come back up
Stops all containers if any container was stopped. Incompatible with -d
yeah nah this sounds like the only solution
or use --exit-code-from to directly specify the container
Return the exit code of the selected service container. Implies --abort-on-container-exit
it does the same behaviour as abort-on-container-exit, but iirc allows you to set which container it should use
so docker compose up --exit-code-from bot
it would be nice to have something like this in the yml file
commands:
up: docker compose up --exit-code-from bot
so i dont forget the flag
actually re-checking the docs, this would only fire on a none-null return value
none-zero
so --abort then
no clue anymore 
xD
or pass-through again
i mean it works alr with it
though tbf, it does sound sus when the database just gets shutdown through that
does it properly shutdown or just the container killed
im just perfectionistic and was trying to found a more elegant solution
wait
i mean looks gracefully to me
lemme check logs
- received fast shutdown request
- aborting any active transactions
- background worker "logical replication launcher" (PID 32) exited with exit code 1
- shutting down
- checkpoint starting: shutdown immediate
- checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.015 s, sync=0.007 s, total=0.052 s; sync files=2, longest=0.004 s, average=0.004 s; distance=0 kB, estimate=0 kB
- database system is shut down

why abort and not just stop
aborting sounds not really gracefully to me
sounds aggressive yes
in the end, i still can use docker stop from outside in case i forget. its not like i want to shutdown the container 50 times a day. in the perfect world once its configured it should run till infinity 
im just using this project to get a better understanding / knowledge of docker
i copied it over to my pi and it worked 1st try so thats a nice feeling
yup thats the magic of docker
and the build times are now much faster bc i added another layer which just download my projects dependencies and since they dont change often they are cached once i rebuild it with changed code
Nice
@lyric mountain Love how Optional lists aren't a thing in prisma
so its basically requiring that Nutritional Facts exist on the table, yet what if its a product thats not edible, it wont have that
can't u have an empty list?
ah wait, I get what u mean
this can be solved by putting the foreign key on Nutritional Facts instead of Product
actually, it has to be there, I kinda messed up on the example
model Item {
Id Int @id @default(autoincrement())
UPC Int
ProductName String
ProductDescription String
AveragePrice Int
Edible Boolean
NutritionFacts NutritionFacts[]
@@unique([UPC])
}
model NutritionFacts {
Id Int @id @default(autoincrement())
Ingrediants String
Amount Int
Component Component[]
ComponentId Int @unique
Item Item @relation(fields: [ItemId], references: [Id])
ItemId Int
@@unique([ItemId])
}
model Component {
Id Int @id @default(autoincrement())
NutrtionFact NutritionFacts @relation(fields: [NutritionFactId], references: [ComponentId])
NutritionFactId Int
}
This is what I have so far
I could technically just assign an empty list to those inedible products
I also am going to rename Item to Product as it makes more sense
but ignore that
model Item {
Id Int @id @default(autoincrement())
UPC Int
ProductName String
ProductDescription String
AveragePrice Int
Edible Boolean
@@unique([UPC])
}
model NutritionFacts {
Id Int @id @default(autoincrement())
ProductId Int @id
Ingrediants String
Amount Int
Component Component[]
ComponentId Int @unique
Item Item @relation(fields: [ItemId], references: [Id])
ItemId Int
@@unique([ItemId])
}
model Component {
Id Int @id @default(autoincrement())
NutrtionFact NutritionFacts @relation(fields: [NutritionFactId], references: [ComponentId])
NutritionFactId Int
}
Wait what
but this would be better in an orm yeah
Why are you removing NutritionFacts from Item?
idk how prisma generates it, but the foreign key must be in NutritionFacts
Wouldn't that break any link it has?
if it works like JPA, then it'll automatically create a FK there if u declare on Item
run it and see how it generated the structure
Error validating field `Product` in model `NutritionFacts`: The relation field `Product` on model `NutritionFacts` is missing an opposite relation field on the model `Product`. Either run `prisma format` or add it manually.
It has to have a field referencing NutritionFacts on Product
Item -> Product just now so don't get confused
yeah that's fine then, use the array thing
Component
Ight
it automatically creates the FK
I will set a default of [] then
but it can have no components
looks like I will do it manually then
cant u just put no defaults?
wdym
like, just declare the column normally

Yea you can do that
does this error?
nah
doing @default([]) after does
cause I wanted to be lazy
and let prisma handle it for me

but u dont need to declare a default do u? it'll be empty by default already
Will it?
I think so
I mean we'll find out eventually
@lyric mountain
return this.prismaService.product.create({
data: {
ProductName: "",
ProductDescription: "",
UPC: 1234545,
AveragePrice: 16,
NutritionFacts: {
create: {
Amount: 100,
ComponentId: 1
}
},
Edible: false
}
})
Look at how prisma creates things

Ima have to do a lot more logic ofc cause that specific ingrediant might not exist in the database yet
Oh god wait haku
hm?
I just realized, I will have to loop through the nutrition stuff and get each ingredient individually and check if it exists in the db before either creating it or assigning it to the NutritionFacts for that product

So many db calls
u dont really need to
oh?
you see, you cant use a nonexistent component
the db will simply reject it because of the foreign key
if ur using a dropdown you already have a list of available components, if they somehow try to use an invalid component the product wont be added
that's the magic of constraints
Ah right what was I thinking
So then I can just create the product then modify the NutritionFacts array to add on those components
or is there a better way?
Cause i'd still have to end up looping through the selected components, also if they are adding a product and they have an ingredient that doesn't exist yet they have to add it somehow
depends on how prisma does it
on JPA I simply commit the entity with the collections populated and it simply generates the INSERT queries
try comitting a product with all facts added to it to see what happens
without saving the facts individually
add some bogus ingredients
https://www.mockaroo.com/ btw this might come in handy
A free test data generator and API mocking tool - Mockaroo lets you create custom CSV, JSON, SQL, and Excel datasets to test and demo your software.
Just realized that a component relies on it being connected to a Nutrition Fact
nono, the nutri fact is connected to the component
good site
+1
always use for work
the FK is on facts, not on component
I also like lipsum
but component also has an FK
then u messed somewhere, it shouldn't have one
Yea thats my point
since it wont be linked to a single fact
😩
model NutritionFacts {
Id Int @id @default(autoincrement())
Amount Int
Component Component[]
ComponentId Int @unique
Product Product @relation(fields: [ProductId], references: [Id])
ProductId Int @unique
}
model Component {
Id Int @id @default(autoincrement())
ComponentName String
NutrtionFact NutritionFacts @relation(fields: [NutritionFactId], references: [ComponentId])
NutritionFactId Int
}
ah, there it is
Likely to do with @relation on Component
But it also can't just Component Component[] on fact
the other table has to have something
what even is that btw
like what type of format
prisma models
a fact would have only 1 component

so it should be a one to one
meanwhile I'm doing that
CREATE TABLE xyzabcdefg
many to one
many facts can refer to one component
I have no idea how to setup a many to one relation in prisma
I'd assume it'd be the opposite
Yea thats not how prisma works
model NutritionFacts {
Id Int @id @default(autoincrement())
Amount Int
Component Component
ComponentId Int @unique
Product Product @relation(fields: [ProductId], references: [Id])
ProductId Int @unique
}
model Component {
Id Int @id @default(autoincrement())
ComponentName String
}
yea no prisma requires something to be referencing NutritonFacts on the other side
hm, that might make things complicated then
model NutritionFacts {
Id Int @id @default(autoincrement())
Amount Int
Component Component @relation(fields: [componentId], references: [Id])
ComponentId Int @unique
Product Product @relation(fields: [ProductId], references: [Id])
ProductId Int @unique
componentId Int
}
model Component {
Id Int @id @default(autoincrement())
ComponentName String
NutritionFacts NutritionFacts[]
}
prisma out here auto putting shit in as well

Actually this makes sense what prisma did
in this way a Component can be linked to many NutritionFacts
Unless im reading it wrong
technically yes, but one-way relationships are the proper way for such cases
well Idk how to do the proper way with prisma
like, the component doesn't need to know where it's used, it's used only for lookup
gave a search, apparently prisma doesn't suppose one-ways
I follow him every day 
why tf are powershell aliases so scuffed
Function dockerCompose { docker compose up --build --abort-on-container-exit }
Set-Alias -Name up -Value dockerCompose
bash be like alias alias_name="command"
even on batch it was easier
doskey alias_name="command"
but ofc, they made sure to make everything more complicated on pshell
and its weird that all commands and keywords are capitalized
oh that's cuz c# (which inherited from VB)
as it was on batch (cmd)
but at least i have my alias now 
just use cmd then
tbf i like the powershell 7 shell itself
and I do, the only time I use pshell is for ssh
Is ngrok the best choice when testing webhooks locally?
Or is there something else
well i am connecting to a third party webhook basically i make the initial post request with the signature
this is for sellix
cloudflare tunnels are better since they don't have a time limit
you could also connect it to a domain/subdomain and never have the need to change the url in the developer portal
how can I make the last element(s) in the css grid that dont fill the entire page be extended to their max?
I currently have this classname (tailwind) grid gap-2 grid-cols-[repeat(auto-fit,minmax(min(28rem,100%),1fr))]
flex
so grid is not the right answer at all
yep, grids follow a fixed row-column structure
if you want a flexible layout, go flex
to force the "columns" to divide the available space equally u simply need to use the same flex weight on all elements
rows with only one element will automatically fill the available space, as there'll be none to share with
what properties exactly do I need for this to work with flex?
on the items?
yep
which number u use doesnt matter, but using different numbers for items will change their "share" ratio
you also need a minimum width for the elements, else they'll just squeeze together
width: 50% for example
if they still dont wrap, try this property
but they should without it
im really horrible at advanced css (if that even is lmao), im still at the same point as the screenshot
start by setting a min-width for your cards (the message things)
if you want 2 columns, it must be at least half of the available space
well, technically at least 34%
I want it to detect how many columns fit, a card (in my case) technically should only have a max width, if there isnt enough space for a third the two cards will just share all space in that row
aight, so add more cards there
only 3 wont be enough with 10rem min
alternatively just shrink ur window
flex should push the last card to the bottom row
kinda
try removing it to see if anything happens
hm
press f12 and scroll over flex attributes, see which one affects the card
select the card first ofc
also, you wont be able to use max-width anyway as it'll prevent the lone card from growing to fill it all
but u can set the max width on the text itself
can someone elaborate how the fuck I can RewriteCond something like *-deployment.example.com
or tell me a different apache2-like shit that does it easier
oh shit
wdym?
I have to apply the stuff to the <Link>
link?
ahh, the thing is wrapped in a link
goal is right now:
I want to be able to catch-all *-deployment.example.com, which would be handled by another app from mine that allows me to handle several domains for testing
the important part is not that
the important part is: how can I use RewriteCond to allow me to proxyPass that to another internal IP and not if it doesnt match
now I have this
already tried some braindead thing like
RewriteCond %{HTTP_HOST} ^(.*)-deployment.example.com$ [NC]
# Proxy pass the request to the appropriate server
ProxyPass / http://10.10.10.100:1337/
ProxyPassReverse / http://10.10.10.69:1337/
otherwise I'll just jump over to nginx and start using that
never used apache so idk, but yeah nginx is usually easier to setup that
cool cool
remove flex from inner container
why? I need it so the text and image are seperated
also I forgot to move the flex-1
it now looks like this
cant you just flex-wrap the whole container, then set a fixed width of 50% (for each element)?
lmao it's getting worse
flex is hard to get right without some experimentation on inspect element
they want the column number to be automatic based on how many elements can fit there
flex is just hard to begin with
but rows with remaining space must be filled by elements
yup thats possible with flex-wrap
or just not with tailwind dunno
managed to do that within bootstrap

well you can force tailwind to use any value
try flexwrap then
bootstrap is as old as time itself
!
ok
thats the parent
I've tried sveltekit btw
I dont like the concept of client side rendering ngl
yes dynamic content
but

client side is less load on server ig
ill just keep it on grid for now. too tired
but I prefer ssr because its also a lot more secure since for example you can more easily choose whether confidential info gets transmitted to the client or not
some hybrid libraries are unclear on what info remains server side and what gets sent to the client which is extremely unsafe
just remove the flex from link again, it was already automatic at this point #development message
better than grid as it'll at least adjust based on screen width
you do
who?
the only person in the jail
nah, I'm no good at css
I still cant quite decide whether a person being good at backend or a person being good at frontend has a better experience making projects
If those were a skill I would be invested 65% backend, 35% frontend
I’d be 80/20 if we get to choose
I'd just hire people
Atm I’m probably like 99/1 lol, I need to do more frontend
svelte mentioned 💪 🔥 🚀🚀🚀🚀🚀
most backend devs can do both
every dev is fullstack anyway
you kinda need to be able to do both
and you'll do fullstack but be paid for only one of the stacks
how do you learn how to develop a backend without having a front end or vice versa
dont like the client side rendering stuff tho ngl, especially when I have to implement the majority of my authentication stuff on that client
I suck at frontend, I could do it but it would require me to learn boring frontend stuff 😭
of course having a backend handling stuff with auth
sveltekit is weird but svelte itself i enjoy a lot
Im currently doing more frontend because my head is on fire trying to make my database proper, most endpoints already exist and work but there is no ui
i think i might try and write a chat app finally
basically a rite of passage at this point
Tbf separating backend from frontend is probably the best thing to do
make a multiplayer snake
i mean yeah but they're dependent on each other
not much point to writing a backend if a frontend doesn't or won't exist
Frontend should be able to call backend functions but the frontend shouldn’t manage much data itself other than displaying it
what the frontend needs dictates the backend's features
my newer projects look like this
I really need to get back into programming, no good projects though and very little motivation
me asf
I’ve been too burnt out bc of job + figuring out college
I lose motivation after like 2 weeks and I gain it back because I have not alot else to do currently
another reason why i wanted this laptop is that hopefully it'd motivate me to code more in my downtime where i'd otherwise just be laying in bed scrolling socials
My bot keeps going offline randomly and I don't know why lol
always get this stupid error when installing canvas
or any fucking useful package using node-gyp
no shit but i am unsure how to fix it
ubuntu 20
sudo npm install canvas --save -g
this works -> but eventually it doesn't show up as installed in my node_modules.
sudo npm install canvas fucking doesn't.
lmao
Global installs the package in a diff folder doesn't it?
Yes, but sometimes it works like this, so it's usually like this for me (win11)
yes, but that's not what I mean
if it install globally, it wont be in node_modules
I hope my bot is accepted I put many hours into it 🥲
Yes got it thx
Crazy?
No
a rubber room
Nooooo
excuse me?
theres a @fs in sveltekit that exposes my filesystem?
at least on the dev instance using npm run dev
but still
why
literally exposing my whole deployment path
i mean dev mode is designed to make everything easier so it would make sense to expose that
if it exposes it in production mode then thats a bigger issue
ye
Could fs not just be used for hot reloading
One message removed from a suspended account.
imagine using node-gyp tbh
Yall got any suggestions how to get started on DevOps
whats devops
i still dont know what devops is
i think its some buzzword for some stack of development
im not sure either but i think its related to system administration
like running linux and shit
examples of devops things:
Coding. Code development and unit testing.
Build. The process of continually integrating work from multiple developers.
Test. Continuous testing and reporting of defects and risks.
Packaging. ...
Change Management. ...
Configuration. ...
Release. ...
Service Level Objectives.
git, docker, etc
what lib (js/ts) should I use for a very basic discord bot that will be in 1 server?
it should be a relatively lightweigth lib
discordjs-light
doesnt exist
discord.js-light is just a bunch of monkey patches, I don't recommend you using it
should be stable enough to use, but there are still some changes i want to make on it, havent had much time to work on it lately
my bot currently uses it
I've also used it in the past and it was quite stable (after reporting a bug and testing many times)
using your own lib is always a sign of safe to use for me because if the owner discovers a bug while using its (often) fixed fast
ill try it
Ill only use very basic features anyway
don't think it's on npm yet so you have to use the repo url
tim, do you have some basic starting code
just create the shard and the rest client
there's typings too so you can look at those if you don't want to see the long js code
yeah but I am quite confused
its raw discord data
it doesnt do any processing like djs does, so you have to reference the discord api directly
s is the sequence number
t is the event name
op is the operation type
d is the json data of the event
you can ignore the sequence number, its handled internally
you can also ignore op
just use t and d
t will be strings like "MESSAGE_CREATE"
and d the event data
I have bad news. I have to learn golang
those are the names discord uses
not my fault
oh right i forgot
haven't touched discord bots in years
tiny-discord is probably as low-level as you can go before you go libless 
and manually handle websockets and shit
pretty much
its libless for those who dont want to actually do it themselves
a libless lib
lel
Can anyone pls explain me what is sharding in a discord bot, and how much time does it take to do?
Sharing?
you mean sharding
Yes bruh, yes
It was a type error, sorry
Can anyone teach me how to do that?
(discord.js)
One message removed from a suspended account.
sharding is splitting your bot into multiple connections, each connection handling a certain number of guilds
Sharding
Okk, can you teach me that?
One message removed from a suspended account.
sharding is recommended at 1500 guilds and becomes required at 2500 guilds
discord.js
One message removed from a suspended account.
Yea, just type discord.js sharding in google
Yes ik that, I'm asking in case that happens then what do I do?
I don't know about sharding, can you pls teac me? (discord.js)
Also, how much time does it take?
discord.js has two types of sharding, internal sharding and the sharding manager
Pls teach me the good one
internal sharding is just an option you put in your discord Client, its very easy to do, takes 5 seconds
internal sharding is fine up until about 10-20k guilds
depending on how cpu hungry your bot is
the sharding manager splits your bot into multiple processes, so depending on what your bot does and how does it work, it may need changes in your code
One message removed from a suspended account.
Okk
One message removed from a suspended account.
One message removed from a suspended account.
👍🏻
So what? That's it? Only I put that code and it's done? Nothing else?
As Tim wrote, it all depends on how your bot works and what it does
In some cases you will have to change the code, in others you won't
you have to understand that using the sharding manager changes how your bot works, so you have to think about how that can, or not, affect you.
a normal non-sharded bot has everything inside the same process, all guilds, all channels, every thing, is all inside Client, easily accessible.
a sharded bot is different. you will have multiple copies of your bot running at the same time. for example if you have 2000 guilds, the sharding manager will create 2 copies of your bot file, 2 Clients, each Client only has ~1000 guilds, and their channels, members and users. each Client will only have the guilds for that shard and you will not be able to see guilds from a different shard from inside your code.
this is something you have to understand in theory and in concept, before you start working on it in your actual code, so that you dont get lost
and sharding is likely not gonna be a requirement you have to make until your bot is like, 200k was it?
around-ish 200k
sharding is required at 2500 guilds
2.5k then yeah
How to make money here
get a job
Thanks
lol
gamble
statistics say most gamblers quit before theyre about to win
hope i havent just relapsed some gambling addict
I stopped gambling after winning an item in a game that had a 0.001% chance of getting
I knew I had to stop cause I would of lost it

Has it always been like this? I thought it would end up being [componentId, amount] of Object.entries(data.NutritionFacts)
didn't know the first thing would be a string
Also is there anyway I can define what these properties will be called
NutritionFacts?: Array<Record<number, number>>
I feel like Record<number, number> could be anything but I want it to tell me that the key should be a componentId and the value is the amount
Numbers as keys in objects are converted to strings as always

The only keys that are not converted to strings are symbols
Because numbers as object keys does not make sense, only strings and things like symbols, the other reasons are optimization-related
Most programming languages won't allow numbers as keys in objects
grr
Well what should I do then, it feels weird having a useless string
I'll never need it
I'm not sure what you exactly mean by a useless string
Do you mean that you don't want to use componentId?
By the looks of the screenshot componentId is just the id in the next variable defined
so that string is really just rather useless
as I need it in a number form not a string
and it is a copy of the number that already exists
Then you can just iterate through the values instead
Object.values() exists
Replacing that Object.entries() with Object.values() should work with your current code
Type '{ componentId: number; amount: number; }' must have a '[Symbol.iterator]()' method that returns an iterator. can I seriously not [componentId, amount] it
I have to just use a variable
What does that even do?
const { componentId, amount } ...
ight but what does wrapping it in [] do?
I always knew it was a thing but never actually knew what it does
Destructuring with [] pulls out elements one by one starting with the first element from an array, meanwhile destructuring with {} pulls out the specified properties from an object
const foo = [1, 2, 3, 4, 5];
// Notice the hole (, ,)
const [bar, baz, , qux] = foo; // 1, 2, , 4
const quux = {
qex: 'foo',
5: 'bar',
9: 0,
0: 1,
qax: 'baz',
qix: 'qux'
};
// 9 and qax ignored
const { qex, 5: rux, 0: rox, qix } = quux; // qex: foo, rux (5): bar, rox (0): 1, qix: qux
makes sense
why does destructing objects force you to put the... last?
const {one, two, ...theRest1} = {one: 1, two: 2, three: 3} // works
const {...theRest2, one, two} = {one: 1, two: 2, three: 3} // doesn't work
cause then you are basically overriding everything after it in that case iirc
which makes no sense
objects aren't ordered so order shouldn't change the outcome
The spread (...) syntax allows an iterable, such as an array or string, to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected. In an object literal, the spread syntax enumerates the properties of an object and adds the key-value pairs to the object being created.
read up on that
what you are doing is spreading, and spreading at the beginning is basically combining everything at once
in my context it's the rest property
what?
spreading/deconstructing is ordered
yea?
oops, need the object version
i think it should allow the rest property anywhere in an object
since order doesn't matter for objects
Volltrex
fault
how would it be able to get others if it isn't the last element in the destructor?
while objects aren't ordered, a destructor is
it shouldn't be ordered for objects is what i think
don't think u understand what I mean
destructor logic is currently ordered?
i see that
that's what i'm thinking should change
{ a, ...others, b } considering the example in the image, ...others wouldn't know b isn't part of it (it's not assigned yet)
lookahead
yes, but that adds overhead
or a flag
the only way to fix this would be to throw ...others as the last element in the destructor, but again, overhead
Voltrex could do it
when js is being interpreted isn't it read from left to right? so initially it's just gathering symbols on the left side of the =. So it doesn't actually need to destruct until it parses the right side of the =
const {...theRest2, one, two} = {one: 1, two: 2, three: 3}
{...theRest2, one, two} is iterated
so ...theRest2 doesn't know there are one and two in front of it
why would it stop? it hasn't gotten to the closing }

Why is this even an issue
Why would you even want to do this
I see no practical usecase here
it has to assign
if the first is a the rest operation, then it'll put all props in it
i do it sometimes and it throws an error that's not too obvious
it doesn't loop twice over the variables, it assigns in-place
it can't assign until it gets past the = sign where the actual data is
by that time it has parse the entire left side
it doesn't lexical anything, the code is already compiled (kinda)
it's interpreted
lexical and tokenization are things for writing code, not executing it
Voltrex is here to save the day
I mean haku is explaining it perfectly fine
you just don't seem to understand 👀
btw haku I have a question for you regarding my stuff from earlier
{...theRest2, one, two}
1 - sees a rest operator, puts everything remaining from right side into it
2 - ??
3 - ??
{one, two, ...theRest2}
1 - sees variable, assigns from right side
2 - sees variable, assigns from right side
3 - sees a rest operator, puts everything remaining from right side into it
sure
are the curly braces ignored?
curly braces are simply enclosing a selective destructor so the runtime knows what to do
for example const ...theRest2, one, two wouldn't make much sense to the runtime
1 - see const
2 - see { - creating destructor
3 - see ...theRest - add to destructor
4 - see ,
5 - see one - add to destructor
6 - see } -
7 = see =
There are multiple reasons why we enforce the spread operator to be used as the last in a destructuring statement:
- Readability, if it was allowed anywhere in the statement, it makes it much harder for the reader to understand what's even going on because its purpose (in the case of destructuring) is to pack the remaining properties into a variable, which is why only allowing it as last makes much more sense
- Performance, allowing this changes the grammar of the destructuring statement drastically, and requires lookbehinds, lookaheads, and traversals since nested destructuring is allowed, which is a very big reason to disallow putting the spread operator anywhere in the destructuring statement
I think ur missing the point
oh yeah, i could see it being tricky for nested destructuring
i've never done that
How do you think I should handle people adding new ingredients to the database? Cause if a product they are adding has an ingredient not yet known in the database it makes it weirder.
Maybe disallow adding unknown ingredients?
they mean adding new ingredients at all
it's a bit complicated, u could technically query the database to check if there's any lowercase no-accent match of the typed name, but wouldn't help against sinonyms
but since we're talking about nutritional facts, the names are standardized
Could use an API or JSON to check against synonyms
u could simply download the complete table from gov site
Oh?
That would be helpful for my government if it exists but I don't think it will encompass any ingrediants that are allowed to be used in other countries
So sure it would be helpful as a base
by "ingredients" we're talking about nutritional facts right?
No
ah, well
Ingredients are like how there is peach juice in a bottle of Peach Lemonade Calypso
something i happen to have on hand
I think those names are also standardized, but will need to check
I don't really like the idea of people having to input the ingrediants themselves tbh
but I dont think there is any other way
like "aqua" instead of water, in pretty much every product that contains it
they even use "aqua (water)" usually to clarify
I'm so confused about the actual question, as in people adding new ingredients via a product that includes said ingredients that aren't in the database yet, or just adding new ingredients manually after adding a product that specified that ingredient when it didn't exist in the database?
I'm most likely missing something here
As in they are going to add a product but an ingredient doesn't already exist in the database
I don't really know how I should handle adding it
whether that be while they are adding the product or making them do it before
search fda site for whether they have an ingredient list
then just copypaste the whole thing into the database if there is
I fucking hate reading government documents
yea none of it seems like it will be super helpful just from skimming it
basically just guidelines for any company producing food
Maybe while they're adding the product, so they can know what ingredients they forgot to add to the database, or modify their product if they incorrectly added a non-existent ingredient

Yea probably
I don't see any other way to do it
though I wish there was a way that they didn't have to do it themselves, yet there are just too many ingrediants for me to add on my own
use an elasticsearch database for the ingredients and check the db before adding a new ingredient. ask the user if they can use the similar ingredient
@lyric mountain I mean I have OTC Active Ingredients available
https://www.fda.gov/media/75750/download
well, that's enough I think
if the user needs something that's not in 44 fuckin pages then u could use an approval system
ah
God this is really a pain
I don't wanna make the end user do so much work
but I might have to
time to grab wall spatula then and start scrapping
u can select all the text and use regex to extract the lines
I dont know how regex works
so by hand it is!
Should I include ingrediants as part of Components or should I make it its own field?
@sharp geyser could this be what you're looking for?
https://fdc.nal.usda.gov/
Actually it should be its own field cause it doesn't tell you the amount of ingredients are in it
It’s not too hard
You can look up a few basic tutorials and grasp the basics in a few minutes
Also yea
I think thats exactly what I need
(add an space between - to prevent excluding composite names)
As much as I hate regex, it’s super useful for parsing scraped data
yeah, an api is more handy
It comes in both CSV and JSON format
is "bananas" in there?
everyone knows the global standard for measuring is bananas
@earnest phoenixwhat is the point of FormData not accepting ReadableStream?
like how are we supposed to stream file uploads using mutipart/formdata without loading the entire file in memory
or is Blob able to consume a stream without loading everything?
i actually had this same exact problem
i did not enjoy it
@rustic nova why flag my message as spam >:C
what i did was split file creation and file upload into 2 api calls
It was simply just a wall of unit measurements

first api calls basically says to expect a file to be uploaded
good job flagging automod
second file streams a blob to the server alone
i mean
1000 cubic inch
1000 cubic centimeter
1000 gallon
1000 pint
1000 fl oz
1000 paired cooked w
1000 paired raw w
1012 dripping w
1013 bar
1014 bird
1015 biscuit
1016 bottle
1017 box
1018 breast
1019 can
1020 chicken
1021 chop
1022 cookie
1023 container
1024 cracker
1025 drink
1026 drumstick
1027 fillet
1028 fruit
1029 large
1030 lb
1031 leaf
1032 leg
1033 link
1034 links
1035 loaf
1036 medium
1037 muffin
1038 oz
1039 package
1040 packet
1041 patty
1042 patties
1043 piece
1044 pieces
1045 quart
1046 roast
1047 sausage
1048 scoop
1049 serving
1050 slice
1051 slices
1052 small
1053 stalk
1054 steak
1055 stick
1056 strip
1057 tablet
1058 thigh
1059 unit
1060 wedge
1061 orig ckd g
1062 orig rw g
1063 medallion
1064 pie
1065 wing
1066 back
1067 olive
1068 pocket
1069 order
1070 shrimp
1071 each
1072 filet
1073 plantain
1074 nugget
1075 pretzel
1076 corndog
1077 spear
1078 sandwich
1079 tortilla
1080 burrito
1081 taco
1082 tomatoes
1083 chips
1084 shell
1085 bun
1086 crust
1087 sheet
1088 bag
1089 bagel
1090 bowl
1091 breadstick
1092 bulb
1093 cake
1094 carton
1095 chunk
1096 contents
1097 cutlet
1098 doughnut
1099 egg
1100 fish
1101 foreshank
1102 frankfurter
1103 fries
1104 head
1105 jar
1106 loin
1107 pancake
1108 pizza
1109 rack
1110 ribs
1111 roll
1112 shank
1113 shoulder
1114 skin
1115 wafers
1116 wrap
1117 bunch
1118 Tablespoons
1119 Banana
1120 Onion
9999 undetermined
you're still loading the entre file in memory
@lyric mountain there ya go
on the client side
skin
not by doing that
ah yes, banana for scale
1120 Onion
THERE IS BANANA
because i didnt use form data for the second uplaod api call
form data only for the meta data about the file
tortilla for scale
second only sends a streamable blob
spear
ah
using fucking weapons for measurements
tbh i dont even need to do this shit
but yeah would be nice if form data supported streams
but for some reason i decided i wanted to support both http and fetch
ah yes, I'd like orig ckd g breads please
i can just not use FormData and create my own streamable thing to gie to fetch
that sounds like a shell command
Why your message get blocked wtf
i'd like onion bread please
since fetch accepts a readablestream body
i used xhr for file upload because i can track the progress easily
on another note how many bananas are too many
with fetch it gets a little complicated with aborts and stuff
i had the brilliant idea of adding support for non-node environments on tiny-discord
i am not enjoying it
on web js?
Oh lovely
I dont understand, give me a measurement of tortillas thank you
I walked 5617.978 bananas today
web, deno and bun
cant you just use polyfills for stuff like this and fill the rest out
dont know lmao
probably
this has to be from the days when bartering was a thing
but idk why i decided to just do it myself
or its just us americans being americans
so add a fetch alternative for when http is not available
How would you trade a kilometer for a banana misty
😭 it’s just the length of the banana
does it do this during runtime or are you planning on seperate libs for this
during runtime
thats gonna be painful 💀
uh not what I meant 😭
im gonna have to separate the emitter from the class
what i would do is maybe have some sort of converter which can convert the nodejs code into browser/deno friendly so you have separate libraries for each environment but only need to work on one library
instead of new A(), a.on("bla") its gonna be new A(), a.events.on("bla")
so that i can have custom emitters as a construction option
also needs to be browser modules friendly lmao
ye
assuming youre not bundling everything into one js file
my ETF lib supports cjs esm and udm
works in node web bun and deno
feels good
so i decided i wanted to make all my other shit like that too
because it feels cool
lmao
check it out, 3kb minified gzipped https://cdn.jsdelivr.net/npm/wetf/esm/unpacker.min.js
Turns out this isn't what I was looking for

time then
well it's not scrapping if u ctrl + S the site
jokes aside, simply copy the full list and regex the desired content
/^(.+?) - /gm
ighty
might need to hand-process one or other tho, as some have comments
/^(.+?)(?: - | \()/gm probably works better for that sense
One message removed from a suspended account.
No, a Blob cannot consume any type of stream without fully loading it into memory
As for your previous questions, according to the FormData specification (https://xhr.spec.whatwg.org/#interface-formdata) readable streams are not allowed, from what I've gathered it's because of an stream not containing enough metadata or something but mostly I have no idea
I haven't been able to find any good information as to why it's technically disallowed whatsoever
apparently formdata requires knowing the content length or something
anyway im just gonna roll my own multipart encoder
Fun (not so fun) fact I spent an hour of my time trying to find information about why it's disallowed, yet no concrete information 
rip
who would use a random api either
I would probably focus on doing something that would be useful to me or someone I know
Then you'll probably find someone else
ye look at me im basically doing @rustic nova bidding while he sits and wait for my api to be done

api that responds with teapots
and responds with the code 419
already exists
just make an actual application
rather than an api
problem is there are so many bots
why choose yours
same with APIs
try find if theres a gap to be filled in the market, is there a niche
You need to find a very good niche
I know a bot that hasn't been done before well enough
One message removed from a suspended account.
I've done my research
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Honestly at this point I just make shit to practice
:p
then dont be concerned about what it is
just do it
if no one uses it who cares its practice for the thing you want people to use
build up your skillset until you're ready to make something that truly matters to ya
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Also revist old projects
One message removed from a suspended account.
One message removed from a suspended account.
Any old projects you've done you can try and make it better
One message removed from a suspended account.
See how you improve
oh no aurel is typing
()=>{this} acts different than function(){this}
this is simply a keyword that is basically like the parent. So in a class this would be the class you created and would have access to all those props outlined in said class, same thing with functions
why did they have to call it this it literally makes putting it into a sentence hell
without quotes it makes it look like youre being very vague
only in js, as this varies on whether ur using arrow or regular funcs
scraping twitter 
rewrite tiny-discord in node-gyp with plain OpenSSL calls 🤌
scraping the mee6 api for fun and profit
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Busy with work 😢
Fax
gf != bitch
still
using tokio native tls for fun and profit 🤌

thats rude null
Hey
Yo
why
Hi all! Please tell me how to make prompts when entering a command?
I guess you need to explain it a little better. What prompts are you talking about exactly?
I suppose you mean this:
https://discordjs.guide/interactions/modals.html#building-and-responding-with-modals
Dirty mind
!I have gf
Yall ever worked with graphql?
and i might need some place to get started with golang
Theres a good course on udemy which I used
thanks!
how is that dirty
A lot
you are just dirty minded
@earnest phoenix you cant press next because its the end!
just do all the steps again from the beginning and also read what is written there
Hi
this tbh https://youtu.be/J0p2Psy7NfA
Recorded live on twitch, GET IN
https://twitch.tv/ThePrimeagen
MY MAIN YT CHANNEL: Has well edited engineering videos
https://youtube.com/ThePrimeagen
Discord
https://discord.gg/ThePrimeagen
I am learning GO
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
I started work at a new company, and they basically use it for their backend
One message removed from a suspended account.
graphql 💀
ikr
great to use, awful to implement
I'll play around with that too
My condolences
It's not terrible but it's definitely not good
Here are a few articles, blogs, and whatnot detailing why it's not really good
go automatically adds a space after a comma :0
thank you, i got something from udemy instead
to go through it all
oh that's "why it's not good"

I learned it cuz I wanted to and really quickly realized that there’s no real use case. For each one there’s a better language to use. I only suggest learning it like in your case when you get employed and their architecture is already written in go
hmmmm
Yep :^)
Yep thats where i am at
She really hates it 
how do I register context menu commands in discord.js?
I already tried putting them into my <Client>.application.commands.set(...)
did you set the command type to the proper type?
wdym? Im just calling .toJSON() on the builder
Can i see your handler?
for what?
i might able to help.
its not cause of the handler.
your command handler*
its not cause of the command handler.*
its just not registering, nothing to do with my handler
the handler handles incoming interactions
and it would work if the menus were to register
your context menu command
In discord.js, given a bigint, how do I get the string name of the PermissionBitField it resembles?
you check which index it represents
for example, permission 12 isn't actually the number 12, but 1010 (permissions 2 and 4)
if u convert that number u have into binary, you'll get the permission indexes
remember it's read from right to left
if (12 & 4) {
console.log('int 12 contains permission 4'(
}```
Say 8n for example,
I have no clue what that represents
in numbers* its the Administrator permission
I think Ill just use PermissionStrings 
it represents 1000
as in, 4th permission
bitfields aren't meant to be seen in decimal notation
bitfields are basically arrays but in a number form
Thanks, though I'll just use the PermissionString types, I just need a way to define required client permissions for commands before running them
Dont know why I jumped to using bigints
bitfields are much more efficient, but d.js will convert permission strings to it anyway
djs uses bitfileds internally
it just converts to strings when you want them as strings
change my mind





