#development
1 messages Β· Page 204 of 1
ive been forced to learn more than i wanted about it since SD and llama came out
and i have done machine learning in the past so that helps
definitely not professionally
math is not my strong suite

I'd never make the cut
to be fair, it's not crazy maths.
Weighted sums, entropy, conditional probability, learning parameters and formula's, model evaluation.
It's not that crazy. If you encounter the maths, you will most likely be able to get yourself started using online resources.
Also many different packages do most of the maths for machine learning. Most of the times all you need to do yourself is model evaluation and fixing hyperparameters.
But yeah of course, you do need to know some underlaying information about for example the different activation functuons etc.
i dont know too much about it but i know the deeper you go the more advanced some concepts get and you need to do some things on your own and know the maths behind it to understand how to better optimise the model
exactly exactly
that's true
for any university course for machine learning you usually do an undergraduate with maths alongside it as well
because some of the maths involved gets quite complex and not really something youd see in a high school setting
but once you understand some of these maths jargon terms then you can probably do it just fine
Yeah that's true, but usually everything is done by the package or framework you are using already.
There's no point to reinvent the wheel.
Though, setting evaluation and tuning hyperparameters aside as that IS completely left for you to do as far as i know.
Who uses libraries, im a rust developer. I am the king of reinventing the wheel /j
Though we do have some specific functions such as inner and outer loop validation to tune hyperparameters but it's extremely inefficient.
Ew i am such a fucking nerd
if you are working outside of a framework environment and doing stuff a framework usually cant do for you or something like that then all that course probably goes to good use
but its probably also a case of "maths in software engineering"
aka in 95% of cases you only need high school maths
depending on what you want to do
but universities still make you do advanced maths courses
it might come into use for some advanced problems but most of the time you can use a library for that or quickly google
literally me

Thatβs too real Lmaoo
I believe I did state this once here, but I'd like to bring it up once again before I start working
I made my bot on atlas mongo db cloud database free plan, I wasn't expecting it to grow this much
Now that the bot has a lot of active users, the commands are often delayed and the bot responses are a bit slower than I'd want them to be.
I've a few options, unsure on which one to consider.
Data of all players is stored on mongodb ofc, and that's the only db I know how to use i'm pretty much a beginner at databasing
I can try learning SQL but I don't know where to start. I'll also have to re-write the entire bots code in SQL which does sound painful and time consuming. I'd also need some practice and guidance if I pick this way
Other is I could maybe buy premium version of mongodb, but i dont know if thats gonna fix anything or nah.
Would appreciate if someone can help me decide whats the best choice to make in my case before I proceed with anything :), feel free to suggest alternatives if you've any! I work with python ofc
Also apologies for yap wall man
Are you able to host your own instance of mongodb? @dusky idol
erm can you evaluate? I didn't get it
Where are you hosting your bot? Is it on a vps?
on sparkedhost
but i doubt it's a hosting side issue
Hey Zeksy
There is a cool thing called orms, you basically don't need to know any sql to use em
Just use an ORM if raw sql isn't your strongest suite. And what you can't do with the orm, they typically expose builders that you can learn what you need to execute raw sql queries
I got absolutely nothing outside of those 3 sentences!
2*, I got the Hey Zeksy part
Object Relational Mapping
Makes sense
But what do I do with bot's database currently
there's a lot of data stored on mongodb ofc
Well, if its mongodb the hassel free option is to just locally host mongodb yourself and port the data over
i can summon it and then add it to whatever i switch to
what do you mean by hosting mongodb myself btw
The other option is to host a SQL database like postgres or mysql and port the data over to those, but since those are relational dbs they can get tricky
You can host the mongodb server yourself...you don't have to use atlas
Wait I'm currently using the shared plan on Atlas, so youre telling me if I host it myself it'll respond to my bot faster
Well not necessarily
But you wont be confined to paying for atlas

