#development
1 messages · Page 284 of 1
im using someone else's username that i found on stackoverflow by chance, and it works
i'll make my own account eventually, but for now im having fun testing gb's of downloads in someone else's name lmao
didn't knew tim is evil
He's gone off the rails lately
Today i learned that ubuntu 20.04 breaks ps command because it dosen't support date formatting unlike 22/24.
The option is just completely gone and it's not even a standard thing.
Was that a mr beast scam.... that's a first
my sparql queries are evolving (thanks to chatgpt, even though most of what it says doesnt work)
what the fuck is that
so why not postgres?
wikipedia
What
It's for wikipedia's API
exactly
yeah this is how you query the wikipedia api (one of the apis)
why not just graphql 🙏🙏
idk ask them
Why in the fuck

Just webscrape at this point
Scraping wikipedia also sucks
prob slower
you could download the wikipedia archives and convert them to a real db ig
tim wanting to make everything himself 🧌
@_@
im just trying to get as much as i need from a single request
so i dont need to do a shit ton of reqs
also, some queries are not possible in other apis
for example queries that use wikidata properties, like get all pages whose property X equals value Y
Made a very shitty stepper component
Not even a component
just slapped it into the page itself

Can I sees
I am telling you it is absolute dogshit
and wouldn't be how the end component would look
but its a proof of concept
It doesn't save state from previous steps either
soooo
Oh I meant how it looked
Thankssss
tsk tsk, using regexes to validate whether something is an email.
lol, I was trying to do a funny sorry
Also, it's not really that slow
But I'd mark it in a real code review
Indeed
Its not about speed, its about correctness/maintainability.
What other methods are there to check if something is an email? Cause even things like zod and yup use regex under the hood afaik
parse it character by character using the official spec; its actually not that hard
Math.random 
(or just use a library like most people probably do)
I mean yeah most people use zod or yup for that kind of thing
but they also use regex
I wouldn't use one that used regex though but w/e
Not many don't use regex, its easy and not terribly slow. Also for maintainability I dont think the email spec changes that often
aaand github went down when I tried to look at the regex they're using lol
I'm actually wrong lol, the html5 spec literally provides a regex for this use case 🤣
<---- suffering from PTSD about regex-based validation mistakes in the past
I think the best is regex for client side validation and then use email confirmation
So it has to be what could be a valid address and then their actual email/an actual email
Yeah; my (wrong in this case) nitpick is that if you're writing a validator for something, the first instinct of reaching for a regex is probably the wrong choice for non-trivial tasks.
Normally yes, but for my case no
I don't need to any actual email validation
I simply am doing a pre-check to make sure their email domain is valid before letting them proceed
I love just using a character by character parser for the dumbest things
Saves both me and them effort & time
I used one for {user_id} -> 382938 etc
I wrote that in pure typescript types smh
type GetPlaceHolders<S extends string> =
S extends `${string}{${infer W}}${infer RE}`
? [W, ...GetPlaceHolders<RE>]
: []
type Options = GetPlaceHolders<'hello {user}, how are you {day}?'> // 'user' | 'day'
(well close enough)
How tf
its not really complex
its just pattern matching
${string}{${infer W}}${infer RE}
matches *{*}*
the content inside {} gets extracted into type var W
and I just add that to the array, then take RE (rest of string on right) and run the same type again
recursively
this is also useful, turning a record into a string union
I've never really touched the extreme ts types,chow does that export a string?
Like if I want to send a message using it or something, bc usually js message.send(interpolate("hi I'm {name}"))
y'know the fun part about logging command usages to see what would need attention for optimizations and such is that I can see when the bot got reviewed from the sudden influx of commands that never saw the light of day
thats some advanced ts fuckery
Believe it or not thats considered basic /j
i'll never do that kind of stuff because i use jsdoc
it doesnt support more advanced things :^)
Guys
I am trying to get the user's country, should I just have them supply it or should I get it myself
if its a form, use a select menu
I can get it via a form yeah just wondering what's most convenient
usually a select menu is the standard way of getting someone's country, unless you need to automate that
like getting it from their ip address or from browser's locale
and since I don't use hosted dashboards I have to supply the country myself for connect accounts
Tempted to make em all US and commit fraud /j

you need to specify the buyer's country?
The seller
the seller?
Yes
like, the website owner
Account owner
or are you registering sellers
yes
I've gone through like 10+ implementation methods and none of them work effectively
Stripe is simply just annoying as fuck to implement
rip
Waiting for someone to either overhaul stripe's api or someone make a better payment gateway cause my god
Solo dev implementing stripe at this scale 
i havent messed with payment gateways yet
but i've had my eye on charbee for a while
ever tried it?
Yeah but sadly what I am doing I have to use stripe directly for
There exists no third party that i've seen that does it
Since I am doing seller specific products and not subscriptions
rip
Wanna know what
Fuck it
I really don't need to make the stripe stuff myself
I doubt users will care if they are redirected to stripe
I can agree with this, watching the progress is soothing to the mind
Have them to select but autofill what it is based on ip/browser
anyone familiar with incendo's cloud command library?
their server's dead, the docs are.. kinda empty, and I have no idea how suggestions are intended to work
Send code so users can help
lemme see if I can find the old code I had for it
this is what I had a while back, eventually killed it because it just didn't work at all
it's probably not even how you're intended to do it, but there's also no documentation on how you should
actual code that also doesn't work
the print statement never goes off, so it's not even running it to my knowledge
the lack of documentation on incendo's part is going to be the death of me
either that or the fact it's 2am idk
damn can't get a response from the incendo discord and talking about it here kills the chat 😔
I am starting to branch my backend out to its own thing instead of using nextjs route handlers. Which has led me to use better-auth's jwt plugin. I am wondering how I can manage this in development though. Since the cookies are not shared between the frontend and backend api due to it being on different ports (I guess?) better-auth breaks since the authentication tokens don't exist on the api's context
Which causes 401 errors when the backend makes requests to the frontend api to get a jwt token and then validate it on subsequent requests to protected endpoints
Actually
I am le stupid

