#development
1 messages · Page 275 of 1
Is that discord rate for premium bots?
not bad, just under $1 when you add the $3 to the user's ai use.
Cause 30% is high
its the 15% growth tier fee + 6% payment processing fee
You only get charged 30% when you are over a million dollars at which point, are you worried about 36%?
Oh lol
yeah lmao
still a lot given we provide all the services at cost to us at that point and most bots only charge back what it costs to use those features
before this the £5 was the total amount of ai cost you could use.
now i have to cut it to £3 to account for the discord fee
And that sucks because I still wanted to charge the same on the website and give the same amount of credits, but cant as that would breach discord monetization policy
Ye
I mean, its all the same to me, but sucks for my users as they just lost £2 of credits and thats a lot.
Well does it have to be after percentages or could you show a flat rate of 5 dollars
the amount you select is $4.99 you cant do whole round values
And then do 4.99 on the site?
and then I can only let users use the amount of money I get from discord else I lose money on ai cost.
If you show 4.99 on both, you would still be profiting from site. No one uses the discord subs
oh the prices will be the same... but i cant offer users $4.99 of credits for ai on the website and only $3 of credits on discord.
Flat rate of 3 then
which is what sucks about this policy because the users lost a lot of credits
You could profit 2 towards server costs and stuff
my other projects already pay for the servers i use... i dont have those costs anymore
and the most expensive functions are done on cloudflare workers and i have a deal with them
How many bots do you own that generate revenue lol
1
Dang
I make SaaS apps.
Oh that makes sense if ur deploying on cloudflare
i have an ai chatbot website that makes enough to pay for the servers for it and my bot
Dang lol
no? the bot is on linode... the api is on workers lol
I use cloudflare for their d1, and r2
linode is cheap af too... $5 a month for a server that will happily run a discord bot in 100 servers
i think the most expensive server I have with them is $15 a month for a self hosted redis server and then a $10 a month server running postgres
I host my own cause an old laptop works quite stellar lol
so $30 a month to host everything i need comfortably.
Nice. I pay 0 a month rn. Cloudflares r2 handles anything between the site and bot and then the bot has a local db for everything else
ye the cloudflare free tier is super generous
And then my site is on vercel free hosting
I havent had to pay anything for the 5 apis on it yet and one of them got hit hard the other day
still 0 cost.
ouch, i tipped over into having to pay... thanks to someone spamming my chat app.
am I using cloudflare from temu or something
prolly
I only had problems with workers and d1 especially
lmao
Oof. I dont think I've ever seen vercel talk about charges
oh workers is updated like daily
over 5h downtime per month on d1
it was $1 lol, my usage tipped over my limits so i had to pay for the excess load.
yeah I did switch away a few months ago
best decision for my project
response times went from 500ms to 89ms
For d1?
d1 is a database right?
500ms is crazy
just go to upstash
yes, d1 is a db
or neon
Yes
I just have my own pg replication setup with 6 nodes now
Odd it was 500 ms for a db
more expensive yes, more reliable, yes
Mine is almost instant for dbs
hell prisma have their own postgres stuff and accelerate is really good to use for speeding up apps.
prisma has also been pretty slow in my experience
im migrating all my apps to use prisma accelerate for speed.
Actually
switching from prisma to drizzle was instant 50ms gain
I think d1 is probably slow
(for some queries)
not all obv
but most did improve
I dont do much besides update server stuff and commits
and prisma with accelerate is faster than drizzle.
I mean I do use drizzle for db migrations because my project has tons of tech debt still in ts
go fits me better as I am a typescript first dev
and im not rewriting another 100k lines
ye f that
ive been debating go for api... whats the comparison between a rust api and go api~?
well, go is a lot simpler
you dont need to worry about sharing data etc
it does most locking/sharing for you
(like ts)
Thats h
in rust, everything is explicit
yeah go and rust are close
for an api likely pretty equal
might have a smaller memory footprint with rust but not that big of a diff
which one does cloudflare workers support? lmao
workers is v8 so I hope so
its not node, its not rust or go... its something inbetween
v8 is the runtime used by node
ye
I might just stick with ts for now, speed isnt a huge issue currently. But if my bot blows up when i add it here... I might have to rewrite the api in rust or go
shid... rust it is... F.
I wouldnt recommend rust on a worker though
unless you are doing heavy cpu-related stuff
ye it seems typescript and javascript oriented
because rust workers are not that much faster than a js-based one
(rust workers use js to run)
ts and js are being reworked into a go runtime
So workers might have to update soon
oh shid right... it all just goes down to plain minified js anyways
i stopped using js entirely for ts that i forgot ts isnt its own language, its just typesafe js lmao
Yea i call bs on that 10x performance unless typescript really fked up something
nah you can test it yourself
the "compiler" (transpiler & type-checker) is 10x faster
writing a parser and type-checker in js was not a good idea
werent they gonna port it to c++ before?
I mean if that's the case then they are just admitting javascript is slower xD
yeah? nothing new?
pretty obvious
compiled vs jitted
c++ would be a rewrite, not a port sir
go and ts are very similar so most code is literally copy pasted
so they can preserve the same parsing jankiness
i mean, thats the definition of porting
rewriting would be writing from scratch, aka different from the original
Time to code break things :>)
nothing is impossible with enough time and dedication :^)
arrrr so close to <100ms
does it need to be <100ms
I'm currently hosting a NextJS project on vercel using authjs with a mongo adapter.
I'm running into an issue where frequent session revalidations are causing rate limits on my mongo cluster.
Does anyone have a reasonable solution. I've considered self hosting, JWT, or upgrading the cluster but i'm not sure which solution is more appropriate.
Thanks in advance :)
Damn and i thought my 30ms results were slow...
caching
put a redis infront of the db calls.
will also speed up your performance a little bit
yeah
ive done everything
but filtering through 2mil rows is still pretty slow
Did you give it a better cpu, more ram and a 5090?
You need you one of those chtgpt servers
yes yes
i think its just a cool 100k for that gpu they use in one server lol
im still tweaking clerkXdiscord link and then passing the data to my backend to monitor user plans
because I forgot a user can have an account without being logged into the dashboard.
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
}
enum Plans {
FREE
PREMIUM // 0 premium server included. 500 ai messages a day.
PREMIUMPLUS // 1 premium server included. 1000 ai messages a day.
PRO // 3 premium servers included. 1500 ai messages a day.
}
enum LogLevel {
MINIMAL // only moderator commands like ban and kick
MEDIUM // included deleted messages and join/leave
MAXIMUM // include edited messages and user updates (username, role etc.)
}
model Users {
id String @id @default(cuid())
username String @unique
email String @unique
extId String? @unique
discordId String? @unique
plan Plans @default(FREE)
Limits Limits?
premiumServers Servers[]
}
model Limits {
id String @id
date DateTime
aiUsed Int @default(0)
aiLimit Int @default(20)
premiumServers Int @default(0)
premiumServerLimmit Int @default(0)
user Users @relation(fields: [id], references: [id])
}
model Servers {
id String @id
name String
ownerId String
isPremium Boolean @default(false)
premiumAddedBy String?
premiumUser Users? @relation(fields: [premiumAddedBy], references: [discordId])
aiEnabled Boolean @default(false)
welcomeChannel String?
announcementChannel String?
updatesChannel String
logsChannel String
logLevel LogLevel @default(MINIMAL)
}
```if you know anything about prisma... db is fun again... But my god is it angry when you mess up.
I think I need to tweak it more, but this will change a lot of bot functionality so i think I have to hold off on putting my bot on topgg as the dashboard redesign is changing how servers and users are recorded.
fun and slow
This is with the use of api calls and on a dev environment lol
when used on servers in prod, with all the api calls etc a single process is ~5ms
as its hosted close to where the db is.
10ms total time on dev in another country with slower api calls on my dev machine was pretty nice tbf.
if i wanted faster I could probably go with go and some other stuff, use a nosql method etc...
but F that.
true...
idk how to make it faster unless I go direct with neon serverless
but accelerate adds in caching for requests so it can speed up data return times on commonly accessed data
its like adding redis infront of it, sorta.
Just not as fast as using redis
If you know a faster way to handle the data processing in typescript on cloudflare workers I am all ears. But remember I self host postgres lmao.
1/6 nodes
postgres + redis + rust 🚀
yes but with higher db ping
but faster
I may dump redis for the general cache though, its much faster storing cache in rust hashmaps
neon dev database is the bottleneck
Thats abysmal that accelerate is saying 828ms but the entire data fetch process only took 15ms and 5 of that was processing the data on the worker...
Something is lying to me and I dont think it was the request time data on the dev console on wrangler
I always use this as source of truth on process durations
Funny because I dont even call the database here
Thats all just calling the discord and clerk apis
Wait my db is empty... i forgot i cleared it to push the new changes... rip.
lmao
It probably keeps trying requests with no data wondering why its returning nothing when there were no requests through accelerate to delete data as I did it on the db and clerk ends
I keep being pushed towards drizzle but the output is just... meh
ok ew... prisma makes you generate the client into your src directory now... so you cannot ignore it.
Woo import feature
I am an import feature?
@prime cliff this better be stable soon
or imma be crying
I have too many vms to manage 
finally did the server migration
I mean you can technically use it atm and try it out
break a few things
that would be using it in production

which ive been told im not allowed to do with topstats :^)
its taken 4 days
I mean migrating a poorly managed dedicated server is like
a lot harder than you'd expect
:^)
i made a tool to help me. it just pushes it to my colleagues ticket queue
"Oh this server is a paina nd i dont wanan do it" press the shove to my hated colleague
see
ew
yeah you made your own hell
bro is just to all be on one server
now its on proxmox in vms
like is better now
and we have a firewall that works

ok cool... i just use pm2 cus node apps
Tho i think the pipeline spins up a linode server or a kubernete not sure which with pm2 on to launch and build the app
Migrating from AX101
to an AX102 with 196GB of ram
+22TB HDD
why hdd?
now sharing a server with Marco and Tonkku again
Marco runs a peertube
- VM backups
hdd should be used on a deep store not a live server
we have 2TB of nvme
we only use it for non-io dependent machines
unless you also have nvme ssd on it and the hdd is used to store long term data
tape storage > all
tape is goated
NVMe for Databases/IO-Dependent processes
the uk government website still loads some data from tape drives
HDD for backup / process only (stateless) services
they havent digitised and updated everything either... so we have paper records people have to find too
tape drives are still used ^-^
tape drives are cool ngl
I wish I could add a tape drive to my pc just for fun
prepare to spend thousands 😄
still the best way to preserve data
albeit slow
Modern tapes are more expensive than SSD's now
if tape is still as expensive as a 50tb nvme ssd server then i will eat that cost
yea but atleast tap doesn't just die out of nowhere
you can shove it in a cupboard for 100 years and know it'll be fine as long as conditions didnt get too extreme
lmao
so a 3d printer fillament storage device for the tapes
keeps the area cool and dry
and dust free
damnit youtube keeps putting 4 adverts on and im just like "ok i get it, you want me to renew premium"
i mean im sure you can
my friend has 10g fibre to his
10g fibre between their rack nas and proxmox then to the pc
so if you can do that you can do tapes
Doing a proper editor too with text and formatting options 🙂
Hmm i could actually do a nice editor diff toggle for compose too, to compare the previous and new version while you edit
Nice!
Beats tf outta doing this.
I hate front end
4 days of 8 hours roughly a day just migrating machines
I don’t use ai to code so… it sucked… I spent 3 hours figuring out what changed in tailwind v4.1 just to make it animate in properly
sounds about right lol
I know the pain
I also know Xig has a lot of fun getting topstats to work with our styling with tailwind
The 1 second animation was brutal so now it’s 500ms
I’ve gotta figure out how I can make it load each card one at a time with a 100ms delay so it looks like they are being pushed onto the dashboard instead of just appearing after a loading spinner
I bet 😂
It’s not that the next/image component preloads images… meaning it also puts them on vercel stuff
Plus the images come from the discord cdn 😂
Now to turn off word wrap now not making a super long class name just to animate stuff 😂
It is. They have a certain storage size limit but it's quite large
5gb
Ye
Not that large, but good enough for free
and its cheap af for anything over
Cheaper than s3 and the azure options
Ye I mean it takes a bit to hit 5. And I mean it depends on what u r storing. If it's something that can be deleted after a period of time ur good
yup
I think this for a simple dashboard home page might be a bit simple... But I dont want to make it too complicated lol
I know I need a navbar and a sidebar but thats just... complicated stuff.
What images are you saving?
None
But the image component from Next/Image does some pre-rendering that gets expensive for a lot of images on vercel.
Hmmm, I use vercel and havent had an issue with server avatars
I might have to look at the just released way to host on cloudflare as it wond have that cost
When you go over your limits it adds up on paid tiers.
Theo was talking about it before on why he hosts off of vercel.
I'll have to take a peek
And he went and made t3chat so... you know he knows what he talking about.
Cloudflare doesnt do TS do they?
Once I get my own apartment I'm putting a rack and switch in lol
i wanted to do this
but running servers on residential internet is a bit iffy
How so
they dont like you running hosting stuff
They do typescript?
Have for ages?
especially if it's intended to make profit
Oh lol, I mean... how would they know
I almost got my wifi disconnected at one point
When was the last time you touched workers? It’s v8 JavaScript stuff and has always worked with typescript. 😂
They havent yelled at me yet. I have a web server and a bot server running rn
Never tbh.
3-4TB traffic a month on average
Damn
Rookie numbers
I may just export my vercel and see if I can make it work on cloudflare. The only issue is the api's will have to be converted to workers and I'm not sure how costly that would get
Nope. It’ll work the same. It’s basically vercel functionality but ok workers if you read.
So you could hypothetically export vercel stuff and just import and run?
With some minor changes… you’d have to read the docs.
Oh ik, I've been fighting with their d1 lol
There d1 doesnt support some generic prisma db stuff
Cloudflare made an app that makes your internet faster and safer? Hell yeah.
Which?
Their 1.1.1.1 site
Called warp+
It’s basically a vpn that uses cloudflare servers 😂
do you like scrape or collab with veld
we make api requests
in accordance with the ratelimits set
ah i see i see
Finally got my custom invite url to work so I dont need to rely on discord generated invite one anymore... tho it does force me to push the user to a configured application invite url to get the bot in the server... Not found away to add the bot to the servers automatically yet. I think its to protect from people abusing oauth access tokens of admins to add bots to servers without permissions etc.
🙂
A nice way to see the current changes when updating your docker container names/images/volumes/etc especially for longer ones 🙂
Ooo custom url?
Ya, didn’t like how people could just add my bot and an important setting not be implemented. The custom invite url lets me get server owners to actually set it up before they use it.
Oh that's the other option vs the discord provided link under installation
Ye
I’m putting the bot on topgg the second I’ve migrated the old terribly managed db off planet scale to my self hosted Postgres.
With a faster more durable schema and api 😂
I don’t like how little support and documentation there is for custom invite links tho… having to open the original discord invite link in a new tab (locking off guild select to show only the chosen guild) and check every 10s if the user has added the bot sucks for dx and ux. hopefully they release guilds.channels.read publicly soon and not just as a selection on the dev dashboard so I can configure important channels and roles before adding the bot.
I am a WordPress and React Developer
Welcome
There ya go 😏
Stupid ts not knowing that user exists on type! Ugh I hate this sometimes.
Sometimes I regret being an on call devops engineer that also freelances... Then i remember I get to be outside in the warm and sun all day unless called into work or i decide to work on my projects... More developers should do this tbh
touching grass is nice
Yeah I do a lot of remote work when needed
Ye but I get it every day. I love it when it’s nice out.
on call devops? sounds like youre just doing IT, what do you do at work
Manage the pipelines, fix production issues, manage the network infrastructure and sometimes work on backend processes like data handling APIs.
But it is a lot of “whys this not working? Can you take a look and fix it?”
Love how most companies don’t actually use devops exactly as it’s defined… but it is development and operations.
@solemn latch
Ty
i took your advice and implemented it
good choice
password validation AND email validation btw
I can show you a perfect reason
and I fell for this issue
what tf is happening here!?!?
people trying to SQL inject
oh...
this is the Regex i use idk if its good enough
w h a t
❇️ nothing ❇️
NUH UH NOT NOTHING

you CANT say that and not explain
also is it bad that my frontend and backend use the same validation functions?
Not even email validation on the api tut tut luke
huh
this
ok im starting to think i broke the API
That should be a 400 bad request btw not internal error, if user input is invalid
ah lemme change that
it is 400...
idk why its returning 500

Yea but the error text is even wrong so something is FKED
was beta code
its fine
I'll rewrite again soon

im a better dev now
like idfk whats wrong here
the server is getting data and validating it but apparently its not liking that
im now also realizing i have not yet coded it to hash the password during creation
Also is it intentional that people can set perms: { } like anyone with api access?
it can only be ran with an API key
With correct access checks right or only you?
I dislike the idea of a json object for permissions
i'm gonna update it eventually to check perms and everything is just in like alpha you could say
Permissions?
never heard of that
what would you do?
im also gonna move the perms away from the user collection itself
Me personally I would use bitflags
Essentially it is an enum of
enum Permissions {
READ = 0 << 1,
WRITE = 0 << 2
}
wait thats TS only shit
Then you'd use bitwise operators to toggle permissions
do you not use typescript?!?!
this makes no sense to me
i do not yet
Who doesn't use ts in 2025
me
our website server is also js
Bit shifts
Wait bitflags are only in typescript 
still makes no sense to me
nah the module: easy-bits is
VERIFIED is 0001, CONTRIBUTOR is 0010, supporter is 0100, and VIP is 1000
But why is it not in javascript itself 🙃
idfk
should be
im still so confused on why fields is broken
It technically is
you just cant use enums
Whats ur opinion on using bitflags for permissions
would you guys also know why the errors dont log?
global.logger.error("Error during user creation:", err);
err is nothing
lemme pull my logger
} catch (err) {
global.logger.error("Error during user creation:", err);
return res.status(500).json({
error: "Internal Server Error",
details: err.message
});
}
there is no actual error
when i remove the log it logs the error tho...
or your logger doesnt accept 2 args
or logger.error is filtering it
class Logger {
constructor(debugMode = false) {
this.debugMode = debugMode;
}
formatMessage(level, color, message) {
const timestamp = new Date().toISOString();
console.log(`\x1b[1m\x1b[30m[${timestamp}] \x1b[${color}m[${level}]\x1b[0m`, message);
}
info(message) {
this.formatMessage('INFO', '34', message);
}
warn(message) {
this.formatMessage('WARN', '33', message);
}
error(message) {
this.formatMessage('ERROR', '31', message);
}
debug(message) {
if (this.debugMode) {
this.formatMessage('DEBUG', '35', message);
}
}
}
module.exports = Logger;
``` i wonder
that doesnt accept multiple args
yeah now its logging

^
i have a whole class for Cloudflare R2 Buckets
java ahh
(real oop sucks)
global.userAvatarBucket = new classes.r2Bucket("r2-user-cdn")
global.cdnBucket = new classes.r2Bucket("r2-bucket-emgkwc")
const uploadResult = await global.userAvatarBucket.uploadAvatar(newFilePath, key);
const fileUrl = global.userAvatarBucket.getAvatarUrl(key);
this is an example of my R2 Class
uh, it cant be 0 << n
did u mean 1 << n?
ykw i might as well just rewrite this in TS
rewrite it in rust 🚀🔥
no
ok
YEA sorry
confusing lang for me
now apologize for saying "oop > *"
fuck no
When i first started learning rust I set it up wrong on my computer and never fixed and could only run in a OneDrive directory
also i take back any comments i made about hating github.
rewrite onedrive in rust 🚀
then problem solved
Delete OneDrive from the face of the planet
SCREW ONEDRIVE
also btw guys how do u make a .gitignore file?
by right clicking
pressing new
then naming it .gitignore
Same way you make any other file
only problem with rust is that compile times are sloooow
Just rewrite the compiler in rust ez
my api takes 14s on a 7900x3d
true
is there not a .gitignore template for TS?
this is the life
Life rust rewrite when
well switching to the mold linker did save 4s on each compile
sadly its written in c++
😠
my compile times could be caused by this but that would mean admitting having too many dependencies
Bro has sha1 and 2
also is ts or js faster or is it the same?
Lame
just added transpiling time
ah thank you
ok ill use md5
Perfect
Lame was to this
👎
Seems perfect, maybe add a cipher shift in there
hmm true
very efficient way to store my etags
???????????????????????
blueprint-api_web | 2025-04-11 22:41:01 INF HTTP POST /api/telemetry (<censored ip>)```
im gonna call a priest
Using express is 2025 is wild
🙏
the internet to look up a more recently maintained library
I think fastify is the replacement
checks out
express is still very much maintained and very common in node (if you dont care too much about squeezing extra performance, then use fastify)
Pretty sure it’s outdated in terms of features though, at least that’s what I heard the last time I used it
Better yet, don’t use js for an api backend
then use what 😭
oh
i like C# is also a thing people commonly use for backend?
i wrote a whole API in java...
bad idea
asp.net is one of the best backends you could use, it's pretty easy to use and has a lot of nice built-in features and endpoint stuff
i was waiting for you
you were the one i thought of when i said that
ill have to look into it sometime
i realized what I said was weird, I meant because you post about your projects which are in C#
😭 3 versions of the API
Why is website all capitals xD
idk
i made the folder at like 2 AM
ok so is that bad
mostly because companies are in debt to microsoft infrastructure so theyre forced to build everything using c# since it offers best compatibility
- signed off by a person working for said company
windows server everywhere as well instead of an efficient linux system, drives me up the wall
It really depends on the company tbh but yea a lot of business rely on windows because it's all powered by microsoft stuff windows computers, microsoft office, teams (despite how bad its gotten), email exchange server and powershell too.
Sure you could use google/aws/linux but they don't really offer the full array of products that a business needs.
Windows servers though are 🤢
They keep releasing new windows server version but their server gui is still stuck in 2010 with annoying colors and menus.
I will never use windows server anymore honestly
i'd rather install ubuntu and go through the pain of setting up remote desktop lmao
i managed to get an http server working in rust
i just finished rewriting our fetcher https://img.pyrocdn.com/7veRT9lP.png

from a 2GB mem usage to 3MiB
fucking pog
2GB wtf
ok screw TcpListener
my company recently bought another company and they are still running windows server 2008, either windows server IT technicians are incompetent or there wasnt an IT department to begin with
Oh god
if im ever making a company with lots of people i'll only run windows server for active directory on windows the rest will run on linux
sql server too every microsoft locked in company runs it instead of using something like mariadb or postgres
its not a bad database but its sort of the fact you have to pay for it when equivalent or even better alternatives exist for free?
bro golang shouldnt let me do this 
kinda nice that it does tho
fetcher is done

ok this pisses me off i cannot find C++ Build tools in VS
is asp.net hard?
With any framework it takes getting use to be it's not that hard to setup and the controller and service stuff is pretty nice
Rust is already hurting me
hmm
is this in VS?
You can use VS/VSC or Rider
Rider?
A jetbrains ide https://www.jetbrains.com/rider/
Develop .NET, ASP.NET, .NET Core, Xamarin or Unity applications on Windows, Mac, Linux
One message removed from a suspended account.
I personally use visual studio for all C# stuff, dracula dark theme and the intelisense is awesome
One message removed from a suspended account.
If you also want to use C# blazor VS is the best with hot reload support
Intelisense is also great it will predict auto completion suggestions for you like if 2 models have the same names, frequent used auto completions based on your use and other stuff.
Bit like VSC auto complete but on steroids
Why? Just use azureAD
ASP.NET is absolute bliss and pure joy
i cant tell if this is a lie
ok uhm how hard is it to host?
Hello guys
Dockerize it and it’s super easy
That goes with most applications though
anyone good with tailwind stuff? how to fix this?
its a dropdown menu on mobile, which opens in fullscreen, but the padding is ew
how to make w-screen account for paddings and margins correctly?
or wait, are you having problems with different screen sizes?
no its just that the dropdown menu is aligned with the burger button
so when i use w-screen it goes off-screen
how does html look like
ok bc rn im just hosting everyone on a VPS with PM2
right now its this
using daisyui
using w-max its not too bad
I assume select is the hamburger menu or whatever
Ah that makes sense actually I’m stupid
im just gonna leave it like this tbh
I can only assume it has something to do with the parent div
Whatever dropdown applies
yeah but w-full doesnt work
because the menu is probably using position absolute or something
you can host anything on pretty much anything
host it on a potato
i have been proven wrong
true
that switched quick wtf
yk technically possible
as a power source sure, as a semiconductor, no
technically you could use it as a transistor
not feasibly, no
but in some way yes
and how is that
theoretically an rpi pico could be powered by less than 1000 potatoes
if im not mistaken
@quartz kindle hello buddy
top tier benchmarking
📉 📈 📉 📈 📈
Quick question (I ain't super active here may try to be in the near-future)
if I wanted to have people test a bunch of stuff with a bot I own and then have them give me super genuine advice / feedback would that be something I can get from here?
saturday must've been quite a day
do you guys think this is a good email verification? im still working on it
Good enough
At first glance I didn't notice that there was white text on a white background
yeah i didnt update that part yet
Oh neither did I
this was the old version
also is using a noreply email good?
why wouldn't it
bah
use what you want
noreply doesn't matter its quite literally what it's meant for
o
Literally almost every major company uses noreply@ lmao where are you getting the description from
idk
is this a redundant amount of logging?
cause it looks cool
ASCII = cool
afaik even spring boot has an ascii splash logo
Yeah way too much logging
You don’t need to log the versions of your packages when you already have a package.json that shows all of that
Looks like you spent more time on custom logging than you did making the actual API
✨ Fancy ✨
Idk bc i wanted to add it
The api works very well and I have focused on it
Rn I'm very focused on emails
But yes I have focused a bit on logging
It's not everything
Redundant logs
Id rather keep those
Also not really needed tbh
Why
id rather know if it connected
What I mean is that its redundant to state the same thing twice
oops i forgot to remove the code emailing me
consider implementing log levels
?
like, output only info level and above to console by default
im so confused
I suppose this isn't very common outside java then
i guess not
like, you have 5 levels - TRACE, DEBUG, INFO, WARN and ERROR
trace and debug would be the verbose stuff that's mostly irrelevant
Personally, I hate adding logging throughout my program. It’s cluttering, I only add it if I’m debugging usually
I like to keep 2 log files, one being a copypaste of console and one being debug level
console only gets info and above printed
also should i compress my files when uploading them to our CDN?
because our one is already at 150 MB
depends on what you're uploading 🤷♂️
Image files
this one is 23 MB and won't even load on an email
im gonna be working on image approval
this, either convert to a lossy format or downscale the photo
Yea
PNG uses lossless compression
tf happened there
?
Very much is
Most people just dont know how to actually log
oh you dont need to self host an active directory forest?
Nope. Azure does so much now you can use azure ad instead of self host
Makes devops so much nicer (somehow ad stuff is now covered under devops courses)
Azure ad is quite nice tbf because you can then do access control on servers and pipelines and stuff from ad… but it’s just… complicated as all things Microsoft are.
I think I just threw up
xp
Not so bad… prefer xp over vista
But damn… that bios is nightmare fuel.
Tho… the new thinkpads use the same bios just more modern so not that much better
Can you dynamically change the redirect uri for discord's oauth system?
I want to return the user back to whatever page they were on last
Since I don't plan on having just 1 location be for linking discord to their account
Oh right state
does that work for authorized_code grant or whatever
actually I dont think I can use state
cookies works but you can use state
they get redirected to your oauth endpoint with the ?state= url param
So i'd send a someauthorizeurl.com?state=wheretheycamefrom and then once they consent it goes back to my redirect uri with that state variable?
exactly
Yeah I also used state for that, and put their current url
so im still investigating the issue with fields, i logged the type and it returns Object
request Body:
{
"username": "adminUser",
"email": "admin@example.com",
"profilePictureURL": "https://users.emgkwc.com/avatars/james.png",
"password": "SuperSecure123!",
"perms": {
"editor": false,
"developer": false,
"owner": true
}
}
my field Validation code:
const {
username,
email,
profilePictureURL,
password,
perms
} = req.body;
const userData = {
username,
email,
profilePictureURL,
password,
perms,
verificationProcess: {
verified: false,
currentCode: 0,
codeExpiresAt: new Date(Date.now() + 24 * 60 * 60 * 1000)
}
};
global.debugLogger.debug(`Typeof userData: ${typeof(userData)}`)
if (typeof userData.perms === "string") {
try {
userData.perms = JSON.parse(
userData.perms.replace(/(\w+):/g, '"$1":')
);
} catch (e) {
return res.status(400).json({ error: "Invalid perms format" });
}
}
const missingFields = [];
if (!userData.username) missingFields.push("username");
if (!userData.email) missingFields.push("email");
if (!userData.password) missingFields.push("password");
if (missingFields.length > 0) {
return res.status(400).json({
error: "Missing required fields",
missingFields
});
}
Whats the issue
hash that password
its gonna be hashed...
aight
im just testing rn
but i have app.use(express.json()); in my main file
all my projects have body-parser and this one doesn't
yes its json
it should be username: username
it won't know what it exactly is
userData is technically just a object of strings with one object at the end
you need to do what haku said
first is the req.body second is the data filled out for the db
Sure
yes, but what IS userData
the bloody body

no, it's a mangled json
it has no keys
you are simply supplying a value for username, email, profile, etc etc
with the last member being a proper key/value pair
huh???
just did this
yes
yes that is what you need to do
and guess what...
it worked?
most likely
nope
hm
i quit
but you have not showed us this
createUser is my custom function:
/**
* Inserts a new user into the users collection.
* @param {object} userData - The user object.
* @returns {object} - The inserted user document.
*/
async createUser(userData) {
try {
const collection = this.db.collection("users");
if (
!userData.username ||
!userData.email ||
!userData.hashedPassword
) {
throw new Error("Missing required fields: username, email, or password");
}
const user = {
username: userData.username,
email: userData.email,
profilePictureURL: userData.profilePictureURL || "",
hashedPassword: userData.hashedPassword,
perms: userData.perms || {
editor: false,
developer: false,
owner: false
}
};
Object.keys(user).forEach(key => {
if (user[key] === undefined || user[key] === null) {
delete user[key];
}
});
const existingUser = await collection.findOne({ email: user.email });
if (existingUser) {
throw new Error("User with this email already exists.");
}
const result = await collection.insertOne(user);
global.logger.info(`User created with ID: ${result.insertedId}`);
return result;
} catch (error) {
global.logger.error("Error creating user:", error);
throw error;
}
}
whatever you are passing into createUser is likely malformed
and missing key/values
ofmg i just found it...
hashedPassword isnt a vaild thing bc i updated it to password...

bruh a new error now
Thats where im out
mongodb is not my thing
What you are attempting to save/insert does not match the schema defined for that table
hmm i see whats wrong
Compare what you are doing vs what the mongodb schema expects
i added data which doesnt exist in the collection
bingo
time to re run this command:
db.createCollection("users", {
validator: {
$jsonSchema: {
bsonType: "object",
required: ["username", "email", "password", "verificationProcess"],
properties: {
username: { bsonType: "string" },
email: { bsonType: "string" },
password: { bsonType: "string" },
verificationProcess: {
bsonType: "object",
required: ["verified", "currentCode", "codeExpiresAt"],
properties: {
verified: { bsonType: "bool" },
currentCode: { bsonType: "int" },
codeExpiresAt: { bsonType: "date" }
}
}
}
}
}
});
oh i did this wrong again
You tend to take the "break it down" approach
This appeared at the top of my messages when I tabbed in. when not supplying a name like thing: value
the variable name of the value is used as the name, so what they wrote is valid.
{ username }
is the same thing as { username: username }
Is it really?
Yup
why not use something like prisma lol
or any ORM honestly
Interesting
?
something that creates the schema for you
I hate people who recommend prisma like its some all saving saint.
Typeorm my beloved

Did I say it was :^)
I used TypeORM before, same with drizzle

6.6.0 is broken
I wrote my own actually not shitty to me orm
Oh lovely
fair play
Your using JS right?
yes
I just hate js's allow everything approach
Ever since I've had a taste of enforced types
Try one of these:
https://typeorm.io/
https://www.prisma.io/ * Personal fav, we use this @ TopStats
https://orm.drizzle.team/ * I should mention this isn't production read yet
I can't go back
TypeScript my beloved
When is drizzle going to be production ready
we use TypeScript and GoLang in topstats
It's been like 3 years since I saw smth about drizzle
even strict type checking with jsdoc is pretty cool (editor only)
Yea but type safety is built into ts
I mean
for the most part anyway
it is tbh
ive used it in many projects
its faster than prisma
TS literally compiles to JS :^) it's just doing typeof everywhere
This one simple trick will make you mad:
// @ts-ignore
i need to use it when making recursive types that parse strings
Where is your type safety now
Thats unsafe
those ms matter
milliseconds matter too
when properly using prepared statements
even prisma admits it btw https://benchmarks.prisma.io/?active_query=
bruh
why drizzle so slow