If your db responses are slow then that means either the connection is bad, or your queries are terrible
Its hard to say without seeing code 
i see, well the responses aren't exactly slow
its just that there are a lot of connections in one single command to retrive data of different types of a user
like the bigger commands have upto 10ish calls to database or so, sometimes even 15 to check and update data etc
This is why you do connection pooling
let me throw an example
Can you evaluate? Apologies tho, I don't really have that much experience 
No!!!!!!!!!!!!!
Look at that link
I just host my own mongodb server
I read it, got some basics to say the least
I believe if I do the pooling or whatever, it'll keep the connection open all the time so regardless of how many calls I make in a command it wont make a difference?
Half read half assumption btw ^
yay
Basically, if you have multiple people running a command, and it needs to fetch from a db.
Well if a fetch is already happening, the other call has to wait until that one is done.
ohhhhh
yeh i see
Whereas if you use a pool it can open new connections, and when its done cache them to be reused.
let me give you an example
It saves you from opening a new connection each call.
Our bot has a "reset" system, I'll explain it in simple terms so we can have a better overview
Basically, everyday at 12am, 8am and 4pm let's say the pulls for everyone resets, let's say all players can pull 8 more cards and run the jjk pull command
whenever a reset hour hits, the bot basically just becomes 10 times slower than usual as the whole world is pulling cards at once
Now that you've explained this, I believe this is what was causing the lag?
From what I'm getting for now, when more users are interacting with the bot at once, it will be slower as it is right now. But if I implement pooling, it will be solved? Correct me if I'm wrong tho
Well yea if you are running on one command it will be comparitively slower
DBs are meant to be able to handle that, but if its a large number of users making the same command call then it will get very very slow
Yeh it's like 100s of players run the pull command at a reset hour
DB pooling can lessen the burden
though its not guranteed to help 100%, as it also depends on how you are making these calls.
I see, lessen doesn't mean resolving it tho
But it will make it smoother experience for the users
lemme just throw some example code, a second
You wont ever be able to resolve it 100%
thats the sad reality of the world of the internet.
There will always be some lag, its just it can be unnoticeable
patreondb = await self.bot.db.patreon.find_one({"_id": ctx.author.id})
if not patreondb:
return await ctx.reply(f"Only Hollow Purple users can access this command")
if patreondb["rank"] != "hollow purple":
return await ctx.reply(f"Only Hollow Purple users can access this command")
pullerIds[str(ctx.author.id)] = datetime.now().timestamp()
find_cooldown = await self.bot.db.cooldown.find_one({"_id": ctx.author.id})
if not find_cooldown:
await self.create_cooldown(ctx.author)
cooldownData = await self.bot.db.cooldown.find_one({"_id": ctx.author.id})
GlobalPullDB = await self.bot.db.globe.find_one({"_id": "pull"})
Like this block has 4 calls, it's a big command tho and the last part has some update_onecalls too
Usually the command responds within 3-5 seconds, during reset hours it can turn into 5-15 seconds even which is a big problem
I got you, I messaged a friend regarding the issue earlier, he's also pretty much a newbie tho
What he told me is, if I switch to SQL it'd never cause any lag as sql is an in-code database and not hosted on cloud unlike mongodb so the bot wont have to build any connection of any sort
He works with sql so he might just be biased, but his suggestion was to try and re-write everything in sql to kill the problem 
Your friend is wrong
SQL is not a in-code database as they say.
While yes you can store it on the file system like with sqlite, there is also cloud dbs that require a server like postgres and mysql.
I dont doubt you here π―
Yeh I believe he works with sqlite
Even with SQLite though that relies more on read and write speeds it can be delayed just as easily
then doesnt it just depend on host's power
That is something I myself have no idea about. I haven't used Sqlite enough to know how it works fully. All I know is its a disk database.
You access the db file directly
Unlike postgresql where you open a tls connection to it
Yep makes sense
eitherway back to mongo !
@quartz kindle or @lyric mountain is probably better suited to talk to you about databases though.
I have very limited knowledge compared to them
I wouldn't be surprised if tim could make his own db with the knowlege he has 
Good luck, and definitely use connection pooling
It will help
Usually you can also set the max connection as well if you want to fine tune it
amazing
Could you tell me how to start with connection pooling then
, I doubt id have to make any incode changes for all commands
uh no idea how you do it in mongodb
and depending on what library you are using it might differ
Fair enough, I'm using motor if that helps 
from motor.motor_asyncio import AsyncIOMotorClient
cluster = AsyncIOMotorClient(["connection string"])
Bro the docs for that library are so bad π
Well I mean, it looks like it already has the default pool size set to 100 connections
Which ideally should be more than enough tho idk how large your bot is

oh the shared cluster you mean
im on this tier
it says 500 max connections and bla bla but also low network performance
that could be the red flag maybe
Well by default your library only allows 100 max concurrent settings.
You can ofc change this.
So update, this doesn't work lol
I just get a "Missing Access" error when I try and add the new member to the thread on the guildMemberAdd event even though I've already given them a role, the bot is in the thread it made and the bot has admin. I also tried setting their rules flag to force accept the rules before trying to add them and it doesn't make a difference. Not sure what's up but it looks like some sort of Discord issue since I can't even add them to the threads with my own account as the server owner.
It used to work perfectly just tagging them in the new thread until about a week ago
Hello gamers
Got a database question. I am trying to bulk update user settings right now, which means I need to find a way to also reflect this in the database. Right now we are thinking of dynamically creating the sql query, but this seems like a bad idea. As usually dynamically creating sql queries is never a good idea. What do you guys recommend doing?
Wdym dynamically creating them is a bad idea?
as in, taking the json response, looping over it, and dynamically creating the query string based on that.
Its not sanitized, and although the chances of them inserting anything bad is low, its not impossible for bad actors to do so.
I'd like to mitigate that if possible
I'm not sure what you're trying to do? What's the json response from? Are you just trying to do a one-off bulk update for all users or is it something a user can trigger? I don't understand.
Well the response is from the frontend. Kind of like discord's setting pages for servers where you can edit multiple things at once and save it all at once as well. I am trying to go for that effect as well.
The only thing is, if they know the endpoint and they have their student_id (which is saved in the cookie rn cause we have no session management) and their token they can make any requests to the endpoint with whatever data as long as it matches the struct
So you just want one user to be able to update all of their settings using one sql query basically?
Essentially, it'd be better than running multiple queries
Ofc
Idk how your settings are structured but i'm guessing you store settings in json format?
No
They are individual fields
{
"account:" {
"setting1": "somevalue",
"setting2": true
}
}
is more or less what we do rn
Well if you're using prepared statements on the backend you should be ok afaik?
yes & no
prepared statements would definitely help, but in our case when we are handling multiple fields it is kinda where it gets weird
How?
Well, we don't know off hand what fields we are updating, we have to rely on the json given to the endpoint to know.
Oh for the love of god no
Why not?
That would require having the old settings as well
just so we don't accidentally overwrite them