The frontend should be sending the backend the jwt which it then uses to validate
so, how your login flow works? do you login user to nextjs or your own backend? if it's nextjs, you connect your database to nextjs just for auth?
In production are you just proxying the backend like /api -> backend port or something?
I use nginx yes
nextjs handles all the auth and what not.
my backend api is written in C# which I want to protect with the same auth system so i use jwts
Right now any request made to the backend api must be accompanied with a jwt that the backend then validates using jwks endpoints in the nextjs app
Then you can just replicate that while developing either local proxy + backend or you ssh proxy the backend port to your computer
That's fair
I learned i dont actually need to care about cookies here
I can fetch the jwks without any auth cookies
SO I can request the json web key set from the backend and validate the token the frontend sends
Auth usually is going to need cookies, unless you don’t care about XSS attacks
It’s the most “secure” way of doing things
Right
What I mean is I don't need cookies for this instance
Next JS requests a resource from backend by sending a JWT along with the request
Backend sees this JWT and validates it against a JWKS
If valid responds with the appropriate resource otherwise responds with a 401
Initially the jwt is gotten from the cookie on nextjs' side
but what I mean there is no need for the cookie to be accessible from the backend since I am just validating the received token
through cookies header?
Nextjs will get them from the headers yes
await authClient.getSession({
fetchOptions: {
onSuccess: (ctx)=>{
const jwt = ctx.response.headers.get("set-auth-jwt")
}
}
})
When I fetch the session I also grab the jwt on success from the headers
or
I can directly call the /token endpoint with the session token in the auth header
interesting. i'd usually do allow cookies to be sent through each request credentials: 'include' and then the server will receive the cookie and get session from db. but every individual have their own way
The thing is I am not rolling my own auth system
oh
I am using a 3rd party lib
yeah in nextjs right?
Yeah
It handles all the session and shit for me, and yeah I can get it from the database myself if need be, but why do that when I can use JWTs which is a rather common approach
yeah i did that, i used that nextjs auth for discord. when an auth is suceeded, i send to server to create a new session with x token, and then set x to cookie
if it works, it works™
I mean, my approach isn't much different from others
There's so many ways to handle auth
especially between microservices
JWTs just seems to be the most effective
and its built into the lib I use

Little integration on my part
awesome 🔥
Hi I'm trying to build an dashboard (my bot is on discord.py) can somebody give me guides,tips, requirements? This would really help me
get to know html, css and js. Then learn and use fastapi (which is also python and async) as the framework. Use an api instead of websocket.
why fastapi specifically?
there are tons of good frameworks
sure but its one of the best for python besides django and since he uses d.py I assume he knows python well
Django is also very extensive and not beginner friendly at all
If you've never made an api before
well i dont python so i dont know much about their frameworks, but i hear a lot of names thrown around
from what i heard, a lot of people say good things about sanic and flask
Flask is good yeah
Its more beginner friendly than django
Never used fastapi but i hear its pretty well made as well
bro could learn python in a lunch break
He could learn it in 10m
lies
it's very simple, especially with your extensive js knowledge
flask is very beginner friendly but not solid since every request blocks everything due to flask being sync, for the beginning its pretty good but for moderate traffic it becomes a bottleneck. Fastapi is like flask but faster and fully async supported and uses starlete and pydantic.
fixed my missing memory stick 🔥
the issue was a motherboard standoff right below the memory slot causing a short-circuit
lmao almost as much ram as disk
at this point just get rid of the disk altogether and go full ramdisk
you know what would be interesting? an online game (even mc) that has its map roughly connected to people's ip addresses
what
so that people close by irl would spawn close by ingame
and people far away irl would spawn far away
so you could travel ingame to meet people from other countries ingame
in different scales
yeah but have people spawn in the correct place based on their ip address
of course vps could spoof that
but would make for interesting immersive plays
imagine you go on a long voyage ingame, and you arrive in places where all players speak some other language
I mean bungeecord lets you connect multiple servers all at once too
it doesnt need to be a realistic world map, could be a fantasy one
but the idea is to match people based on their irl location
and make them travel ingame if they want to meet people from other countries
what if they just move and stay somewhere else after travelling 5min one time
sure, thats ingame immigration
do NOT use bungeecord, its filled with vunerabilities, velocity is the modern option
imagine you emigrate to ingame's equivalent of japan, so everyone around you is literally japanese people
I just think this wouldnt work as intended
like people would go where they want
and nothing would truly be regional
they are free to do so, but it would be fun
i have some weird ideas when it comes to game dev
yes
another idea i have is artificial ping/glitches
???
the further you travel from your ip-based spawn location, the more laggy the game should feel
:^)
and it would make for a heck of an adventure
venturing as far as you can on increasingly glitchy/laggy environment
xD
im downloading the 21x4.4gb world map now
xD
Finally got Edge Agent to work which means no more open ip/port access.
Theyre edging
huh, do we need to pay to have nested subdomain like x.y.domain.com ?
i'd assume this does not cover nested subdomain?
ah yeah that's right
but it doesnt prevent you from creating them right? it only doesnt cover their SSL
you could still use your own SSL
oh yeah, but it's wont be proxied by cloudflare
so the ip will be exposed
@quartz kindle u dis
Why does this look a bit like a minecraft map? 🤔
(it is a 1:500 map of earth in mc)
EarthSMP
rack done 🔥
xD
how long does it take you to travel the world?
ill need to update my mc stuff
mmm
do you have online=true?
yes, do you need offline mode?
yup
Mmmm yummy
@quartz kindle http://176.100.37.105:25129/
lmao
what is that render distance 🙏
is was 12 by default, i increased it to max (32) but nothing changed
maybe if i reconnect
wait ill increase on server
ip yummy
use distant horizon with this map, will go crazy 🤪
ye i need some graphicsa mods
i g2g take someone to the bus station
ye view distance improved
(not worth it)
xDDD

