#development
1 messages · Page 293 of 1
transcend space and time, build a supercomputer to run 25 million 962 thousand 864 instances of bn.js at once, use all of those instances of bn.js to stack into a superclass called “eternalnumber.js”, max that out then you will have enough XP.
apparently i cant go bigger than 300k levels :/
why’s that
bc it just does this whenever i run the command
is it due to it taking too long to calculate?
you only have 3 seconds to acknowledge the interaction
if it is u can defer the reply then edit it
that’s what makes it show thinking
iirc
how u guys make bots?
We code them

weak numbers
I've finally seperated my buttons into categories 😭
there is currently 50 button interactions
i ended up rewriting my handlers for menus and modals too so they all get sorted
my latest update to my JsonDB util now has response times of as low as 0.03ms
caching is a beautiful thing
-# from my testing, thats 70x times faster than before
and i've improved batch operations to be up to 74x times faster 
-# dont ruin this for me
nah, this is just for small commission projects that will never have any actual use for a dedicated db
since i often take bot commissions for private single community bots, the need of an actual database is non existent
so in those cases i just use my json db
in a full production environment i obviously wouldnt use it because, personally not a fan of it
its just one of those boredom projects that i slowly improve whenever i feel like it
Just use string.db
it's 10/10
part of the assignment is create an app in c++ using max of 100 lines or less
1 line instead of 3, reckon theyd be mad or proud 😎
A little bit of both
may get my progress tutors opinion 
im curious how much respect hed lose for me over this
Last time I got told x lines or less for a js challenge, I obfuscated it so it was one unreadable line 
I love to do that
see i wouldnt do it if it was multiple lines, but for the ones that are single lines i would:
like this would stay as it is
if (choice == "today") {
time_t t = time(nullptr); /* Grabs the current time, in seconds */
tm* now = localtime(&t); /* Converts the time in seconds so its readable, into yy/mm/dd /h/m/s */
month = now->tm_mon + 1; /* Allows month to start at 1 instead of 0, for 1 - 12 format */
year = now->tm_year + 1900; /* Calculates how many years it has been since 1900, for accuracy
}
but this? 1 line should qualify
bool leapYearChecker(int year) {
return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
}
bc its still readable as one line in the function than multiple lines, when its in a single line 
If its readable as one line then it should definitely be one line
exactly
But if appears confusing as one line then it shouldn't be a one liner
if it can be one line it should be oneline
someone can learn the art of reading the horrible one liners
almost anything can be one line if you really try
the best is the javascript function to check if a letter is uppercase
for my next trick, my 1k line file will become a one liner
const $=_=>$>_
then I lose my jsdocs tho
or the for loop to get the nth fibonnaci number
for(let i = 0, l = 1, c = l, a = l; i < n; (i++, c = l + a, a = l, l = c))
the curse strikes back
you can also use the formula so you dont have to iterate all the way to it
wdym
Mobile Coders Be Like
looks like the classic chatgpt output
i feel proud, guess how many lines?
63
nope :P
2
definitely not 
its more than 50 but less than 100
even if i made that single line function into 3 lines, its still less than 100 but more than 50
I guess 50 -> 100
it checks for leap years, highlights the day you select if you pick your own date, and todays date if you select today
date mod 4 = 0
it goes as far back as 1970 iirc but hang on
oh wait thats to calculate correct days etc
It’s using a different calendar that’s why
yeah so my checker wont be 100% accurate for dates before 1970
but for a simple, max 100 lines to work with its pretty damn good
i think so
awesome!
Only thing I haven’t actually added is a fallback check to make sure you can’t enter a year below 1970, month below Jan and a day below 28, 29, 30, 31 (depending on year and month)
🔥
what nvme is that
Is JavaScript interpreted or compiled?
A mix of both
Oh, sources online say different ones and I put about one of them since I was confused
Compilation to machine code happens at the time of interpreting the bytecode
It’s called JIT compilation
But it’s not compiled in the typical sense of “Source code -> Assembly/Machine code”
Give me like 5 mins to finish walking home and I’ll send what I’ve put bc I feel like it’s incorrect now 😭
whats the ///, i rarely see three of them together
im guessing im partially correct then
based on what youve said
The stuff about threading is incorrect. JavaScript’s runtime is inherently single-threaded
The rest of it is mostly subjective. Saying that one is easier to read is mostly an opinion
from what i read online, it talked about js being multi threaded
JS internally has multiple threads it manages, but your code runs all on a single thread
oh
Worker processes are “kind of” multithreading, but that’s kind of a cheat. As far as I know, there is no real multithreading within a single javascript process
docstring comments in rust
otherwise // are ordinary comments
ohh
yes
I have 0 docs 🔥
and 80gb target folder
for a 20mb bin
me when #general message
now only god knows what my code does on my project that haven't been worked on for months
nah i'm sure you will soon!!!!
xDD
highly relatable (i don’t need comments i can read guys) (this is a joke)
lol just todo yeah, but most probably i will refactor everything again, since i do that project once a year, and my skill increased during the gap
really shows how awesome you are!

you tooo
so essentially js can only use one thread at a time but can process multiple tasks at the same time as compared to python only doing one task at a time?
it can process them concurrently (so it feels like its doing multiple things at once)
because things like io isnt done on your code thread
so while thats waiting, your code can continue in other places
so im along the right lines with that now then
yes
ty
im not sure, i do know it has multi thread capabilities, just locked behind GIL
ok fuck it
im hosting database and everything on arch laptop
and connect from main machine
like im tired bro
this pc has period
24/7
everyday a new issue
No
Python and JS have similar event loop architectures
Async python essentially follows the same idea as async JS, it’s concurrent but not parallel
im so confused
You are right in that JS can only use one thread at a time
But you are wrong in saying that Python is only doing one task at a time
Python and Javascript both have something called the event loop
The event loop allows them to handle things concurrently while waiting on blocking code to complete (usually I/O or network)
However it is all handled on one thread for both languages
Python and Javascript are what’s known as “concurrent”, but they are not “parallel” (these terms are often confused)
so this is wrong
Due to Python only being able to run one thread at a time during interpretation, it prevents several tasks occurring at once. Despite having multithread capabilities, Global Interpreter Lock prevents Python from this, which in turn causes scalability to be a much harder process
I mean it’s right and wrong. Concurrency is almost like simulated parallelism
TECHNICALLY, they are only doing one thing at a time. However, both languages can switch to different tasks when waiting on other blocking tasks, which gives the “feeling” of multiple tasks happening at once
If that makes sense
so it becomes a similarity rather than a difference
Yes
This is probably a stupid question, but when languages are single threaded or only use one thread does that refer to like the actual CPU and only having one thread on that?

pancakes and waffles!!
simplified yes
in the real world the kernel of your os moves around stuff all the time
it does get really confusing i dont blame you, but in general in async everything is coordinated by a single thread so you can run things that execute quickly on that single thread but offload tasks that can take a while (aka blocking) onto different threads
so that single thread basically processes all requests/messages and as soon as it hits something that could take a while it pushes that off to another thread and works on something else it can execute quickly while that processes in the background
people call this single threaded and defend that stance with their lives but i disagree
Wait so if it's pushing to another thread then how is it single threaded?
yep, actual code runs on that single thread but anything that can take ages (aka a network request, disk read, etc) is pushed onto another thread which handles that
takes ages is oversimplified here but its good enough
in comparison it does take ages
so in theory it is single threaded but in reality its still multithreaded because holistically that process has multiple threads doing something, at least from the operating system/outsider standpoint
im still really confused, so it doesnt get locked by gil? 😭
event thread isn't a separate thread from main
if it were then you'd not be able to lock your entire application by having an infinite loop inside a promise
Threading is very complex and the terminology is confusing
i have 4 points to do that id noted down for this report, if i end up over the 1000 and can remove the threading part without ending up lower than 1000 words ill leave it out for now 😭
i want to talk about c++ and c# still for it
you can compare async to a company ig, ceo runs the company (lets just say so for this example), ceo wants X done at the company to do Y but he cant do it himself because it will take too long and block doing anything else, so he offloads it to an employee and continues with the next task, when that employee is done he lets the ceo know and then when the CEO has time he does Y
not sure what you mean by gil though
gil is global interpreter lock
everywhere online talks about python being limited bc of that
That’s just the idea of not having multiple threads executing bytecode instructions at once
It’s another way of saying the interpreter is single threaded
that'd be actual threading, async would be akin to doing a group project but you only have one pen
except if you are using rust tokio 🔥🔥🔥🚀🚀 which runs all code on multiple threads secretly
then you have 4 pens for example
but yes, the pen example is better
modern c# nailed multithreading/concurrency
the task system is such a pleasure to work with and it ties really nicely into async syntax sugar. one of the best designs out there imo
wait
idk how to describe what i want to say hang on
so js runs the code, using things like settimeout() you can delay tasks briefly
thats what you mean right
the task is still done
just later?
Agreed
uhh...this Medium analogy is the simplest example I could find:
Imagine you’re at a restaurant:
- The Chef (Call Stack): The chef prepares one order at a time. If a dish takes a long time to cook, the chef moves it to a separate station (like the oven or timer) and starts working on the next order.
- The Waiter (Event Queue): The waiter keeps an eye on all pending tasks (like dishes in the oven) and brings them back to the chef once they’re ready.
- The Manager (Event Loop): The manager ensures the chef only works on one task at a time and keeps the workflow smooth.
so the bit about the waiter is similar to how setTimeout() works then 😭
im trying my best to understand 
setTimeout would be an oven (or whatever appliance you choose)
there
whatever is ran in setTimeout is the dish
the chef wont touch that task until it's "ready to serve"
which would be the timer expiring
yeah which is what i was trying to say, it still serves the dish, just later
yes
in a threaded scenario it'd be like having multiple cooks each doing their own stuff
this whole thing really shows how stupid i am 
nah it's pretty confusing until you get it, cuz for the programmer they all appear identical
the advantage is that it's lightweight and doesnt (cant) have concurrency issues, the disadvantage is that you cant really work in parallel and a busy promise can hang the whole thing
on the other hand threads can execute several tasks at the same time, but they're expensive to spawn and can run into concurrency issues if you're not careful
the cost is why some langs have both native and virtual threads, the latter working similar to js' event loop
yeah threads are super confusing
And also you understand most of these things when you know a language but maybe not to the same level, just through my use of JavaScript and how it's worked when I've used it I understand most of this in context but could not explain it
i love waking up just to see discord updates breaking my UI
didnt touch this stuff for months
"oh now the formatting doesnt fit"
How can I update the count of servers on my bot page?
i think my tutor may hate the way its written 
holy hell
This is v2, had to keep it 100 lines or under and with v1 and the validation checkers it was too squished and hit about 95 lines, so I broke it up, added more loops and it’s now 75
please save the number of days to a variable so u dont do up to 31 array accesses 😭
the for condition
int days = daysInMonth[month - 1];
else you'll access that array every single iteration + 1
yes, but the final condition check (the one that exits the loop) will also access it
oh?
it needs to check if it's false yk
so anywhere with this int daysInMonth[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
needs to be this? int days = daysInMonth[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
no, like, your array is the correct way to approach it (tho month days vary but anyway)
just save the current month's length to a variable
so u can do for (int i = 1; i <= days; i++)
they do vary which is why for leap years i have it adding a 29th day, and i map correctly the number of days :P
oh
i also have it calculate the correct day of the week that the year starts on
the validation checker only says its false if its outside the ranges, since im using while loops
probably a bit hard to read bc zoomed out
anyone know how my bot is offline but never crashed?
the js program is still running, no errors. But the bot is offline... bit of a confusing scenario.
hard without any information, context/code
the thing i could see is that something blocked the websocket pings to be replied and then closed the session
depending on the library or your code, it may be considered to be still running without logs or errors
Had to go do something and I just came back. The issue seems to have fixed its self.... I guess we will never know since there are no log messages and I did nothing. The bot is pretty much exclusively on servers that are fully dead so I can be pretty sure that no one has interacted with it too.
investigating a report
What report??
Some users trying to remove my bot from topgg
we don't disclose that


Pro tip: switching database midway through a project sucks.
I have spent 2 hours rewriting models and just updating my interactions like buttons and menus
I haven't even got to updating commands
you dont keep ur DDLs saved?
I keep them all inside my resources (tables aren't here since I use JPA) to recreate if needed
I just have a module for database functions so i can change them all in one place
👀 whats a good method of learning c++?
I would tell you if I knew c++ 😭
good luck with that!!
which languages do you know?
Javascript and a bit of python, not much D:
still good!!
I mean pretty fair
I just learn whatever im using at that time, haven’t been bothered to learn C
yeah me too, but I just feel like c has to be learned since its like fast lol
I already know too many other languages to not know C 😭
buy an arduino kit, do stupid shit, keep doing stupid shit, ✨ now you are decent at c++ and can continue
Oh I have a p4 😄
LOL
mhm, I personally prefer arduino boards for c++ fun (a lot easier to work with imo)
I just got one of them!
because with most arduinos, code size and efficiency is a real concern
so you need to optimize right from the start
helpful
I got excited when I saw the p4, so now I want to get back into it.
I heard the p4-m3 will be like $7~ on full prod
and the h264 encoder means you can stream video in high quality
should make great cat cameras for when I'm on vacation
yeah that sounds great
yall, what else should go on a github readme
Lua?? What for?
the game im making, and another side project i have
but if ive used/using/familiar with it, i added it
it shows what i know
nono
it looks nice though Noah, good job on it!
i made this on a test repo so when i post it as my profiles readme i wont have so many changes from testing
Yeah way better than mine, Idk what to put on my GitHub readme so I just made a simple one and let it be
But it looks great!
dank
is there a way to restart only a specific sharD? like my bot died in some servers but its working in others
Well. It depends on the lib. All that theoretically should matter is detecting when your WS connection dies
then reconnect
create a ticket via the #staff-tickets channel
not enough arrows
cant see what you are referring too
🤔
sudoku? 
pls do cls every update.
sincerely, guy who used to have daily assignments to make cli apps for 2 months
I’ll be having it update properly when I get better with it, so that it isn’t sending over again 🙂
so cute
ooooh that looks nice
ikr ikr
got some spacing issues other than that ive almost finished my bot
Will update how it goes when I’m more familiar but I’ll probably do some at uni during the class I have programming in 😛
I meant that as in an API request to give this server number to top.gg to display on your panel
Oh
@warm yarrow https://docs.top.gg/docs/API/v0/bot#bot-stats this???
API resource for a bots or apps on a platform like Discord
also use box drawing chars
oh oh and colors!
I plan to add colours too
I just need to learn more first 🥺
Hy
I do know how to add colour, I just want to get the rest figured out first
Ye that's the easy part
im stuck using djs. how can i monitor my shards and restart em?
it's probably the easiest API to use because of its simplicity
no example mentioned
lavalink wrapper is much easier to setup than topggpy
discord.py is much easier than topgg.py
And it is developed by more people I guess
they have more complex functions as well which is still easy to use
cus they have proper documention for each and every single letter with usage examples everywhere
its so simple for those who know py properly
not so begginer friendly
Discord bots are not beginner friendly in general
nope
they are
thats the issue right everything around dc is begginer friendly due to proper documentation
when you dont provide one ..... it becomes tough to understand how their api works exactly
documentation was so weak infact ai was not able to do it
@deft wolf
💀
Ah yes, AI
just what all programmers should rely on
creating a basic and advance examples might help for begginers just like lavalink and discord.py
feel like it’s the other way around “the documentation was so strong even AI can do it”.. I mean ai really isn’t that competent
humans can program better than ai
why to do hard work when i can do smart work.... small things like creating a discord bot .... AI. can do that ... when it comes to office work... AI cant help
uhm whatever you say man
work smart not hard
working smart according to me ....get the written stuff from AI ... have a look what AI has provided ...if all good ... deploy
write manually only when needed ... (work smart)
it is not smart work lol
it’s not even work
anyways can’t be bothered arguing about a brain dead topic
better than writing manually for hours...complete time waste
0 productivity
get the work done within few mins is smart work
it’s not even related to what I said originally, I told you AI is NOT better than humans at coding, and the top.gg api is really not hard to understand.. if you aren’t competent enough to do so, then that’s on you. it isn’t related to whether using ai is a good idea.
umm yes i implemented it .....had to write manually tho.....for small things like 1+1 i dont wanna write ...i ask AI to get it done for me .... i wasted my time on this just because they dont have good documentation
unrelated to what i said
not arguing about this
goodbye
your words : if you aren’t competent enough to do so....
it is related mate ..i
Hi, I have a bot long time ago but i think it has been deactivated recently for some reason. How do I reactivate it again?
Define deactivated
it’s not usable anymore even though it says it’s online
wait no it’s offline
do you really need examples for something that has the most basic usage? lmao
Oh yeah, if I’m not mistaken tho there’s only about 8 colours?
Then just restart it
but how? I think i lost my server to restart my bot
Then make a server, upload the code, and start it
i did but doesn’t work
Any errors or anything
no it just says offline but I have already uploaded my zip folder
Does the code actually start or is it just nothjng
It’s just nothing i think
Can the code run from inside a zip file because last I checked running files inside a zip isn't possible
What language
python
So can the .py file be accessed? So not in the zip etc
And how are you trying to host this
Some "bot hosts" prefer this way. You upload zip file and they do the rest
no it’s not in the zip file and I use Kata Bump to host it. I used another server before but for some reason it had been closed down and i couldn’t use it anymore
So how are you launching it
Never seen that in my life
I use KataBump now
No lile
Luke
Like
How do you run the file
What are you doing to run it
What command
What button
How
Why
I have the Rerun.bat file?
also doesnt this violate discord TOS to do this
i dont understand your question😅
Ok so
For your bot to work
You have to run the file
Katabump or whatever just keeps it online and running
You have to do smth to start it
What is that smth
Oh i created a server there and uploaded my folder. Then there’s a start button and I clicked it
What doesn't break Discord's ToS these days 
How does it know what file to run
Like did you put the file in the settings?
So if it's in a folder it should be starting:
foldername/filename.fileextension
there’s an option for you to choose when you create a server
Was that choosing language or file
language
yeah
SFTP Details, Debug info, Reinstall Server, Change server details
Can you send a screenshot
I would delete that from here if I was you
That has important info which can make people delete your files so I wouldn't keep that here
why would you ask for a screenshot then 😭
And none of that is particularly important, you basically need to try and find where you tell it what file to start, there should be somewhere you enter it but since I haven't used that platform before I'm not entirely sure then
I didn't know the stfp stuff would be just sitting there
Normally it's a click to reveal thing
if it wasn’t gonna be there then why would you need a ss
like, what were you expecting to gain if everything was converted
ah alr
Yes
So if app.py is in a folder, it should be structured in a way where it is like:
foldername/app.py
what happens when you start the server though ?
They said that it's just nothing
should this be in the host section?
thats like not possible
I don't know man 😭
The what section?
bro should try the python file locally see if it runs
like here?
@swift barn
thats the mistame your meant to unarchive that folder
in the project root directory
i did
so that app.py is here
It can run inside a folder
did not
no it cant
wait so i should change my file name?
But a regular folder yes
No
then change this to folder/app.py
Dw
because it isnt there?
(Fawkes/app.py)
still offline
What's inside the Fawkes folder?
Try and change it to Fawkes/Fawkes.py
Ahhh
Alright so you want to copy the contents of your requirements.txt file, and structure it like:
word word word
And then paste that in the box to the left of the Fawkes/Fawkes.py and then run it
but idk where to find it or do i need to create a file?
The box on the left, copy my previous message and paste it in there
basically, it's trying to find /requirements.txt but it's not there
ohhh
add discord
and all other python packages separateed by spaces
here?
ok so it's online now. Let me see if it's actually working
wait so the server is online but the bot isn't
What does terminal show
should i kick the bot and reinvite?
sorry but pls read the error 🥀🥀it says missing intent
Delete that
Please delete that now
That has your bots token it can be used to give anyone access to your bot
oh sorry didn't know that
No worries, just trying to save you pain in the long term
Go to developers.discord.com
Login and open your bots info
Go to the bot section, then enable the intents
Like this
The top one is supposed to be enabled, dont mins my crude drawing lol
ok and also i need to reset my token
If you need to reset it, then reset the token in the dev portal, then update your code to include it
ok will do it now
the bot is still dead
asyncio.run(runner())
File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/container/.local/lib/python3.12/site-packages/discord/client.py", line 918, in runner
await self.start(token, reconnect=reconnect)
File "/home/container/.local/lib/python3.12/site-packages/discord/client.py", line 846, in start
await self.login(token)
File "/home/container/.local/lib/python3.12/site-packages/discord/client.py", line 675, in login
data = await self.http.static_login(token)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/container/.local/lib/python3.12/site-packages/discord/http.py", line 843, in static_login
raise LoginFailure('Improper token has been passed.') from exc
discord.errors.LoginFailure: Improper token has been passed.
container@katabump~ Server marked as offline...
[KataBump Daemon]: ---------- Detected server process in a crashed state! ----------
[KataBump Daemon]: Exit code: 1
[KataBump Daemon]: Out of memory: false
[KataBump Daemon]: Aborting automatic restart, last crash occurred less than 60 seconds ago.
how come there's still an error for the requirement file
should it be the long one?
i already changed it tho
it should be the one below this right?
are you sure you changed the token? to the updated one? after you reset?
cos thats clear asf
yeah i mean i changed it after i posted that
ok ok
what other servers do you use?
me? i host mine on a vps
like which vps?
is it free
No
Nothing in the Dev world is free, eventually you'll be charged money. Sometimes with no warning.
this looks cheap
ok I might consider changing it after it's fixed
because it's still dead rn
not sure if it's my token because pretty sure i have already changed it
it's online now but my commands arent working
Depends on the terminal, newer ones support full range
oh im talking about this part
thats the color codes i use for the calendar, i havent used any other value for it 
they got a bit iffy once i decided to cancel my server with them but other than that they were always great
woudl recommend overall
👀 did they? wild
I too use galaxy gate and have nothing but good experiences with them. The discord staff is quick to assist with questions if needed.
I just use a raspberry pi 
How do i get past these rate limits?
bot1-1 | discord.errors.NotFound: 404 Not Found (error code: 10062): Unknown interaction
bot1-1 | WARNING:discord.webhook.async_:Webhook ID 1369357800144109599 is rate limited. Retrying in 3.00 seconds.
batch ur request, and respect the rate limits and retry again
when the ratelimits happened it threw defer errors saying they needed to all be deferred
yeahh so defer all responses
aw man
i gotta work through about 50k ish lines of code, basically just setting up reusable helpers to safe defer everything
i hit a rate limit out of nowhere, i dont think anyone was using my bot so what exactly couldve caused it is what im wondering
50k LOC in a discord bot is wild ngl
oh yeah its a massive project man
dont wanna go into details to respect advertising rules
its prolly getting closer to 60k lol
I am rusting 🔋
The enterprise level applications I’ve worked on are like 100-150k lines, with some fairly advanced functionality
50-60k better include sharding and respective IPC logic lol
Hell yeah
Rust my beloved
Been learning about some multithreading stuff that I’ve been neglecting, channels are such a simple but cool tool
async lifetimes 
I dont think I will ever posess the skills required to write proper async lifetimes
that requires 100 years of experience
I can imagine
I’d love to learn more about rust for distributed systems and parallel computing but school has been forcing me to spend a lot of my time on useless theory 😭
Application/interview season rn too
of course man
just becuase of funding its sharded and clustered on a ovh vps, but as we scale ill move to a kubernetes cluster via public cloud on ovh, or invest in pyhsical servers
Kubernetes my beloved
best of the best
ive been researching all week how massive bots scale and thats what i figured out
these guys are paying upwards of 10-25k a month on hosting
its insane
but they also make like 10x that a month
Kubernetes is pretty much the “best” solution for massive scaling
yeah
ovh rate is 0.02/hour for b3 32 and that equates to like alot when youre using 3 nodes for a startup
so its 0.06 x 24 x 30
so like 130 a month
im not pulling the trigger on that until i can establish a decent userbase
You don’t need to write for scale if you don’t have scale
It’s good to be prepared but don’t get ahead of yourself obviously
i am writing to scale though because i want this to scale
everything is already setup i have a full backend with redis, postgres, etc
You can write for scale but don’t overengineer until you have a proven concept
Yeah that stuff is fine
But I meant like multiple nodes and k8s deployments, microservices, etc
It also depends on the stuff you’re processing
i have a vps3 on ovh and i think it can reasonably handle a load of 25k servers given my shard / cluster setup
im not gonna push it though
id upgrade to vps5 before then doing k8 and kubernetes clustering
Bots with real time voice/audio streaming features are significantly more computationally expensive to run than others
yeah im not doing that
Whereas normal interaction based bots can be pretty lightweight, especially if you don’t need gateway
again, not trying to break advertising rules, but its exceptionally better in almost every way to dank memer
full fledged economy bot
so mainly interactions
If it’s fully interactions, web servers can be pretty light
You’d be surprised how many requests you can handle
yea
i ran into a big bug though with rate limits
so ive been patching all of my code lightspeed lol
wtf thats a big bot
not a bot
what application?
game server management panel
i dont know a bit of rust or c++ i can only imagine the headaches
tbh ive had a ton of fun with this project
@wheat mesa did u mean me lol
there are always points where u need to think of an issue for 2 days
but in general its nice
Yeah sorry driving lol
my bot is almost entirely discord.py (am using sql for schema and table creating) and i also am using html for my website
im not a big js believer for discord bots despite it having early access to components v2
I will say that if you’re intending to build for scale, python probably isn’t going to be the best choice
Python is notoriously slow
If you’re mainly bound by I/O like network calls then it’s probably not a problem
But if you’re doing heavy CPU intensive work, Python is going to be pretty slow
Python definitely isn’t a bad choice for a bot but just won’t scale as well as some other languages
Which that’s fine, if you really need to, you can rewrite later
Yea
There’s almost always going to be something you can optimize, doesn’t mean that it has to be perfect
it would take a while though wouldnt it
Assuming you’re not familiar with some other languages, yeah
0 experience
C# and Java are both pretty good in terms of a balance between complexity and performance
Rust and C++ is where you’ll see much better performance increases, but with the penalty of increased complexity and development time
Yea
Would you reckon that the top 0.01% of bots are using that, i tried to look everywhere online and could only find out that most are using js
Scalability isn’t necessarily always about the language. It’s about how your architect your app
These languages are all capable of writing terribly slow apps if you are using them poorly
Thats true
loop {}

The real gains will come from optimizing your architecture at scale, e.g. using a database that is close by (or ideally in the same data center) as your host, or being able to offload work to somewhere else if it doesn’t need to be done immediately, etc
Yea
Async message processing queue systems are a fantastic example of offloading work to somewhere else. Producers and consumers are completely decoupled and work is only performed when the consumers can take a message
I cant believe how much engineering goes into this stuff
Yep
Which is exactly why you shouldn’t fully focus on it yet. Prove your concept before designing for scale
There’s a billion ways to optimize, but having a super optimized app that nobody wants to use is also a pretty bad problem that can’t be solved by more engineering
Yep
i totally get that
im just working on getting this thing out there
and it is hard because everyone thinks that its either a nuke, a blockblaster phish, or another type of malware
Using OVH is the main issue overchsrged prices and bad support 
You don't need $130 a month to run something at best medium scale for you
Hetzner?
I heard it’s way cheaper
Yea hetzner is what most people use i also have another host that i bought hybrid dedicated server for a lot less too
isnt it way less secure though? thats why i went with ovh
What makes you think that?
It's only less secure if you do something dumb but other than that nope
Also docker can help with security too
Systems from cloud service providers in general are pretty secure assuming you don't leak your creds somehow
Or your software doesnt have vulnerabilities. Even if, can make certain things not public facing
Okay
ill look into it more
thanks for all the help
ill stay on my vps for now until im ready to scale it
Not me being asked if I knew how to make an app, like one day maybe (considering I’m in game dev) 😭
might be a dumb question, is there any method to check if a role is a bot role (like when you add Dyno and your server now has the Dyno role) within d.js
yes
{
icon: null,
unicodeEmoji: null,
id: '874846937747161120',
name: 'Dyno Premium',
color: 0,
hoist: false,
rawPosition: 22,
permissions: '8798227229887',
managed: true,
mentionable: false,
tags: { botId: '168274283414421504' },
flags: 0,
createdTimestamp: 1628650163829
}```
managed: true
they wouldn't be in business if that was the case
its all good having a host that is fast and cheap but if it isnt secure then its sort of pointless
for sure
Im definitely looking at scaling it when i reach more people

Downtime isn’t a problem on majority of hosts. Unless you’re going with some unknown provider then you’re not gonna have an issue with downtime
no no i mean for like updates
i know its usually like 2 or 3 seconds but sometimes it can mess with the bot especially during timed events / commands
Why would that be an issue? You can redeploy in a few seconds
Ah you mean in the middle of things
yes
have you seen how dank memer does bankrob?
how its like a countdown thing
similar story here - i just wouldnt know what to do if something like that is going on and the bot just up and restarts
and also some things that cant really be stored on the pg tables
If you're using an interpreted language like JavaScript, there are ways to hot reload things that are bound to receive changes and just not touch your core architecture.
my bot is coded mainly in discord.py
shameless plug here
I remember you wrote this after I complained about how dogshit the file cache was for hot reloads in es6
It is not shameless at all. Some huge shit was added as well where you can update existing class instance methods and remember variable values across file reloads. I am genuinely proud of heatsync
Take a look at "cog reloading"
ight
how do i downgrade a version in Python
Uninstall the current version and then install the target version
If it’s a similar thing to node, should be able to just install target version and use the version manager to swap
hit and miss with that
That’s why I said if it was similar, since I don’t really know how it works with python 
either venv or system installation
so satisfying
Is that py?
its rust
Ohh
why not use bitwise for permissions
because they need to be extendible
i picked that design up from discord and so far applying it in my projects is smooth af
ah
yeah I gather
Hey. I have a Gacha Game bot.
I was wondering jf anyone here know how to automate rewards from voting for the bot?
Say the user votes the bot. It should automatically fetch and give some rewards.
I am really struggling to figure out how to get it to give the rewards automatically, without the players having to run the command 2 times to get the rewards.
If you have a tutorial or know how let me know please! 🙏🏿
top.gg webhooks
the amount of heap allocations coming from that struct makes me want to scream
i wonder what allocator rust uses
hope its jemalloc or something since youd want to avoid heap fragmentation with lots of allocations and frees
iirc they moved away from jemalloc because they didnt want to be dependent on it
i believe they still recommend it, they just dont ship with it anymore
something like that yea
or it was just that they wanted to stick to glibc default allocator
sadly jemalloc cannot save me either 🙏
1GB memory usage after 1 month uptime, with 95% of it being unused
(I blame redis values of up to 50kb)
So I know there's an API endpoint to get command permissions in a guild, but is there one to get the overall integration permissions?
im getting the error:
AxiosError: Request failed with status code 500
when posting server count to top.gg. this used to work, i haven't changed any code:
const result = await axios.post(
`https://top.gg/api/bots/${clientId}/stats`,
{ server_count: client.guilds.cache.size },
{ headers: { Authorization: postToken, "Content-Type": "application/json" } }
);
I've just tested replit and holy fk is annoying how can anyone use this, forced AI features and using AI to specifically create a project instead of frameworks and menus.
You have to open a new tab with a large scroll dropdown menu with a bunch of annoying choices that have sub-options and sub-menus.
jemaloc is dead? oh my
i remember one time when i added jemalloc to my bot and it reduced memory usage by almost 50% lol

though i think facebook forked it and is going to maintain it now
which is confusing because i thought facebook maintained jemalloc anyways?
a lot of the maintainers of jemalloc were facebook
its a good allocator so companies and developers arent going to let it die anytime soon
from what i understood, facebook has always used a version of jemalloc that is tailored specifically for their systems
the general purpose version they released was actually the modified one, not the original one
i guess they just got tired of maintaining a general purpose version that is much harder to maintain than the tailored one they have in-house
facebook so big mfs have to start maintaining their own allocators now because existing ones arent good enough
they all do that
google has their own allocator too
all big companies have their own in-house nasa tech because anything slightly general purpose is not good enough
why does my audit log fetch return nothing?
const auditLogs = await oldState.guild.fetchAuditLogs({
type: AuditLogEvent.MemberMove,
});```
this is what i am using.
yeah there are if i check the dc audit logs
they are just not being returned lol
always a collection of 0 items.
How to claim crypto currency reward after voting
aaand left the server
Lol what kind of scam is the dude falling for
do you have the permission?
Requires the VIEW_AUDIT_LOG permission
Shouldnt it error if the request fails 🤔
Not on promises I don't think.. unless using a .then.catch type deal
Discord.js has always kind of been broken when it comes to audit log requests. I tried it before and it wouldn't work most of the time
Some bots might be directly requesting the API and/or bypassing the cache, which would technically work but is more susceptible to rate limits
One way you could potentially do it is by using webhooks, but I don't know if it's more efficient to do so
i wonder how much of their engineering is actually overkill where they couldve used an existing solution without developing an entire new thing
or at least use an alternative which fits their requirements
there has to be at least a few instances
i can imagine instances where it mght be overkill, but i can also imagine instances where they have no idea what they are doing
I hate myself
@lyric mountain I need some advice on how to avoid this 🙏
I can still change the api if needed, fairly early in development
thought it was py at first , rust is clean
Wow sql can get really ugly
all rust orms i tried sucked 🙏
that's a lotsa left joins
that may not even be the worst part
1.3kb per server, and some of the struct is already boxed (total likely closer to 2kb)
that prob wont fix the general slowness issues tho
Nothing beats ef core tho
is the issue mostly query speed or payload size?
Nah diesel is just "nicer" to use
query is slowing down a lot yes, but payload is also a growing concern
It likely won’t fix any query speeds
for speed I'll need the output of EXPLAIN
just add that before SELECT
it'll give the steps & metrics of the select
The sad part about ORMs is that complex queries are messy
And sometimes not efficient, and people using an ORM likely never really learned SQL - and then good luck getting them to optimise a query by manually writing it
and for payload, you can use a lazy loading approach
I'd rather use something like sqlx
as in, have some fields only be fetched when needed
YB Batched Nested Loop Join (cost=5.35..436825.31 rows=1000 width=13701)
Join Filter: (nest_eggs_1.nest_uuid = nests.uuid)
-> Hash Left Join (cost=5.35..1106.97 rows=1000 width=12573)
Hash Cond: (servers_4.uuid = server_subusers.server_uuid)
-> YB Batched Nested Loop Join (cost=0.00..1098.89 rows=1000 width=12509)
Join Filter: (servers_4.egg_uuid = nest_eggs_1.uuid)
-> YB Batched Nested Loop Left Join (cost=0.00..1000.55 rows=1000 width=11132)
Join Filter: (roles.uuid = users_1.role_uuid)
-> YB Batched Nested Loop Join (cost=0.00..902.22 rows=1000 width=10512)
Join Filter: (servers_4.owner_uuid = users_1.uuid)
-> YB Batched Nested Loop Left Join (cost=0.00..803.89 rows=1000 width=7636)
Join Filter: (node_allocations.uuid = server_allocations.allocation_uuid)
-> YB Batched Nested Loop Left Join (cost=0.00..690.00 rows=1000 width=7076)
Join Filter: (server_allocations.uuid = servers_4.allocation_uuid)
-> YB Batched Nested Loop Left Join (cost=0.00..591.67 rows=1000 width=7020)
Join Filter: (backup_configurations.uuid = servers_4.backup_configuration_uu
id)
-> YB Batched Nested Loop Left Join (cost=0.00..493.33 rows=1000 width=642
8)
Join Filter: (node_backup_configurations.uuid = nodes_1.backup_configu
ration_uuid)
-> YB Batched Nested Loop Left Join (cost=0.00..395.00 rows=1000 wid
th=5836)
Join Filter: (location_backup_configurations.uuid = locations.ba
ckup_configuration_uuid)
-> YB Batched Nested Loop Join (cost=0.00..296.67 rows=1000 wi
dth=5244)
Join Filter: (nodes_1.location_uuid = locations.uuid)
-> YB Batched Nested Loop Join (cost=0.00..198.33 rows=1
000 width=4672)
talk about stairs
ok so, that's a concerning amount of counts
are u using the uuid datatype or string?
datatype
do all these uuids have indexes on them?
yes, they are all primary keys
well, do you need the backup configurations everytime?
nope, only when an admin wants to edit a server or a user wants to create a backup
better make them lazy then
I think this is the general problem, im loading this 2kb struct into ram for every server request, even if i only use 3 fields of it
yeah that select is way too big of a polycule, it's better if you include only the essential fields and defer the rest for a when you actually need them
you can also implement graphql but...it'll require implementing graphql
I guess then only load all server fields + owner data + subuser data since those are basically always used? (owner & subuser for checking auth)
yep
my frontend dev is suing me
hes suggesting I load "minimal" metadata on paginations (uuid, name) for the objects, and the full object when requesting the server directly
I guess that could work too? or would the joins still eat up performance
that'd be lazy loading
{
id: 1234,
name: "abc",
address: { loaded: false },
parents: { loaded: false }
}
basically
no no, what I explained would be
{
id: 1234,
name: "abc",
address: { id: 1, name: "hi", ...loading },
parents: { id: 1, name: "www", ...loading }
}
I mean, the idea would be to reduce the number of joins to a minimum
if ur getting any data from it then it's still a join, just with reduced payload size
yep
this would already reduce a few joins though
since I wouldnt bother with nested stuff anymore
Hi
pov you use a relational database
but yeah i think lazy joins is the simplest work around aside from just dealing with loading the entire thing, have an api route for parts of the resource you use together/need
if you need multiple you can also request each part in parallel
or.. you could sort of reimplement graphql where you send a query containing the parts you need in an array/list of booleans, then the server can conditionally add joins for them in one single query
usually im one to hate graphql and how complex it makes api calls, but with your requirements i think it would do wonders and fit in very well
ill probably try cooking something up with rust traits
but I have promised my frontend dev to not touch any code until monday (im fighting the urge=
Hiii, any one know an ai that is free to use with no limits like cleverbot use to be?
a bot or an api
api
download a model locally
¯_(ツ)_/¯
free and no limit does not exist unless you're running locally
actually max_price=0
what does context and tokens mean here?
higher = remembers more, but worse quality
how big the model is
lower = uses less resources, may be less accurate (also depends on quantization)
worse quality?
the more context you give it, the more it just makes up and pulls out if it's ass
until a certain point
so deepseek 3.1 free is the best one?
amount of tokens or context window != quality
and not every model is good with everything
one might excel at math but suck at text writing
one might be awesome for literature but suck at coding
chat how do i get the id of a custom emoji if i don't have nitro
that shit dissapears even after using \
inspecto patronum
You can also right click the emoji and copy the link and the link has the id
apparently inspect element works on the app too?
im sorry is discord trying to hire me
Dev Tools always worked in the app
Only in canary unless you specifically enable it in normal version
I don't remember activating it, but maybe I did it a long time ago and forgot. "Developer mode" is also something I think is enabled by default but then I remember that some people don't need it 
that's why i just said to use inspect element?
oh lol
To enable inspect element in the mainline app, you have to edit the config value with some really funny key
??? i never edited anything i just clicked control shift i and it opened
And you're using the default client? Not canary or ptb?
to be honest i had the same
never added that weird entry in the config json file
yet have inspect element on the default client 🤷♂️
Maybe they added it back recently
it definitely did not work a few months back when I reinstalled my Windows
Hi, some friends and I are trying to create a bot, but none of us are good at technology, and we're really confused with the commands. Could you please help me? We don't know anything.
Then start by learning a programming language
Bots are not for beginners that don't know anything as you say
I created the bot, the problem are the comands
We don't know anything.
As I said, learn a programming language
Which will tech you how to read docs aswell, which is needed for making bots
Creating the bot in the Discord dashboard is a few clicks, making it work needs you to code it
Hence, learn a programming language and how to code - then after some time you will know how to code a bot
or use a pre-existing bot, chances are something already exists for your needs among the thousands of bots that do the same thing :^)
hello
or use the latest groundbreaking developments in LLMs to make your bot :)
llms are unable micro-optimize my c/c++ code so im not out of a job yet sadly
they will happily use a heap allocated vector in tight loops instead of reusing buffers
At least you have time to make some coffee
boss sorry I can't meet the deadline
i hate tghis so much
but some things are just so annoying to do manually
its still annoying to check every single change made by the agent to make sure its not wwrong lol