So you only pass the updated settings to the backend?
I mean, its realistically not alot. But I see no point in sending data we don't need back and forth. Not to mention some settings are sensitive
We can ofc omit them, but in rust omitting fields is a little meh
I'd rather avoid the need to omit the fields we don't need and just not send them period
Oh rust. You're trying to be 1000% optimised. Good luck 
I have no better solutions for you then 
In reality we chose rust cause its what we both now me know. Its type safety and memory efficient
I mean..its not like what I am asking is specific to rust persey.
But thats fair thanks for the help you did provide!
My other alternative was fetch the user on the backend, compare the updated json to the fetched data and then build a prepared update statement based off that which updates / overwrites all settings.
But that's 2 sql queries and since you've mentioned the 4 letter R word you probably won't want to
I don't see how you'd do it otherwise
Based off what you told me
- Send all settings to the backend and send one update query.
- Send only updated settings and fetch, merge changes and update the user on the backend.
I am now realizing that maybe that won't work :^)
Not all settings are in the same table. There are account settings and then other settings as well not stored in the account table
I don't see how a dynamically generated query could have solved that either then?
we'd be able to set which table we are updating
damn.
I'll get back to the conversation once I wake up, will probably need you to tell me more about it
. Appreciate the help tho nonetheless
In case anyone needs it, especially @sharp geyser https://gist.github.com/null8626/ff90cf51a1fbe32b79997dbcae4f46d1

π
Depends on what you mean by "popular". Top.gg is not the only bot list, you can add your bot to many such lists and have a greater chance of reaching users. The uniqueness of your bot is also important, multipurpose bots have it much more difficult because there are thousands of them
fairly sure bots like loritta or karuta became popular because of topgg
and their active advertising
advertising in top.gg?
advertising everywhere
- make sure your bot is actually good and worth using
- make a good looking website for it and invest on building an online presence
- post on social media and/or pay for ads on google/facebook/instagram/tiktok, try to build a community
- ???
- profit
- realize all your hard work is not paying off because your bot simply isnt that good
- give up
Repeat the process but this time with a different bot 

Hey can someone tell me what CORS is and why its blocking a request?
https://aws.amazon.com/what-is/cross-origin-resource-sharing/#:~:text=Cross-origin resource sharing (CORS,resources%20in%20a%20different%20domain.
CORS needs to be configured on the server
it's a browser security feature, so you can't tinker with it on the browser client
I fixed it
anything i could change on this?
lgtm
lets gamble, try merging
Bro π
my favourite version of the acronym
ngl roosa
I already forgot what lgtm really means
I only remember lets gamble, try merging
lets get this merged
looks good to me

lemme guess, tim made?
LOL
LGTM community
tim is the real owner
petition to change #development to #tim-made
tim's cave fits better in my opinion 
how many people need to agree for it to happen

300, just like every change.org link asks for
pfft
for no aparent reason
300 people don't even visit this channel in one day
5head
no one checks pins
-pins
^-^
unless you tell them to
-pins
ye we cant use it tho 
Anyway onto dev stuff.
Since text in postgres is not super efficient to use if you aren't storing large globs of text, then you're supposed to use varchar right? Well is it really okay to just keep doing varchar(255) ?
The point of varchar is to specify the size, but since I don't always know the size of things, unless I am controlling it myself then I am kind of forced to use it like that just to be on the safe side.
you can guess what would be the maximum size and then add some more
for example, on an email it'd never reach 100 characters
even 50 is a bit of stretch
Do they limit the size of emails now?
Honestly, I dont think it matters does it?
Unless you have a massive database I don't think you'll ever notice performance or storage issues because of text vs varchar.
hm
ok
yea I doubt I'd run into an email that is that long
and if I do they can take the cake
Well, I am expecting a lot of data to be stored.
Like alot
also yeah, u can use varchar(255) where ur unsure, it'll resize down to actual data size
plus 2 bytes
that'd be char(255)
ah
varchar stands for variable char
yes, it'll give u an error if you try to insert something bigger
I use varchar(255) on my bot for urls
but if u want to cover every case, maximum valid url size is 2048
I'd need to store a list or an array of them
average url size is 75 according to stack
I store the cdn links for the product images
ah, child table then
Really 
All it is just a link, I can't just store it in an array
Doesn't seem to warrant a whole new table
fat columns are worse than another table
simple thing, just parent_id, id and url
π
id being sequential
I still always struggle with this concept.
if you really want to avoid another table, then you can use a json column
json includes both {} and []
I mean I get where he is coming from, in a relational database, if you are finding yourself storing an array on the table 9/10 times you're doing something wrong
A relational database is meant to map out relations of data you are storing.
Its optimized for it as well, it just is a little annoying imo having to query for it.
it's faster to move 2 small freezers in 2 cars than to move 1 large freezer in 1 car
Cause there will be cases where I might need information on the account, and then I also have to get the image urls at the same time
also you risk getting your car broken and causing a congestion in traffic
https://www.postgresql.org/docs/current/datatype-json.html in case u want to read on postgres json type
w3 sucks at explaining anything
I mean, I understand it.
At the same time, its just weird that adding more tables is so often better.
its meant and optimized to handle such things.
honestly I sometimes feel like the array data type was added just to make people happy π
I hardly ever use it myself
I do use a json column on my bot, for storing match history
I use Json for storing discord embeds π
cuz the data simply cannot be converted to a table
that's fair
you store embeds?
custom embeds likely
yeah, webhook-topgg v2 does
ic
didnt you use websockets at one point for that project
I dont have time to give support to people. or I just dont want to
I know there is LEFT JOIN, INNER JOIN, and just JOIN (possibly missing a few) wtf are the differences
I have a neat graph for this, sec
ngl, thats even more confusing
left gets the left table, with null entries when there's no match on the right side
Felt that, link me to the project I will become your support lead /j
right join is the opposite
LEFT JOIN = A required | B optional
RIGHT JOIN = A optional | B required
INNER JOIN = A required | B required
OUTER JOIN = A optional | B optional
hm
A being whatever is before the JOIN keyword, B being what's after
So basically lets say I have Table A and Table B, in the scenario of LEFT Join if table A returns null then it will only return B or will it error?
LEFT will fill with null on the B side
like, "Get everything on A, fill B with null if nothing matches"
π€
I think I get it now
So you use LEFT Join when you are okay with B possibly being null
like when you want the data, you dont care if there are orphans or rows without head
you want the data now
you'll usually use inner, then left sometimes
right is pretty rare, outer means ur doing something wrong
there's also lateral join, when you dont want to link data, you just want them on the same query
why so many joins
SELECT * FROM tableA a, tableB b basically
it's best to have options if you ever need it
than to lack it
fair enough
as jack harlow said "I got options"
Now then, off to fuck up my db tables even more!
Also wait
in regards to the product image table
Should I put the FK on the product table or the image table