pl3xmap
bluemap is nice
Love you sharex for trying to generate 80mb of clips
but you have like, parallax
street view aah
yea
bluemap did around 500cps on this map
which wouldve taken 1 day
pl3xmap did 17000cps
topdown only though right?
understandable then
cat enslaving room btw, for teleporting players back after rejoining
builder.Services.AddAuthentication("Bearer").AddJwtBearer("Bearer", opt =>
{
opt.Authority = "http://localhost:3000";
opt.Audience = "https://localhost:3000";
opt.TokenValidationParameters = new TokenValidationParameters
{
ValidateAudience = false
};
opt.Configuration = new OpenIdConnectConfiguration
{
JwksUri = "http://localhost:3000/api/auth/jwks",
};
});
Was hoping I could just do this
but apparently JwtBearer can't handle the JwksUri thingy
that jwks endpoint returns a json response in the jwks format
unrelated, but if you're still having issues with stripe I just found this: https://github.com/t3dotgg/stripe-recommendations
Oh yeah I know of it
Basically just keep local cache and stripe synced
Didnt need an entire github repo on it
ah fair, i just knew you were complaining about it and I didn't know if that helped at all
does smb know how to create such a bar chart breakdown with grafana?
I have this rn, but I want different color section thingies depending on what language was used
ramdisk 🔥
Run status group 0 (all jobs):
WRITE: bw=32.9GiB/s (35.3GB/s), 32.9GiB/s-32.9GiB/s (35.3GB/s-35.3GB/s), io=32.0GiB (34.4GB), run=972-972msec
nice
does this look good for our locked access modal
zip 🙏🙏
#[inline]
pub fn zip_entry_get_modified_time(
entry: &zip::read::ZipFile<impl std::io::Read>,
) -> Option<std::time::SystemTime> {
for field in entry.extra_data_fields() {
if let zip::extra_fields::ExtraField::ExtendedTimestamp(ext) = field {
if let Some(mod_time) = ext.mod_time() {
return Some(
std::time::UNIX_EPOCH + std::time::Duration::from_secs(mod_time as u64),
);
}
}
}
if let Some(time) = entry.last_modified() {
if time.is_valid() {
let chrono_date = chrono::NaiveDate::from_ymd_opt(
time.year() as i32,
time.month() as u32,
time.day() as u32,
)?;
let chrono_time = chrono::NaiveTime::from_hms_opt(
time.hour() as u32,
time.minute() as u32,
time.second() as u32,
)?;
return Some(
std::time::UNIX_EPOCH
+ std::time::Duration::from_secs(
chrono_date.and_time(chrono_time).and_utc().timestamp() as u64,
),
);
}
}
None
}```
put the muted text below the title and bot next to it
i kinda did that on our password locked modal just gotta carry it over
i would put the icon on top and the text under it
or if you want to leave it next to the text, make it a bit smaller and closer to the text
another option is make the icon bigger and put the smaller text together with the title, left aligned under it
i need to find out why the text is so far down
which text?
"Support"
Vertical alignment messed up
Hey quick question so I tried using firebase as a database everything is set up correctly the rules on firestone the code everything even put the code into google gemini lol and it even said it’s correct the error i get when i code my bot with firestone is
“Firestone SDK error no persistence storage is available people download “pip install firestone-admin” but it is installed i have done it 3 times lol anyone know any fixes i also uploaded my crash log from firestone to google gemini and it even said it should work so it might be internal
are you trying to use the offline access feature?
check with dev tools? xD
I’m assuming no but also have no idea what that means im like 6 days deep into discord bot coding
then i assume you dont need it, you probably need to turn it off somewhere
When you initialize Cloud Firestore, you can enable or disable offline persistence:
For Android and Apple platforms, offline persistence is enabled by default. To disable persistence, set the PersistenceEnabled option to false.
For the web, offline persistence is disabled by default. To enable persistence, call the enablePersistence method. Cloud Firestore's cache isn't automatically cleared between sessions. Consequently, if your web app handles sensitive information, make sure to ask the user if they're on a trusted device before enabling persistence.
Ok my bot is a web app only so then it should be off
give me one second I can send you a screen shot
Also I meant firebase not firestone lol dont know if you knew what I meant
Not home rn lmao
this is my firebase rules and the error
When I run pip install firebase-admin it shows I already have it installed
you shouldnt need the admin sdk
if I remove that then I can't have firebase as my data base correct?
how do you initialize it in your main py file?
you are swallowing the exception and returning your own exception, so it doesnt show what the actual error is
so i should remove both the line of codes of print
remove the entire try: except:
imports shouldnt really be error-handled, as if they error the app shouldnt even attempt to run
better to let it crash and let it show any import errors
hmm
idk how else I should design it
why not
top.gg
I have a custom status on my bot, and somehow it randomly disappeared, anyone else have this before?
your bot reconnected to the gateway so the status was reset
idk maybe
Any solution to the status not disappearing like that?
just set it again
got a question though, what font are you using for "on" and ".gg"?
thanks!
depending on the lib you're using, you can define a "default status" at login
what the f
ye
on a sidenote
I have a genius idea for an archive format
streamable and indexable
by splitting it into many smaller indexes that are written every 4mb for example
to get all files, you only read the indexes
though this already sounds cruel to implement
are you sure its "only" 4tb?
that seems quite small actually
even if its 1000x smaller, its still 510tb
well I will see ig
lmao
hm
inb4 your computer explodes
or I just scan directory before writing data
then I can append an index at the start
in the order the data will be written
brb grabbing food
Imagine 2b2t on a 1:1 scale world map
it will not fit in 4tb
region files are compressed with gzip by default, so you'd wanna switch to something a bit better with space to even attempt that
i.e. zstd
I have a question
You didn't say what the question is
classic topgg
I have many questions
to ask or not to ask, that is the question
Tune in next week for the exciting question!
To do schoolwork that is due today or not do school work thats due today, that is the question
Just do it while it's being collected
gaslight the teacher
tell the teacher that you’re going to submit late and proceed to submit on time
1/10
good
8/10
The UI looks good, I'd suggest to add more pages.
there isnt much more to add
i updated it
small things
but i dont know what to add
since its just a bot
take a look at 2nd and 3rd link in my about, you can try making that.
haha, no issues
I need help in deploying my bot on Heroku. I have command that requires the user to unlock it by voting for the bot on Top.gg. I am using topggpy and discord.py for the bot.
The bot works perfectly when I deploy it on my local machine and expose it using ngrok custom domain. The bot receives Top.gg requests normally.
But on Heroku, when I try to use it's custom domain provided by Heroku, it doesn't work. What can be the reason.
I asked AI and it wants me to make a flask app and receives requests from there, but that still doesn't work.
do you set your own port or from env?
I have set my own port.

It worked! Thank you so much!
What can be the reason? Why can't I specify the port on Heroku? 🤔
glad it worked. well the reason can be heroku only proxy to the port they pick. if heroku proxying to port A and your webserver is at port B, then it wont work
hey, so i cntinosuly spawning my python process in but its so damn slow to startup and exit the model.
I read that we can keep a python worker open, but to be fair, what are the downsides?
Won't the worker block concurrent requests from multiple users? It's basically going to sequentialize my code..?
run py and your program, and communicate? like using grpc or else
py acts as micro service, it runs on its own
if the worker can only process one request at a time, then you need multiple workers and rotate them
can't we aprallelize the requests somehow
I'm just gonna say I hate discord buttons on discord.py and they make no sense on why they need to be split up into 4 entirely different sections.
I literally can only do buttons through chatgpt and how do they get it to show your local time using that <t:1060002345:f> discord time stamp without it looking highlighted in an embed?! I saw that somewhere. I might figure that out eventually.
it depends on what exactly your python script does and how it works
if its cpu-intensive, probably not
if it does a lot of i/o (disk/network waiting) then probably yes
in general, cpu is always blocking, i/o is never blocking
cpu needs parallelization/multiple workers, i/o can live with using async in a single worker
since when we can't use custom emoji in footer?
You have never been able to use any kind of formatting in footer lol
BotGhost is going through the same thing as Shapes now, only it's about tokens xD
wait really?
Oh lol
Discord has issued BotGhost with a formal breach warning and given us an ultimatum: find a completely new way to operate without using bot tokens by July 14, 2025, or the platform will be shut down. The catch? That alternative does not exist, and Discord has offered no guidance, no support, and no path forward.
Yea, I just went shopping, came back an hour later and everyone is talking about it on ddevs
Funny meme ngl
just my curiosity but does this mean none of these bots will be accepted here anymore? I mean since now they're offline because of this announcement 🤔
We'll see how it goes. BotGhost wants to fight Discord instead of voluntarily changing its system, so it seems to me that soon it won't be possible to create them at all
Most of these bots were not accepted on top.gg anyway because they used "public commands" that were not made by the bot creator
So it won't be a big loss for top.gg (and for the entire bot development community as well)
good point, thank you for explanation 
Oh god wtf Shapes had it coming because they did shitty things and message content but now botghost wtf?
I think Discord is overreaching with this token use policy now and it seems like they gave barely any notices or information other than a giant fk u slap it seems.
It's possible that these two situations are related and Discord simply doesn't want users to give their bot tokens to third-party services because users are still responsible for what their bot does even if it's not hosted by them or uses someone else's code
Apart from the recent BotGhost drama where people managed to compromise dozens if not hundreds of bots and get their tokens
the problem is the one point of stress
if all those tokens get breached, depending on scale
the sheer amount of user data that can be retrieved is insane
@solemn latch scam
wow
Likely spammer 😔
whos the scammer
hey im need of hackers and spaamer as friends, lets work and break bread
lmao
@harsh nova go bake him a ban
zip multithreading 🔥
ye
looking pretty 🔥
had to use this "sketchy" thingy
use std::{
fs::File,
io::{Read, Seek, SeekFrom},
os::unix::fs::FileExt,
sync::Arc,
};
#[derive(Clone)]
pub struct MultiReader {
file: Arc<File>,
offset: u64,
}
impl MultiReader {
pub fn new(file: Arc<File>) -> Self {
MultiReader { file, offset: 0 }
}
}
impl Read for MultiReader {
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
let bytes_read = self.file.read_at(buf, self.offset)?;
self.offset += bytes_read as u64;
Ok(bytes_read)
}
}
impl Seek for MultiReader {
fn seek(&mut self, pos: SeekFrom) -> std::io::Result<u64> {
self.offset = match pos {
SeekFrom::Start(offset) => offset,
SeekFrom::End(offset) => {
let file_size = self.file.metadata()?.len();
if offset >= 0 {
file_size.saturating_add(offset as u64)
} else {
file_size.saturating_sub((-offset) as u64)
}
}
SeekFrom::Current(offset) => {
if offset >= 0 {
self.offset.saturating_add(offset as u64)
} else {
self.offset.saturating_sub((-offset) as u64)
}
}
};
Ok(self.offset)
}
}
because the zip lib only seeked once to the start of the entry
which then obv got overwritten by another thread
so this implements a fake seek that simply stores an offset and uses unix reat_at
@harsh nova the profile picture...
?av
💀
Omg..
ended up making an endpoint system for a ws like express.js routes
also each client is assigned an id and a token, to even make a request on that ws you need to supply the ws client token :}
like this
ncice
when the WS connects you get this
the server then decrypts it and cross checks it
is this safe/secure though?
avoid using deprecated methods but I don't see an issue with it, but people like tim and others will know better than I
?
I was thinking if this was consistent
but since you don't need to decrypt through restarts it's fine
oh well it kinda does now 😭
if you need to decrypt through restarts like, something is encrypted, restart, needs to be decrypted then you shouldn't generate a random secret and should instead store one in an env
each time a client disconnects and a server restarts the clients token is wiped and reset
are you encrypting websocket messages on the client side?
i am not no.
what are you encrypting?
the websockets auth token
uh... why?
bc the live chats can contain confidential data that should only be accessed by 2 websockets that need their own tokens
each live chat saves the 2 websocket ids
to even send or receive anything your token needs to be there in each and every single request.
but auth tokens are usually hashed, not encrypted
oh
well im gonna encrypt messages too
encrypt everything
this is the example of one message being sent to a chat
Why did you capitalize chatData object keys
honestly, idk im weird like that
i'll fix it
Since Discord dosen't like token hosted bot services i'm adding my bot creator to Dev Space now so it can be self-hosted 😄
Time to bring it back.
I like it
I had a bot creator a while ago
But it used a custom language it wasn't drag and drop, if i were to make one now it would be
This honestly just annoys me I wont lie
I hate scratch
Hi
I suppose low code/no code stuff is good for kids, but keeping track of syntax isn't the hard part about programming
Finishing your projects is
Looks at python
Does anyone but data scientists and children actually use python?
i used it for robotics 🥺
this
import type { genOgImagePayload } from 'hamoodihajjiri';
export const generateOgImage = (payload: genOgImagePayload) => {
const hyperLogo = { light: 'hyper-color-logo.svg', dark: 'hyper-color-logo.svg'}
return ('https://og-image.vercel.app/' + '**' + (payload?.title ?? '') + '**' + '%3Cbr%2F%3E' + (payload?.subTitle ?? '') + '.png?theme=' + (payload.theme ?? 'dark') + '&md=1&fontSize=100px&images=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Ffront%2Fassets%2Fdesign%2F' + hyperLogo[payload.theme ?? 'dark']);
};
Anyone knows how to enforce a line break w/ Vercel's OG Image Playground? Apparently, <br/> doesn't work...
have you tried \n?
https://og-image.vercel.app/Hello%0AWorld.png?theme=dark&md=1&fontSize=100px&images=https%3A%2F%2Fassets.vercel.com%2Fimage%2Fupload%2Ffront%2Fassets%2Fdesign%2Fhyper-color-logo.svg
I added \n w/ %0A; however, it doesn't work.
I think Vercel doesn't support line-breaks entirely
kinda painful how big caches get even when limiting them, default is like 250 messages per channel and I set it to 10 (max 10 mins old), will prob move it to 0 with a keep over limit
now imagine the amount of traffic discord has to process in general
if you're concerned about memory usage you can probably roll your own cache implementation, caching only what you really need
done.
token is unrelated.
you cant use my system at all.
its locked down.
plus token changes everytime i restart the server.
alr good
aint even a discord bot token LMAO
oh lol
its a websocket request system i made that requries a token
oh i see
finally it works
Watching theos video on just how fucked stripe is, makes it really disheartening to even implement stripe myself 💀
lmao
I sincerely hope someone at stripe does an overhaul of their "developer friendly" api
Its actually very easy
The huge amount of stuff the API have can feel overwhelming but its just that you dont need all the stuff they offer (most of the time)
With 1/3 of it being either "depreciated", having different refrences/names or just weird json overall 
Have fun
Make sure to keep signing in to the developer portal every 15 mins
and then get randomly captcha'd every 1/5 chance that also breaks on firefox
Very easy? You must have not used it at all then
Because it is anything but easy
There's a list of problems that theo outlines that still hold true to this day
that's just awful with djs..
I am using it for many projects, what are the problems you are facing? Also the Stripe Developers Discord server is pretty useful, they usually respond within 5 minutes
yeah I know. node in general is heavy on storing objects. I don't know what the default caching impl does off the top of my head, however it probably does cache data you don't need. the less fields the better
I already try to limit cache sizes a shit ton, but I do have like 100mb of permission overrides per cluster alone
and I'm on bun with JSC rather than node with V8 but yeah still heavy
I use roughly 5gb with 19k guilds rn
What exactly are you using persey
Mostly billing & checkout features
Right so you aren't doing too much, that's not as annoying as its other features
When you have to start keeping track of a multitude of data that stripe is not reliable at giving you
It gets tedious
Like what
checkouts, subs, products, connect accounts, and the webhook events that go along with it that are not sent in sync
You can receive those events out of order, and its up to you to decide if they are even valid events or not
Since not all of them send with "complete" data
or "valid" data since stripe uses temp data in cases where stuff doesn't exist yet and they themselves create
Oh I see what you mean, I agree that having to fetch datas because some webhooks are just empty is annoying but for the webhooks not coming in sync, its often because you failed to acknowledge them so they have to be retried and if Im right you can just use the timestamp to "validate" the data
Not always
Stripe literally just doesn't send them in order of whats happened all the time
Oh really, thats weird I never noticed that with any checkout or subs event
I mean yeah
but anyway I guess you can just ignore them if the timestamp isnt right
There's also the fact stripe will not stop 2 sessions from occuring at the same time
You can create two checkout sessions at once
Its up to you to stop that
I mean, I do not know how you handle it but that sounds normal
No, it shouldn't be normal
You shouldn't be allowed to create two checkout sessions at once for the same person on the same order
Also it wasn't until recently that stripe allowed you to limit subscriptions per person.
So before you had to do annoying checks to see if a sub was still valid, or if they already had one, etc etc
I agree there should be an option to limit it like you can limit the subscriptions but it sounds better to let people have full control over the sessions and so make it up to you to manage the sessions as you wish
What would you realistically need control over?
I dont know but you can imagine for a big e-commerce websites that you have many different sessions and you want to handle which session to restore yourself
Usually websites will do a cart session based on the local storage
I see, but both ways can probably make sense
The biggest issue I encountered recently with Stripe is that you CANNOT customize the invoices issued from Sessions based on information that Stripe collect (like customize the invoice based on the VAT/TAX collect)
And it just sounds so dumb when you see all the features you have with invoices and this basic feature is not even available
Not quite sure I follow this reason, there's no way of restoring a stripe session, you have to make a new one if the original one fails.
Pog got it working again, had to transfer the 2 year old code and redo the UI
So i created a webUI that every second generates me a new unique B64 code. The code is based on a mathmatical equation and multiple object positions. What do yall think?
What's the purpose?
It will be used as a encryption key in the future
Anyone ever use yt-dlp?
I am using it ```ts
function getAudioUrlFromYTDLP(query: string): Promise<string> {
return new Promise((resolve, reject) => {
const process = spawn("py", [
"-m",
"yt_dlp",
"--quiet",
"--no-warnings",
"--no-playlist",
"--default-search",
"ytsearch1:",
"-f",
"bestaudio",
"--get-url",
query,
]);
let output = "";
let error = "";
process.stdout.on("data", (data) => (output += data.toString()));
process.stderr.on("data", (data) => (error += data.toString()));
process.on("close", (code) => {
if (code === 0 && output.trim()) {
resolve(output.trim());
} else {
reject(new Error(error || "yt-dlp failed or returned empty output"));
}
});
});
}
do you want only the url?
its likely downloading the entire video
--skip-download Do not download the video but write all
related files (Alias: --no-download)
Also, if this kind of thing is going to be done frequently, it'd probably be beneficial to actually do this in python and expose some kind of api through like HTTP or some kind of IPC since compiling the regular expressions every time for ytdlp is really expensive at scale
I'm surprised there isn't a native node port of ytdlp 🤔
i have a bunch of possibly-null fields that i want to conditionally assign to fields on this
what's the most efficient way of going about this? i don't think i can use nullish coalescing because the right hand side could be nullish too
i came up with the below but i'm not sure if there's a better way to do this
withConfig(config: IConfig): CommandBuilder {
this.duration = config.duration ? config.duration : this.duration
// ...
return this
}
this.duration ??= config.duration, would this not work?
Ah
i suppose... if it's already nullish it probably wouldn't matter actually
hmm
if it breaks i'll be back
I usually do this.duration = config.duration ?? this.duration iirc
hmm alright
well
the thing here is that all my fields have default values
i think the above would work
yeah
thank you
lol i haven't used node in years
If config value is provided it’ll override the default, otherwise it’ll stay default
Null coalescing operator is quite nice
So would having a native api written in python be the better solution? I mean it makes sense im just not the brightest
doesnt really matter as yt-dlp is designed as a cli program, not a library
welp, run it through some kind of profiler and see whats taking so long lol
How would I do that? (this is the first time i've ever had to deal with something taking this long)
add "profile" to your options
python -m profile script.py
const process = spawn("py", [
"-m",
"yt_dlp",
"--quiet",
"--no-warnings",
"--no-playlist",
"--default-search",
"ytsearch1:",
"-f",
"bestaudio",
"--get-url",
"--skip-download",
query,
]);
``` Would it go after -m?
actually idk, since it uses some kind of profiler you need to install separately
Looking at other uses the only thing I can do is deal with it
every reccomendation to make it faster I already have in place, like chunking for streaming
just a thought - you're running it through python right? starting up the python environment might take some time - it shouldn't but maybe it does. try running the compiled binary
not really much change
I tried seeing if I could use invidious but no public api seemed to work
toy around with it 🤷♂️
I'd try running it myself in a terminal, without the quiet parameter. see the logs and go on from there
it might just be your network
alternatively you could try node packages that do the same thing, I found this https://www.npmjs.com/package/yt-search
seems to be what you're aiming for
https://www.npmjs.com/package/yt-stream or even this. this has parity with ytdlp
i feel like i'm going crazy
okay apparently it's not empty
cries
i was going crazy
might've been a cosmic ray bit flip 🫢
damn~ i haven't seen you for a while
i remember your help back in 2021 :)
web dev is so nice when starting out, but then always turns into an unmaintainable clusterfucking headache
dozens of scripts, components, hooks, routes, backend functions and all that crap for just a handful of actual webpages
Depends how well managed the codebase is, what you're using and how you're laying it out
anyone here know how bot page html works?
well, i am first timing svelte, but i've gotten the gist of it
its just every time i work on web dev, complexity grows way more than expected
lmao
what code are you putting in? you can show here
so yeah whats the problem
get rid of html,head and body tags
ah i see
so you need to keep that in mind
you can use dev tools to check the html structure what wraps around your content
and adapt your css rules for that
👍 where can i find that
browser dev tools / inspect element / F12
np
Earlier I had an almost 2000 line css file, it was fun to break up into 4 smaller css files
lmao rip
im trying to wrap my head around reusability, i always think how i can reuse things, so i make them into components and stuff, but then i always run into situations where my existing reusable thing doesnt quite fit the current thing, so i have to either make a new thing from scratch or edit the existing reusable thing to make it fit in both cases, and then edit all existing implementations of thing to account for changes
lmao
lmao
for example, i have a component for forms
it works nicely for all login/signup/resetpw/etc pages
but now im implementing a user profile page, where they can edit their username/password/profile/etc
and the form component doesnt fit there
because its totally different, both layout and functionality
but both use forms
i never make form components, i make components used for forms, buttons, inputs, confirm inputs, different types of validation then make the forms seperate using them
yeah i go too deep into reusability and then i get fuged
i do that too though so i get it
Like i have a renderTrack component that can be used in 2/5ths of the places where I render tracks
yeah i hate when that happens
my brain craves organization, but things always run out of control
then you enter the endless cycle of refactoring xDDD
o h
Welcome to component hell
-# It's actually pretty organized
Why is that single one UpperCase 
PascalCase for React components, kebab case for Vue components 🙂
Actually no
Maybe you’re right idek how to name shit
see
Literally been doing web dev for a living for the past year and still don’t know 🙏
what are you having problems with
I usually use PascalCase but sometimes snake_case but also like Track.tsx i hate but track.tsx i like
its just not rendering or smth
I use PascalCase for components and camelCase for hooks
Maybe the stylesheet or some other request is not loading or loading wrong data?
show us your css your using
Send it here
dont flame me but this is cursor 🔥
Is there a link too?
Fair, idk what the standard is
i dont know how to do frontend
yes
Holy CSS hell
lmao
yah i dont understand any of it
i believe you can only use css, and markdown
does this use smth else
😭
Javascript and html
i already told you to remove the head/body tags lol
didnt change anything
you cant have css + html?
well, its still one step towards the right direction
you can have css/html, but you cannot have <script>
true i guess
ill try
ahh i didn't know about html or not
accessibility 100
heres an example of how it should look like
there is no head, no body, no anything else
its only one <style> and then raw html
and all css rules start with .content
alright thank you sm
because .content is the top.gg element where your description is placed
here is how it looks like when rendered in top.gg
that's what we've all been telling him
@_@
how do you learn stuff like this 😭
experience?
i've been doing shit like this for 10+ years
jesus bro is old
tell me about it...
im literally twice the age of many people here
hey hey! I recognize your name but I don't remember much. 2021 was a rough year 🤣
ahh I love c# but god damn is it a nightmare for frontend, at least it was every time I tried to use it for frontend
You are not 48 right?
It was ;) - I hope you’re doing well.
lmao, not yet
hey all
me again
is there a way to avoid exporting a single method from a class?
export class Shocker {
// ...
static NewInternal(username: string, apiKey: string, id: number) {
let shocker = new Shocker(username, apiKey, id)
let url = new URL(WS_URL_BASE)
url.searchParams.append("Username", username)
url.searchParams.append("ApiKey", apiKey)
shocker.brokerUrl = url
shocker.socket = null
return shocker
}
// ...
}```i've tried doing `module.exports.Shocker.NewInternal = null` but surprisingly mixing cjs and esm like this doesn't work i wonder why
it sounds like an xy problem because it probably is one :clueless:
without static, you can do #FnName(...) and call inside the class using this.#FnName()
not sure with static
doesn't seem to work unfortunately
it's not the end of the world but it would be nice to have
oh my bad im wrong
hehe oops
wdym avoid exporting a single method?
private but within the given file instead of just within the class
the only way to do that is to put it outside the class
yep
revolutionare
i'm so smart
huehuehue
i wrote my first node library in ages
it rocks
i love using rust design patterns where they weren't supposed to be
i love that node doesn't have a borrow checker
yo guys, is there somebody here who is looking for/building complex economy bot
i'm sure there are hundreds
oh but i do really mean complex
I mean, essentially everything is just wrapped in an Arc
but it's even more flexible than that
how many of them are on chain on their own blockchain tho 🤓
i'm sure there's at least one
if u want the same then its Rc<RefCell<
mutable shared variables
on a single thread
kiiiiiiinda
Node doesn’t have a borrow checker but it also allows you to shoot yourself in the foot
i love having the power to do that
hey tim, did u know, sqlite doesn't have types
yes, they have "hints"
perfect for js
no better duo
Hey.. so we failed to account for almost everything and all our systems collapsed in on each other and we gotta restart, we made the mistake of coding other systems before vital systems. What should we start with?
more context?
Our website, API, Livechat System, Everything broke
we dont know where to restart and what to focus on...
broke how?
failing to work with each system, can barely intergrate with other systems, code is hard to update without errors leading to downtime on production server
and the fact the each system has its own database (which im seeing now was a very bad idea)
well, a lot of things could be learned from that, without knowing more details its hard to point them out, but you should be able to see many areas in which you can improve and do different now
one thing that comes to mind is that exposed interfaces should rarely ever change
for example if you have two systems that talk to each other via messages, even if you need to change them completely inside, the messaging interface should never change, if possible
so that changes in one system dont require changes in other systems
having multiple databases is not an issue as long as you have cascading effects implemented
ie if db2 data depends on db1 data existing, on db1 delete immediately delete from db2 as well
if they are all hosted in the same system, consider using tables instead
i think im gonna switch over to a central database
what sucks is i've been working on all of this since june of last year... :{
welcome to refactor hell
what should be mainly focused on first, we ended up creating the article api before the login api should we focus on user systems first before others?
elixir type guards in js 💪
that depends
if you want to launch as soon as possible, create the content first and launch it
then slowly implement automation
we wanted to launch last month 😭
rip
but my bloody COO/CTO just stopped doing shit...
rip²
lol
10th grade graduated
wow you're in high school?
Me wait 2 weeks for my api
So i run every command smoothly
- antinuke
And whitelist stuff lol
idk, German system works differently
ohh i see
8 databases..... wtf....
i wonder will that much databases is actually better than only 1
On the brightside even major devs cough hytale fail in all kinds of epic ways with all the resources and money they need.
Having 8 databases though in 1 big system is shockingly amazing and cursed
Each database also stores data differently 😭
so i gotta make a set standard
No way who could have guessed that
don't vibe code
biggest advice I can give for making large systems
AI is alright to use every now and then for things that don't matter that much, but don't let it dictate large portions of your code
If you need reliability, LLMs don't provide it
I can see a lot of places in the app I work on for my job where AI was used and it created less-than-optimal solutions
can you share the list of databases you use and what you use them for?
maybe there are things you dont need in there, or things that can be combined
it might also be worth mentioning that using nosql databases can be tricky
I don't vibe code... why do you keep saying that I am???
From what you've posted in here it looks AI generated
waffle..
don't make assumptions without proof.
he only posted AI gen coded web stuff i believe not database?
Although tbh doing it that way does indirectly lead to multiple databases lol
I only created separate databases because at first I didn't wanna store account data in the main db for articles
and other stuff
livechats even have their own db for that reason
but i realized what i can do now to be able to store them all in one
I mean I'm assuming that this also tends to mean that AI is used for backend as well 😉
I will admit in the past I used AI 99% of the time but recently have been moving away from it as it lead to nowhere and broken code....
And for what it's worth, I'm not trying to bash you for it, I'm just trying to give you advice for improvement
I had a phase where I was using AI quite a bit
Then I realized how terrible it was after a little while
Real
I will be honest again... a tiny bit of our CSS is AI
I genuinely didn't believe I still knew how to code until my AP CSA exam, and the practice for it because I had gotten so bad with it
I mean I've seen some screenshots of stuff you've posted that I can tell was AI generated or at least partially
It's not a personal attack, I'm just saying to use it with caution
I didn't wanna say it because I felt like i was gonna get judged....
I think it's good for helping you optimize certain things, help with implementation of an algorithm, or vibe coding a simple like one maybe 2 page site you need
I think that it's okay-ish at solving niche issues that are difficult to describe to google
Or at least being used as a "rubber duck"
It helped me get the implementation for the algorithm to check it a 15 puzzle scramble is valid because I kept reading the algorithm description and was confused, but then after I understood it from the code it gave I created a more optimized solution but I don't think I couldn't have gotten there without it making the first version
I spent 3 hours trying to fix a really dumb bug so I just asked it to fix the bug bc I was fed up at that point..
it also kinda explained some more things to me and also why im now on ESM :}
The primary issue with AI imo is that it just turns off your brain
it made me stupid...
almost as stupid as webster running rm -rf on his vps...
Programming is 85% critical thinking skills
But the algorithm for 15 puzzle is stupid
There are times where it helps, but I do think that the biggest issue is that it encourages you to offload your thoughts to a machine
And at the very core of a good software engineer is the ability to work through issues by thinking about them
I tried so hard that algorithm was stupid
I understand it now, and could implement it myself but before I couldn't
I also like when I try to get AI to do something and get fed up with it taking so long I just do it myself
- Support Database - Just stored tickets and agent accounts as well as Support System API Keys,
- Website Database - Stored User accounts and Articles
- Development/Testing Database - Used this during the API Rewrite
- Livechat Database - Stored Livechats
- Survey Site Database - Stored out Survey's and responses (WILL BE STILL USING)
Yeah this really shouldn't be separate databases
These should be separate tables within one db
im leaving the survey one seperate bc the CAO is in charge of the survey stuff
the rest im doing in a main DB
That's just overly complex for no reason, you don't need a separate database to work concurrently
(This system is also in production and is currently storing responses needed for reports)
Do you have Prisma experience?
No.
Separate databases are more warranted when you have services that don't need data from multiple dbs, and are completely independent of one another
well the survey db aint even interacting with the main site 💀
its own its own site
on*
Still, if it's tangentially related, you probably don't want a separate db