image
you cant reference all images from product table
but you can reference a single product from images

Also, I was thinking of storing how many products the person already has listed in the seller table, though that would honestly just add another db call that i'd have to make
actually then again not really.
dont be afraid to make read calls, those are the fastest to execute
π
So if I am wanting to get the product images, but also the product information would I just inner join on the product_image table?
something like
SELECT * FROM product_image pimg INNER JOIN product p WHERE pimg.product_id = id
idk how the hell this works yet so I am taking a wild guess
how would that look then, cause I feel like even what I was doing is syntaxically wrong
thats very interesting
SELECT * FROM product p INNER JOIN product_image pi ON pi.product_id = p.id
I didn't know you could create aliases like that
yes but you are telling it a product id to look for
just add a where after it
Oh, ok I was confused I thought ON was like that

never even seen the ON keyword before
SELECT * FROM product p INNER JOIN product_image pi ON pi.product_id = p.id WHERE product_id = id
?
yep
either will work, they're the same value
oh okay
just remember to use aliases when working with join
else it'll throw an error if a column with that name exists on both sides
so WHERE pi.product_id = id?
yes, if id is a param
yw
hopefully my current db tables are now properly made
ima cry if I have to rework them again

btw, this only applies when using inner join
since with left/right one of the sides might be null
Oh thanks :D
I also added a fk on the product table for the business_id
so we can link products to business accounts
:p
@solemn latch yo, is your webhook stuff open source?
nah, but its nothing fancy
tbh, its such a mess I dont think you can π
well I am always down to help if you want!
I need to get more projects under my belt
hey guys, any suggesstions on this page or is it good as is?
It might just be me, but what is with sites using such bright colors randomly.
to me it doesn't look good, but it seems to work so idk
Hey folks! 
General question for all:
How do you go about collecting feedback from users about your bot(s)? More specifically, do you rely solely on users joining your bot support server and reaching out there? Or do you have a feedback mechanism of some description that enables users to provide feedback remotely from their servers?
Thanks!
Well, you can do it several ways. Direct them to your discord server, or you can make a command for collecting feedback. Personally with the new modals i'd opt for making a command as its easier and some people are less prone to joining servers. You can just have it send to a webhook integrated into a channel of yours :D
Honestly, if your bot has enough traction to get useful feedback they will give feedback
as long as your bots support server is easy to find
Fair, most peole I find tend to avoid joining servers
material spec
i've found that the vast majority of feedback are worthless
eh, its a 50/50
people send you nonsensical suggestions and ask you to implement idiotic features that have nothing to do with what your bot is about
Most of the time its just people trolling or giving you unintelligable words.
Though there are those who also give good feedback
use AI to filter out these messages 
"can you please add pokemons"
Uh sir, this is a mcdonalds
no its kfc
no its patrick
kebab football club
imagine someone doing this irl
I am not surprised
Lowkey want to go work at a burger place and just pick up the phone and say that.
It's worth getting fired

lmao
xD
@lyric mountain I am running into some issues regarding the new db configuration you helped me with.
I am noticing that due to me creating a fk between the id field on the business table and the business_id field on the product table I am needing to keep a lot more data in session than I would initially like. I mean its not necessarily a problem, but as it stands now I keep the student_id generated by the table, the account id generated by stripe when I create a connect account, and now the business id generated by the table, which also holds the account id generated by stripe.
Is it ok to not create a fk with the primary key of a table? If so that would be more ideal
of course (i believe) your FK does not have to be a primary key
you just need to make sure its still unique
Session bloat go brrr
you GOTTA MAKE SURE that you got the right user
ong
gotta make sure they didn't change their identity within 3m (yes this is a jab at discord)
if (data.accountid == data.businessid == data.clientid == data.shopperid) {
is_client = true
}
thats the most beautiful code i've ever seen
chef kiss if I do say so myself
Gotta compare their SSN as well
make them enter it each time they login

No identity theives getting past me today
better yet saliva swab
they gotta wait 2-3 business weeks before they can login
Gotta make extra sure they are who they are yknow
I might take a page out of @humble gyro book and introduce login reviewing

On a serious note, I swear every time i touch this damn database its like I am closer and closer to going insane
I've reworked this database like 10 times

today...
Oh I have a funny little bug I can't solve myself
For some reason sqlx thinks I am trying to parse a string into i32

let price = (product_data.price.parse::<f64>().unwrap() * 100.00) as i32;
unless its talking about this? I doubt tho because this didn't become a problem until I started changing the text datatypes to varchar/char

I was going to ask why you're not in voice chat, but you cant π

Let's change it now! So could you guide me on how to do that? I tried researching and can't really find anything related 
Also I'd appreciate if we can also build a connection pool for mongodb
yeh fair enough, could you tell me if there's someone I could get help from
As far as the people I know, no one uses that lib
Though, it really shouldnt be hard to figure out if you read the docs for the library.
I just don't know where to look myself
I see, let me summarize it for myself once
The library I'm using only allows me to have 100 connections open at once or something
I can reduce the lag to some extent if I do connection pooling
Both points are correct?
Connection pooling can indeed help mitigate the lag.
If you are running into lag and it indeed is a connection issue that is
Yeh now the challenge is to establish the pooling and discovering how to do that 
https://www.flyde.dev/ wtf is this
Flyde, open-source visual programming language. Runs in the IDE, integrates with existing TypeScript code, browser and Node.js.
Seems so weird
programming is cooked
im gonna give this a try lul
nvm, it doesnt do what i thought it did
i have command called download which downloads the video link u provided(yt) and sends it in discord
does it break tos tho
tos of discord
oh yeaa iforogor about yt nsfw
things like this existed for a long time now
its scratch on steroids 
i get what its supposed to do but i dont think it helps anyone
maybe people unable to write any code syntax and have to have a gui with links to visualise it
Yeah but if you get thrown into the pool enough times youβll learn how to swim. Keep your floaties on and youβll never learn how to swim
At least thatβs my thoughts about GUI based programming
Itβs cool in concept, but promoted bad practices amongst the programming community. It teaches you virtually nothing
i got the re-verification message from discord lmao
In order for your app(s) to remain verified, you are required to re-verify your identity by 5 Jul 2024. Failure to comply by that date may result in action against your application(s), which can include, but is not limited to, removal of verification.
discord threatening me
hey tim I have a question for you
I have a video file, and there is apparently something hidden either in the video itself, or in the file itself. Do you know of anyway I can try and find this out? It could also be hidden in the audio.
Anyone happen to know a good mailing API?
Building a prototype for uni and need one for delivering password reset links but my search has been fruitless so far
Mailjet instantly suspended my account as soon as I made it. Same goes for sendgrid. Trying my luck with postmark
mailersend
It's what we use
π
Thanks!
steganography lul
u could try to re-encode the file to something else, since this will wipe anything hidden inside it
Problem is I dont have the original files
if you want to hide something on a computer thats how id do it

well
I've examined the audio as much as I could and no anomolies appear there
a properly steganized (?) file will have no noticeable difference from a clean file
aside from being larger
ic
depends on what it is
I don't know how they expect you to find it hidden in a youtube video
i assume this is some type of CTF
π
Not really no
Just a content creator I follow posted a challenge with a reward
Thought i'd give it a shot
but its all in a youtube video so idk how tf they expect people to find whats hidden
I've examined every frame, looked at the audio I could
i wouldnt trust that to remain in there after youtubes compression unless they posted the raw file somewhere
or theyve done something else to it
Yea
I've grabbed the video and messed with the contrast to see if there is anything hidden, but that doesn't seem to matter

its probably a lot more complex than that
Oh definitely
an understanding of the mp4 format would probably help too
All I know is its a 16 character code
on a binary level
dont know if its alphanumeric or not
π sounds complicated
if the author of the challenge posted the video on youtube, then i doubt he meant for people to examine the video file
stare closer
until your nose gets wrapped into another dimension through your screen
One thing that is weird is the only time he used color in the text was the same color as his shirt
i mean it wouldnt be a challenge if it was easy to figure out
I suck at puzzles
No definitely not
I am already stumped so looks like its not meant for me

Vote listening on port 4599
Connected to Redis
Web server listening on port: *2000
Connected to the database
Created shard: [0]
Presence status updated.
Logged in as Melody#9082
node:events:496
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE: address already in use :::4599
at Server.setupListenHandle [as _listen2] (node:net:1897:16)
at listenInCluster (node:net:1945:12)
at Server.listen (node:net:2037:7)
at Function.listen (/home/container/node_modules/.pnpm/express@4.18.2/node_modules/express/lib/application.js:635:24)
at file:///home/container/apps/music-bot/dist/events/interactionCreate/vote.js?t=1715220653062:67:5
at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:323:24)
at async #buildEvents (file:///home/container/node_modules/.pnpm/commandkit@0.1.6_discord.js@14.13.0/node_modules/commandkit/dist/index.mjs:656:33)
at async EventHandler.init (file:///home/container/node_modules/.pnpm/commandkit@0.1.6_discord.js@14.13.0/node_modules/commandkit/dist/index.mjs:638:5)
at async #init (file:///home/container/node_modules/.pnpm/commandkit@0.1.6_discord.js@14.13.0/node_modules/commandkit/dist/index.mjs:775:7)
Emitted 'error' event on Server instance at:
at emitErrorNT (node:net:1924:8)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'EADDRINUSE',
errno: -98,
syscall: 'listen',
address: '::',
port: 4599
}
Node.js v20.12.2
How come when I try to set-up the port for the vote listener that it keeps repeating?
Did you set it to a port thats already being used?
I don't think so since it logs that the vote listener is listening on that port right?
webserver is listening to 2000, but something else on the server/computer could already be using 4599
app.listen(PORT, () => {
console.log(`Vote listening on port ${PORT}`);
});
If that were true, it shouldn't send this console message idk
is your bot sharded?
yeah
well thats likely it, you're running this code on each shard. so its opening the first one, then the second shard launches and it cant open on the same port
ah
my reccomendation is only let it run on the first shard, then use broadcast/broadcast eval if you need it to run on a specific shard.
oh that's smart
Anyone know why when trying to export this function, the bot initialization stops half-way through?
export async function isLockedCommand(commandName, userId) {
try {
const voted = await hasVoted(userId);
if (!voted) {
const lockedCommands = ['bassboost', 'volume', 'web', 'vocalboost', 'setdjrole', 'loop', 'shuffle'];
if (lockedCommands.includes(commandName)) {
const user = await client.users.fetch(userId);
const embed = EmbedGenerator.Error({
title: 'Error!',
description: 'In order to use this command, you must `/vote`.',
});
await user.send({ embeds: [embed] });
return true;
}
}
return false;
} catch (error) {
console.error("Error in isLockedCommand:", error);
return false;
}
}
Any errors?
None, which is why it's weird. It just stops @ "database initialized"
import { isLockedCommand } from '../../events/interactionCreate/vote.js';
export async function run({ interaction }) {
if (!interaction.inCachedGuild())
return;
await interaction.deferReply({ ephemeral: true });
const userId = interaction.user.id;
const isLocked = isLockedCommand(data.name, userId);
if (isLocked) return;
okay, then isLocked is returning true so that narrows it down
The only case it returns true is if they have not voted, and if they are running a command that is vote locked
So log voted and your if statement condition lockedCommands.includes(commandName)
How come it just stops the bot init?
o
if(isLocked) return if isLocked is a truthy value, you return
if you do this right here, you will be able to tell if its working as intentional or not
ok gotcha
Not trying to self promote a server but join the official discord developers server. very helpful for people learning.
Discord Developers is one big mess and most people ask questions there and write about off-topic topics
I'd rather ask Tim 
lol
let tim enjoy his middle aged life in peace
lmao
gey guys this is my new login page, what yall think?
looks incredibly similar to crowdin
but well, you cant really stray too far from this layout anyway
looks fine
For me, there is too much free space on the left panel. I think it would be possible to increase the font a bit to at least fill the gap at the bottom
you'd want to center the content vertically
only on the right part right?
id also personally keep the text content to a minimum as its a login page, you shouldn't be putting too much info there as the goal is for someone to not spend too long on the page really
if you do one side, you'd have to do the other to match
notice the crowdin one posted by Kuu has both sides in the vertical middle
I think it's a bit redundant to say "Please login by providing blablabla"
since u already have captions below
(u also state on the left side)
crazy forgot that
makes a big different I feel
and yeah, don't comment the obvious parts 
meanwhile me finishing college and commenting "here is the start of my loop" π§
also something that's just me personally, I would tighten up the layout here. Make the gaps a bit smaller on the right side. The distance between email and login button seems unnecessarily far
but that could just be me 
i see i can try to do that!
i guess this is the finished product
I mgiht make that saturnus on the top instead of bottom as rn it seems goofy
clean
why is frontend so hard
based
/**
Checks if both values are equal
@param a - First value
@param b - Second value
@returns - Whether A equals B
**/
public boolean isEqual(a /* first value */, b /* second value */) {
return a == b; // Comparing if A is equal to B
}
i am just not creative tbf
YEAH
FOR REAL
i enjoy it as well but still
if you typed that out, you get brownie points
pre and post conditions for each functions be like
my cs teacher would literally give you -1p for each pre condition you forgot.
my comments actually go crazy π
part of why I'm lazy to write libs
I mean, the method names are awfully obvious
but I cant publish if I dont write the javadocs
I mean, I can, but the score goes to the ground
delted
imagine having comments βΌοΈ
imagine coding
imagine having a pc
Is channel.permissionOverwrites still a thing?
idk look at the docs
my multilingual stuff is now live in my latest bot, only took 4 days to generate all the language text for an 80,000 word interactive story while respecting the rate limits of the API I was using!
an insane amount of requests were made
I'm still in process of translating my cards to english
I mean, they are translated already by ai, but I need to proofread
I can proof read for ya
10 cents a word
π
I'd go broke lul
I can help proof read tho if you need
Aint got nothing better to do with the 8h I do nothing
π
smh you guys are overthinking it
simple as going google_translate("text here", "TARGET_LANGUAGE") and youre done
i really dont get why people do this kind of stuff unpaid
this is literally a for profit company
youre being used
this is not a charity
It's good to get experience
minus the completely disrespectful part of it on the company's end

sure but im not sure youd consider it professional experience so i doubt it'd help too much
you can help out if you want to sure nothing stopping you i just personally wouldnt do it knowing im helping a cause with no enumeration
I dont think anyone who does translations here think about the money they could be making. They just think about the community they could be helping.
Thinking like a true american
linguistic experience is one thing, and there's always smth to learn from it
and u can also use it if you need to cite previous experiences
I think translating for top.gg is a good oppurtunity to gain experience
Some of the people here could quite literally make a job out of it
if it was a charity or some other similar organisation it would be fine but these guys have the capacity and money to compensate at least a small amount to individuals taking their time to help out
Right...but the people who are doing so do it because they want to
It'd be nice if it was a paid position, then again translations started even before top.gg became its own company and had the capacity to hand out payments
they are owned by medal?
.tv*
@sick bear I'd appreciate if you didn't ghost ping me π

sure otherwise its more of a slavery thing
π
but like come on
thats a very big stretch
sorry i like to say thank you π
You're welcome for whatever it is lol
note that i said otherwise
if they were forced to do it then it would be borderline slavery
you accept my bot
without being compensated either
Okay but its literally them volunteering
by that same logic you are calling the brs slaves
No ones being forced to do anything
π
i never said it was anything otherwise
you said theyre doing it because they want to
and i said yes, otherwise it would be considered x
right, but there is no need to make that connection because its just not there
This is the wrong channel for this
sure but its kind of this argument with unpaid interns having to do the work of full time employees with no compensation
well, this is a different case tbh
I see the translator role more like open source contribs
since u dont have a quota
i guess youre right in that sense yeah you can compare it to projects like mongodb that are open source code (not open source completely) and accept contributions, but mongodb also has their own paid and proprietary atlas platform that makes use of the open source mongodb
actively working on this as well. I like Crowdin... a nice platform, makes it easy
Is this the Pavlov discord
no
Ok
Is there a way to get the raw voice packets from discord?
Looking at the docs I see no way
why
to spy on peopple?
what....
I need to be able to record & download conversations in vcs. As that is the entire purpose of the bot, let people record their conversations
Is that allowed by the tos?
Yea
So long as you are not using it nefariously
I've known a few bots that have done it, but they stopped because they got bored
but there is a popular bot that still does it, its in the thousands in terms of server usage
Well, I think u can get the audio stream from a channel
If the bot is connected there
You can, its just undocumented
Afterall, the client needs this info to play the audio
I dont use JS

Whatever u use then
songbird
What's songbird?
rust voice gateway lib
rust you say?
a bot?

Relatable
oh we're canceling Tempest Games then?
yeah we gotta take it one step at a time
CC & Bot
alrighty
btw aaron i'm afraid i can't work on CC with you today, i'm really sleep deprived

same
@sharp geyser Hey I had to ask smth
Let's say for example theres a command sending a request to mongodb and 20 people run it at once
How will the bot fetch data in such case?
Is it going to be one by one, like it takes first request, gives data back and so on 20 times
Or the amount of requests doesn't matter it'll just take all 20 requests at once and give data?
Because if it's the first case, I can see where the delay is coming from
Realisitcally that's fine.
It creates 20 different connections, and when its done with the data closes those connections.
Databases though are meant to be able to handle that much at least.
(I might be wrong on the part about it creating 20 separate connections)
Yeah that's not right
Thought so
Connections != requests

If you set it up like that then sure you could probably have a pool of 20 connections but realistically you probably have 1 connection
20 requests is absolutely nothing for a db though
Yea
Once it starts getting into the hundreds of thousands is probably where it starts tripping up right?
dang discord.net only got 4 properties, unlike discord.js' π
https://docs.discordnet.dev/api/Discord.IActivity.html
https://discord.js.org/docs/packages/discord.js/14.15.2/Activity:Class
Ngl forgot Discord.Net was a thing
do people actually prefer dsharpplus more than discord.net?
ngl forgot dsharpplus was a thing
π
I haven't touched C# since unity
Which was in like 2022

How is your bot coming along tho
@green kestrel is it possible to get raw voice packets with D++?
Or does the lib not support it
i find imo c# is much easier than nodejs and did the job well, but i hate the lack/unreadable of documentations from c# packages
π
you should look at java docs
I dont use java anymore thank god
but the docs for those packages were atrocious 9/10 times

hey u make music boats right
do u know how to convert raw pcm streams to mp3 files
LameMP3FileWriter ? idk I don't make music boat angmore
we figured it out
!!!
I just took that as an example number,
by "connection" or "request" i meant stuff like:
data = await bot.db.economy.find_one()
etc.
If 100s of people are running the command at once, it does make the bot slow overall I assume because that's what is happening.
I was wondering if the database replies to all such requests individually or it takes them all in at once
the speed or operations/sec your db can handle is all depend on the hardware it's hosted
funny
None of the commands registers and doesn't work. I don't know how to fix it either, I can't find it on the internet.
show me your command initiator
tabulate problem, fixed
oh tabulate sucks
my head is breaking
node:_http_outgoing:632
throw new ERR_INVALID_CHAR('header content', name);
^
TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["content-disposition"]
at storeHeader (node:_http_outgoing:580:5)
at processHeader (node:_http_outgoing:575:3)
at ServerResponse._storeHeader (node:_http_outgoing:451:11)
at ServerResponse.writeHead (node:_http_server:422:8)
{
'content-type': 'text/html',
'accept-ranges': 'bytes',
'access-control-allow-origin': 'localhost:8000',
'access-control-allow-headers': '*',
'content-length': '196',
'content-disposition': 'inline; filename="e.html"'
}
the only thing I could think of is the double quotes
pretty sure thats not needed
should be able to just do 'inline; filename=e.html'
not sure if what I just said would help, but thats all I can think of
everything else there looks normal
same issue
i dont think using a content-disposition of inline accepts any further parameters
oh you're right
type attachment however accepts a filename attribute
it's attatchment I think
I tried attachment instead too, same result
can i see the code for how you are doing this
setting the header and sending the response?
aaaah
i think i know what youre doing wrong
when providing multiple parameters in a header value it wants you to use an array i think
instead of
'content-disposition': 'inline; filename="e.html"'
youd likely do
'content-disposition': ['inline', 'filename=...']
same error
im not sure why its not working for you, i tried this with the http module and its setting the header and replying with it just fine
response.writeHead(200, "OK", {
'Content-Type': 'text/plain',
'Content-Disposition': `inline; filename="ah.html"`
});
can you try sending a head request from the client instead of get
ok I seem to have found the issue
its because I am setting content-length
seems to work as well
oh right didnt notice that
but why would that cause it
shouldnt a head response contain content-length for the get request
Maybe it was going over the length you set?
a head request should not return a body
by setting content length you are implying in the http request that you are also sending back a body
a head request is only for taking a look at the actual headers
so http spec doesnt allow setting a body
well
I am not sending a body
I am adding the header though because every cdn I ever headed returns it too
content-length is the amount of bytes you are sending for the body itself
if you dont send a body then thats even worse
because the request will likely also get stuck waiting on a body thats never going to come
technically implementations should ignore the body if it gets sent, but since you havent actually sent a body back in the head request it likely glitched everything out
@frosty gale I found the actual issue
its so stupid
the content-disposition header has to come before content-length in the header list
like what ????
so why not aet it that way
2 problems, first, how do i make the container-fluid div take the whole height...
Second,i can't scroll on mobile..
you need to set the max height
<div class="container-fluid">
<div class="row">
<div class="col-md-6 p-0">
<div class="d-flex flex-column justify-content-center align-items-center"
style="background-image: url('./layered-peaks-haikei-2.svg');">
<p class="mt-5 pt-5 text-light fs-3 fw-bolder">text!</p>
<p class="text-center mt-2 w-75 text-light fs-6">text</p>
<p class="pt-2 w-75 text-light fs-6 text-center">text</p>
<div class="d-flex flex-column p-5 pt-1">
<img class="w-25 img-fluid p-0" src="uranus-svgrepo-com.svg">
</div>
</div>
</div>
<div class="col-md-6 p-0">
<form class="loginForm d-flex justify-content-center flex-column">
<p class="p-5 pb-0 fs-1 fw-bold m-0">Sign in</p>
<div class="d-flex flex-column p-5 pt-0 pb-0 m-0">
<p class="mb-0 p-0 mt-5 fw-light">Email Address</p>
<input class="form-control form-control-lg" id="typeEmailX"
style="border-radius: 0; border: none; border-bottom: 2px solid #250656" type="email">
</div>
<div class="d-flex flex-column p-5 pt-2">
<p class="mb-0 p-0 mt-3 fw-light">Password</p>
<input class="form-control form-control-lg" id="typePasswordX"
style="border-radius: 0; border: none; border-bottom: 2px solid #250656" type="password">
<button style="color:white; background-color: #250656" id="loginForm" type="submit"
class="fw-bolder mt-5 btn">Login</button>
</div>
<div class="d-flex flex-column p-5 pt-2 align-items-center">
<p class="fs-6 fw-light">Forgot Password?</p>
<p class="fs-6 fw-light">No account? Create one!</p>
</div>
</form>
</div>
</div>
</div>```
i set it to 100vh first
That's the whole thing
i am concerned about fixing this.
idk how to fix those issues..
oh you want it to look like what it does on mobile?
look at my message:
2 problems, first, how do i make the container-fluid div take the whole height... (refer to the picture that i sent that shows the div literally only reaching half of the screen in height).
Second,i can't scroll on mobile.. (refer to the mobile picture)
well set the container to take the max height of the viewport
<div style = "height: 100vh" class="container-fluid"> still same
as for not being able to scroll, make sure you aren't setting overflow-y to hidden
mobile size login page I would not make the user scroll to get to the text inputs
if they typed a password or email wrong itll scroll back to the top
and they gotta go down again
poor UX
the sizing you had here was p good i thought
I know, but there's some other things below the login button i can't get to see for some reason
Also, why are you explaining what the service does on the login page?
Shouldnt that be done on the home page
Thanks for the input but at the moment it's not what i am asking π
I appreciate it tho
Well, I dont really see whats going on
i will change it later, but i gotta fix this first.
Unless container-fluid has css properties overwriting what you want
uh
should it not be
100%
not vh
vh is view-height

On mobile it should stop
which is why you'd set mobile specific paremeters (I cant fuckin spell)




