#development
1 messages · Page 222 of 1
contabo is so fucking shit
But @crystal wigeon it's most likely not the performance of the vps itself once you host something on it, just the interface. IIrc the vps itself is using a distributed file system, with other words the interface you are seeing is not even real. It actually stores all data into smaller blocks across a big cluster of machines.
so what it does, is it must gather a lot of blocks from all the machines and concatenate them, which looks and operates just like it's running on your bought machine (which it isn't ).
Scam wtf
If the network speed is fucked, for example the vps is ran on american servers and you are european, the download and upload will be slow too.
It's not. You still get the computational power you bought for, but the files are just distributed over many other machines.
To be fair, a lot of vps's i have been using tend to use dfs. It's the only way to work with big data realiably.
not sure.
as long as the program itself is ran with decent performace, i don't mind the latency and slowness it comes with.
Tbh I have one more vps on contabp which had like 8gb ram and 4 cpu. My docker build there was 20s
But I bought new upgraded machine
Cause cheap price
On the new machine it’s so slow I was expecting it to be same or faster
Why the fuck did each server turn into a rainbow lightshow brev
Even establishing a redis connection which is on the same machine takes time
Lmaoo fr

in what region is contabo located?
It's german right
US
But this isn’t about network latency
I have redis installed on the same vm as my program
there’s noticeable delay when starting the app
Its german g
i see.
If it's using a dfs there is indeed going to be a startup delay.
It's because the blocks are stored over many smaller computers basically. the client must contact the namenode (the master of the cluster) to gather all blocks, and to start processing tasks on each block.
But that doesn’t explain how my other vm has little delay
Which is in the same region. US
The other vm is also running on contabo right?
yeah
It still needs to gather and concatenate all data, so even that vm shall have a delay.
even if it's sent over a network closer to yours, it's still having to process everything.
yes, but the process still shall go like this;
i want to run file x -> namenode -> namenode gathers all blocks, by probing machine 1,2,3,4 -> these machines load the data into memory for you to run. All probes, all transmissions are done over the network. And well, depending on the used framework it adds a heavy delay.
Unless they are using apache Spark known for being pretty fast as it caches its data.
I’m not sure what they’re using. Is there a way to check it?
Welp ig I can live with the delay given that it’s way cheaper than any other provider

let me check for you
slowest build with bun..
bruh turns out the same exact code that works on my pc and my server will not work on my pi. audio still drops out after 30-40 seconds with no errors at all.
fun times
what location do you need it in
imagine using bun
US
(it randomly segfaults in cis)
ah yeah its pretty much the cheapest there
ye
only because macro build feature
that's like hardcoded innit
/ too much work
only using bun for that and that only
if you have 2 machines on contabo, and one of them is slow when the other isnt, you probably need to complain to their support
they will either fix it or transfer you to another instance
shit like that happens in hosts all the time, some instances are just borked
run some benchmark scripts of both of them and then send them a complaint
damnn
hmm i see. thanks for the info
wacky load balancer go brrrrrrrrrrrr
you thought that was bad
pretty short
fastest rust build time
exactly
I know, I didn’t recommend them the vps. I just stated what they are running their framework on
theres also datalix, they have pretty amazing prices
Yes, but I think it's mainly about the location in the US. Datalix unfortunately only offers Germany as a server location 
does anyone know why OpenPGP said gpg: no valid OpenPGP data found. (after running the last command)?
- name: Prepare java binding
working-directory: bindings/java
run: |
echo 'org.gradle.jvmargs=-Dfile.encoding=UTF-8' >> gradle.properties
echo 'signing.secretKeyRingFile=./keyring.gpg' >> gradle.properties
echo '$MAVEN_GPG_PRIVATE_KEY' | gpg --dearmor > ./keyring.gpg
env:
MAVEN_GPG_PRIVATE_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
MAVEN_GPG_PRIVATE_KEY is formatted as ```
-----BEGIN PGP PRIVATE KEY BLOCK-----
urmom
-----END PGP PRIVATE KEY BLOCK-----```
cc @lyric mountain @quartz kindle
i have no idea, but perhaps this will help:
https://stackoverflow.com/questions/61096521/how-to-use-gpg-key-in-github-actions
answers suggest using base64 key and pipe to base64 --decode then pipe to gpg
as well as separating the key decode/import into a separate step
I am Blockchain Full Stack Developer. Who needs a developer?
Me
I'm too lazy and don't want to program because of this temperature
i tried, and it could not able to decode the private key from base64
i tried removing the newlines and the -----BEGIN PGP PRIVATE KEY BLOCK----- and -----END PGP PRIVATE KEY BLOCK----- but to not avail
@quartz kindle wait i figured
try running with sudo
isn't --dearmor just... converting the base64 string in the private key to binary
and storing it in a .gpg file
idk never used gpg exdee
get conned
im sorry but uh if you aren't experienced with EVERYTHING in the realm of programming and computer science, then that role doesnt belong to you

im experienced in pretending to be experienced
okay tim
do you know how to convert a base64 string to binary and store it to a binary file in linux
https://www.youtube.com/watch?v=LfaMVlDaQ24 watch this entire video then come back to me
Learn the basics of computer science from Harvard University. This is CS50, an introduction to the intellectual enterprises of computer science and the art of programming. The course is taught live every year and this is the 2023 version.
💻 Slides, source code, and more at https://cs50.harvard.edu/x.
⭐️ Course Contents ⭐️
⌨️ (00:00:00) Lectur...
it's only 25h long
you got this
:)
can't wait to become a google engineer in 25 hours
nope
wtf man
wtf tim

btw does gpg care about trailing newlines? because i've seen people use echo -n to remove the trailing newline before piping to gpg
i don't think so
🔥
time to hack to tim's account
openssl base64 -d <<< "base64stringhere" -out file.bin
built in b64 things
linux already has a base64 command built-in, no?
i think echo $PRIVATE_KEY | base64 -d > shit.gpg works
try echo -n
what does that do
command.data is undefined
whats up my swag devs im back here with the same issue from 2 weeks ago
we're having a recurring issue with our bot (in one server, not sharded) randomly hitting 100% CPU. when i manage to get into the server to check why, these are the only errors i see spawned from undici:
- ConnectTimeoutError: Connect Timeout Error
- SocketError: other side closed
- Error: write EPIPE
- RequestAbortedError [AbortError]: Request aborted
d.js is v14.15 / latest stable


at this point its better to ask in the djs server themselves
its a dep of djs
It's likely something they themselves are doing, or an internet connection turning shite
i'll try again 
because it's saying basically discord is refusing the connection / closing it
the cpu spike today was very short compared to how it was prior but still happening
inchresting
I'd recommend asking in djs
thank u for all ur help 
its okay HAHAHA i cant figure it out for the life of me either
i would say that error is not the cause, but a symptom
if you have 100% cpu, the program is blocked/frozen, meaning network requests will eventually break/timeout

do you know more or less what the bot is doing then it freezes?
when i get in and check to see whats causing it, those are the only errors though
outside of these spikes, it runs under 4%
so, i don't know when its doing right before/as it happens, but its made to handle threads & track our support team's messages in our support channel
here's an example; it autocreates threads for users when they send a message in the channel, deletes/reposts the sticky message we created
internally, it queries to our db (we use enmap) to indicate the user has a thread. when one of our volunteer team members reacts to it with a checkmark or sends a message in the thread, the db is updated to reflect that
hmm
from what i remember, enmap is not very scalable
not saying its the problem, but would be worth doing some tests against it
for example benchmarking some of the queries
tbh we thought it was enmap at first too, but after talking to alterion, we realized it mightve been the intense caching we were doing at the time. we've since removed that, but it's still spiking, just not as often
did you try running some benchmarks against it?
ie: ```js
const t = performance.now();
// run enmap query
console.log(performance.now() - t);
i'll try that now
thank you so much
you can also add some timing breakpoints to the bot's code paths
ie from event received until the end of the action, add some timer logs in key places
to see the timings of the code in general
ur uploading to sonatype?
if so, the place where you supply your key isn't on the project's build file
hello haku
for what?
ah, so that's why it was verbose af
ye
surrealdb has graph relations built in
its one of the ways of doing relations but not the only way
as far as how to do that query from yesterday without graphs no fucking clue
tis still a new db
so its syntax for manging it is still WIP
part of the reason you have to define each field for a table like that is because by nature tables are schemaless
they still haven't worked out their schemafull syntax for defining tables and its fields
The DB is only roughly 1 years old tbf
@lyric mountain I need help with a query
installation is a 2d array, in each object of that array I need to remove the "optional" key from the object
just ask chatgpt
how tf do I do that
too stupid
gpt 4
I am using gpt-4o
its still stupid asf
trying to use pg 9 features
that were nuked
ok I solved it with this amazing solution update "minecraftServerBuilds" set "installation" = replace(installation::text, '"optional": false,', '')::jsonb[];
yes its cursed

most people dont realise this, but working with json as strings is way faster than using it as an object
its just much harder to do json things with raw string tools only
i figured it out, i made a .js command file and didn’t put anything in there 
you can also do command.data?.name || "unknown"
you know what I just realized tim
if my servers ever generated a colliding uuid as request id, it will infinitely spam my cluster servers every 5 second
and stack up
lmao
this is why you don't use uuid in dbs
@sharp geyser@neon leaf actually that sparked my interest a bit for researching id generators and apparently cuid2 is the most secure of them all
but the slowest
huehuehue
depends on where
dang I just remembered a video that actually spoke about uuid and also mentioned a little about cuid2
let me see if I can find it
just use a random email as identifier
It's entire purpose is explaining why UUID is a bad id, and it speaks some on why its bad in a database
ez
https://www.youtube.com/watch?v=a-K2C3sf1_Q here it is
THANK YOU PLANETSCALE FOR SPONSORING THIS VIDEO
UUID's have a time and place, but I rarely see them used correctly. I've wanted to do this rant for awhile and I'm happy I did because CUID2 is NOT a good option either 🙃
SOURCE
https://planetscale.com/blog/the-problem-with-using-a-uuid-primary-key-in-mysql
Check out my Twitch, Twitter, Discord ...
there are many reasons why it can be bad depending on the use case
inefficient due to alphabet choice and dashes, non sortable, etc
it def has its uses outside of db
well anyone trying to sort any kind of uuid is not sane
if you want something to use as primaky key you need a sortable id, like uuidv7 or ulid
uuidv7 is sortable?
it seems to me a uuidv7 has the same index
0190222f-1205-7d2f-9262-f6aad263e458 bolded remains the same, but everything after changes
uuidv7 has a timestamp in the front, so its sortable by time
ye
cuz it never changes
it does
its not milisecond resoluition
what is it then
because that front part stays the same no matter how many times I change it
only the stuff after the first - changes
im like 99% sure yes
maybe not a real impl no
ok now it changes
What kind of timestamp is it?
This document presents new Universally Unique Identifier (UUID) formats for use in modern applications and databases.
Because I can generate quite a lot of uuids with the same front index
neither did i
ima be honest
cant even understand that
💀
unix_ts_ms:
48 bit big-endian unsigned number of Unix epoch timestamp as per Section 6.1.
ver:
4 bit UUIDv7 version set as per Section 4
rand_a:
12 bits pseudo-random data to provide uniqueness as per Section 6.2 and Section 6.6.
var:
The 2 bit variant defined by Section 4.
rand_b:
The final 62 bits of pseudo-random data to provide uniqueness as per Section 6.2 and Section 6.6.
| unix_ts_ms |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| unix_ts_ms | ver | rand_a |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|var| rand_b |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| rand_b |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+```
also
each row is a segment
👀 I'm really confused.
I thought webhooks in different channels had different ratelimit buckets.
But aparently thats not true
you thought wrong champ (im kidding idrk)
I wonder if its tied to the IP
Top-level resources are currently limited to channels (channel_id), guilds (guild_id), and webhooks (webhook_id or webhook_id + webhook_token)
so its per webhook_id not per webhook channel
What the hell
I'm not getting that at all
the 3d2712a9e4fe17cc9d3fed4a8e672e5f
is the bucket
the other is the webhook ID
huh idk then
I'm just going to assign a webhook ID to a specific IP
Thank you hetzner for the IPV6 block
Not my IP nooo
X-RateLimit-Bucket - A unique string denoting the rate limit being encountered (non-inclusive of top-level resources in the path)
so if i understand is that even if the bucket is the same, it shouldnt count if the top level path is different?
idk discord is confusing af sometimes
same :c
you got infected by woo's pc
the woovirus

im on windows
yes
a ok
I think its
I will run
💀
ill watch it later
ive almost finished stripping out ALL cache from triviabot
its gonna be a big update
it'll cut the total memory use down for 18 clusters from 7gb to 1.4gb
78mb per cluster
why aren't you caching
dont need to
the only thing im caching rn was guilds, channels and roles, and ive eliminated the need to cache all 3
18 clusters is crazy
channels and roles were needed for dashboard and put straight into the db, so now i feth them on the dashboard when the user visits a guilds settings page
208,000 servers
a cluster is 8 shards

208k guilds using 7gb of ram on D++? I thought D++ was more memory efficient /j
so disappointed
lol
role cache sure adds bloat
people add ridiculous amounts of roles
colour roles and stuff
im sure caching guilds adds a lot of bloat as well
ye
nah its 60gb+
its the majority of 7gb
What the actual heck is discord doing
i dont wanna think how big thatd be in js or even worse, in py
but the sheer amount of roles people add im sure outweighs guild cache
You're right, they're the same bucket, different ratelimits
i didnt even realise, when testing it on my server, my server has 68 roles
mac uses 16gb on his dedi
and i dont just add tons of silly ones
it was like 24+ on his vps
Both logged 4
not in one process i hope

yea no
you'd have to shard at that point
which djs splits it into separate processes iirc
but shard doesnt mean new process... does it???
It depends
they do it all in the same process just spawn new ws connections
At least if you are using djs sharding manager
jesus H
thats crazy
can you even disable caching on js

not really
some of it
unless they changed it recently
iirc it even caches message history to a degree?
but a lot of it is required
why required?
yoi can disable more with some hacks
djs uses cache in almost every part of its lib
ask the djs devs
they only let you disable some of it yourself
heres my new settings for a cluster on trivia
/* Set cache policy for D++ library
* --------------------------------
* User caching: none
* Emoji caching: none
* Role caching: none
* Channel caching: none
* Guild caching: none
*/
dpp::cache_policy_t cp = { dpp::cp_none, dpp::cp_none, dpp::cp_none, dpp::cp_none, dpp::cp_none };
const bool compressed = false;
/* Construct cluster */
dpp::cluster bot(token, intents, dev ? 1 : from_string<uint32_t>(Bot::GetConfig("shardcount"), std::dec), clusterid, maxclusters, compressed, cp);
I was going to use D++ for my bot
i turned off compression too
because sure it saves a ton of bandwidth, but im not exactly anywhere near my bandwidth limits
compression adds a ton of cpu usage at scale
ofc, without role cache or guild cache, you cant check permissions without an api call, but triviabot doesnt check permissions like that, youre either an owner, or a role id in the guilds triv mods list
yup

websockets and http and everything
that means I don't need to worry about blocking calls right?
correct, if you use them for http
neat
its worth to keep packet compression on tho, it only applies to big packeta like guild create, and actually improves perfprmance accordimg to my tests
not ws compressiom
trivia used to work like this with a completely REST backend
but it just didnt scale well, the backend didnt answer requests fast enough
Well the db I am using doesn't have a C++ SDK yet, so I have to use the api instead
and i didnt want to change the legacy code to something else
the ssl compression? yeah
no?
ye
what is the question
?????
what about etf, do you use that?
i support it ye, but etf is not really a good format
but when it comes to js, it has to still build a V8 object type to put it into, that is never going to be faster than json
messagepack would be way better
which does the same thing
i made the fastest etf lib for js
ofc you did
with it, etf is on par with json in js
dpp started with discord's one, and then tidied up and improved, made it more C++ish
got rid of the type punning etc
What are you confused about. What you did was make a statement, not pose a question.
the discord one is terrible
very
it took a lot of tidying
but a lot of the performance issues of the discord one, are what it does in v8, which i completely threw away
the dpp one builds nlohmann containers
my etf lib is pure js and its 10x faster than the discord one whicj is cpp binginds
Okay, then send a dm to the user?
You have all the information you need to do so
the top.gg api responds with the user id of the person who voted
use that to grab the user, send the ma dm
simple

Yes you do
top.gg api gives you the user ID of the person who voted. Use that to send a dm to the user
then do so?
Its the same response
top.gg api gives you the user id of the person voted through the webhook. So use that to send a dm to the user, and add the currency to the user
I just told you how to do it.....
Literally the message you responded to?
answer does not contain code i can copy and paste therefore the answer is invalid
Im not sure how to help someone with a language barrier
has anyone here ever worked with https://www.npmjs.com/package/cli-progress
thing is I won't give someone code that works fully

if so how tf do I pad variables
its up to them to implement what I give them themselves
I don't think you can
wdym
if im understanding you correctly that is
like align the progress bar?
you want it to all align properly?
and make the bar fill the rest
use multiBar
This might help
how do you log those two? you log them yourself or you pass them to the lib?
not sure, but it does auto align
i guess yoi can add .padEnd() to tje variables
When someone votes, top.gg will post to the webhook you specify, and it gives the user id of the person who voted. Use that to send a dm to the user by fetching the user from cache or the discord api. Then use that same user id when adding the currency to the user (assuming you index your databased based off user id)
add an invis character /j
not a bad idea tbh
braile blank character
what the fuck
I tried padding with ,
and it also didnt work
it just removed the padding after the bars started to move
oh wait
im stupid
ok so
I forgot to pad the vars when updating LOL
🍞
stewpid
time to shame you until the end of time
what
I am updating it
ok
who plays mc anymore
im kidding im still an avid mc player
kinda cool tho
wish I had that when I was running mc servers

its very hard to understand what you say, if you are using a translator, it is very bad
what library and language are you using? discord.js?
do you use the top.gg sdk?
Official Top.gg JavaScript library
Official Top.gg Node SDK. Latest version: 3.1.6, last published: 9 months ago. Start using @top-gg/sdk in your project by running npm i @top-gg/sdk. There are 15 other projects in the npm registry using @top-gg/sdk.
the top.gg official library
oh lel
@earnest phoenix your bot needs aprove first, you cannot use votes without approve
I did mention it's a bot that is pending review lol
Guess he didn't see

right so for some reason, this if statement still runs (this is bash)
the alias it is looking for definitely exists because the docker output tells me as such

oh I see now
its because grep isn't a valid command inside docker container ig
@lyric mountain @covert gale how do i properly configure my build.gradle file so i can publish it to maven central 
https://github.com/null8626/decancer/blob/main/bindings%2Fjava%2Fbuild.gradle
i gotTask 'publishAndReleaseToMavenCentral' not found in root project 'java'.
i tried the normal one and it didn't work lmao which is why i tried mavenPublishing
also i don't use any IDEs to write this java project 😭
bro is docker smoked, why is it taking so long
you uh...
please download intellij community
null cant
skill issue
her laptop is not good enough
uses notepad++ but writes better code than most average devs
💀
yuh
i don't think i'm using ossrh
publishing {
publications {
mavenJava(MavenPublication) {
groupId 'io.github.null8626'
artifactId 'projectname'
version '3.0.0'
from components.java
pom {
name = 'projectname'
description 'projectdesc'
url = 'https://github.com/null8626/projectname'
inceptionYear = '2021'
licenses {
license {
name = 'MIT License'
url = 'https://github.com/null8626/projectname/blob/v3.0.0/LICENSE'
}
}
developers {
developer {
id = 'null8626'
name = 'null8626'
}
}
}
}
}
}
``` this doesn't work (gives the same error)
what does it do?
gradle publish worked for me btw
it is done! i saved 85.7% of my ram usage
its now 18 clusters each of approximately 70mb
basically same size as seven spells
how do you count network? does it using pid or overall server's network activity
chat should i buy a 2nd hand 48u server rack for 40 bucks
even if i have no space for it
could resell it so maybe?
each dpp cluster records its total i/o and resets a counter every minute
that is then divided up on the stats to get kbps
then i can get the total for all 18 clusters using SQL SUM() on it
what you gonna put into it
thats about the going rate for them 2nd hand
businesses pay a fortune for them new, and then cheap 2nd hand because its cheaper than disposing of it or taking it with you to new office
just check the depth
theres full depth that'll hold a server
and half depth that'll only hold like a network switch
yeah its full size
theyre deceptively tall
thats 2m high
it'll be as big as any room in your house, a few inches clearance from the roof
only thing is
once you got one, you need to get equipment to go in it
and when you buy a rack mount server, you usually dont get the rack rail kit with it
theyre extra
also, you need rack cooling
you cant just throw servers in it and hope they dont overheat, you need rack fans at the least, if you dont have aircon in the room running 24/7
ugh what, amazon is unsafe content?
rail kits are optional
lol
no
not for rack mounting
if you want to put it in the cabinet, they arent optional at all
not even good enough for notepad++ 
like 40cm clearance, 10cm clearance when in mid of door
and i might only use 12-18u of it
this just looks attractive as it's an old minkels rack (aka quality) for real cheap
interesting, thank you!
yw 🙂
did u try fleet btw?
ik u can connect to a remote server running intellij in server mode to offload the processing
tho idk how heavy fleet is
about a ton
well nvm then
i really don't think his current laptop could handle it
i doubt
tbh
my laptop can barely handle vscode lmao
@lyric mountain what are your thoughts on jreleaser
couldnt you just run a cli command to get network stats for the processes and then join them together?
or you wanna record them yourself for stats over time
I think im addicted to writing complex ts types
i think i wouldve preferred to hear you have a drug addiction instead
same thing
wonder whats the longest utility type ive ever written
probably openapi3 to ts type
idk where it i though
sure, but i dont want thre entire process's network throughput
just the parts that relate to discord
or it will be recording the database connections, internal api requests and stuff
ah ye
@lyric mountain @covert gale do you guys know what might have caused this?
plugins {
id 'java-library'
id 'maven-publish'
id 'org.jreleaser' version '1.12.0'
}
// ...
repositories {
// ...
}
jar {
// ...
}
publishing {
// ...
}
javadoc {
// ...
}
java {
// ...
}
test {
useJUnitPlatform()
// ...
systemProperty 'java.library.path', '${System.getProperty('java.library.path')}${File.pathSeparatorChar}$rootDir/bin'
// ^^^ Could not get unknown property 'java' for task ':test' of type org.gradle.api.tasks.testing.Test.
}
dependencies {
// ...
}
i am new to gradle dont kill me 😭
what elephant
i am CRYING

i have been fighting with gradle for 2 days straight
gradle is harder than C 😭
i did and it still doesn't work 😭
not even commenting out```gradle
java {
withJavadocJar()
withSourcesJar()
}
add java plugin
i did
what's ur updated build.gradle?
mhm
how then
apparently removing ${System.getProperty('java.library.path')} fixes the issue
how would i append directories to the java.library.path then 
How to fix?
^
Error: ENOTDIR: not a directory, scandir 'D:\Invite Manager\commands\ping.js'
at Object.readdirSync (node:fs:1509:26)
at Object.<anonymous> (D:\Invite Manager\index.js:25:26)
at Module._compile (node:internal/modules/cjs/loader:1434:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1518:10)
at Module.load (node:internal/modules/cjs/loader:1249:32)
at Module._load (node:internal/modules/cjs/loader:1065:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:12)
at node:internal/main/run_main_module:30:49 {
errno: -4052,
code: 'ENOTDIR',
syscall: 'scandir',
path: 'D:\\Invite Manager\\commands\\ping.js'
}```
how do you analyse the reason for a user kicking the bot
it would be nice if discord provided us with reporting and metrics on this and asked the users for a reason for the kick, after they kick a bot, so we can see aggregate data
but they probably wont do that
so how do you improve?
@lyric mountain @covert gale I GOT IT
THE ERROR WAS BECAUSE I USED SINGLE QUOTES INSTEAD OF DOUBLE QUOTES
😭
Ah, didn't notice that
Yeah groovy ' and " are different in that the former doesn't parse $interpolation
It's meant for plain strings
3 hours of debugging all just for that 😭
Doesn't np++ highlight interpolations?
Or does it not differ between string literal and regular?
@quartz kindle it happened
it wasnt a colliding cuid2 but code exploded
it has like 1000 requests queued up now
what happened exactly?
I updated my validator middleware and forgot to update the route responsible for inserting requests into the database
atleast no users noticed
ripperinos
the function readdir is used to read a folder, but your code made it try to read something that is not a folder
usually that happens when you use readdir with a wrong path
i did 'commands'
for the folder
show your code
const { token } = require('./index.js');
const fs = require('node:fs');
const path = require('node:path');
const commands = [];
// Grab all the command folders from the commands directory you created earlier
const foldersPath = path.join(__dirname, 'commands');
const commandFolders = fs.readdirSync(foldersPath);
for (const folder of commandFolders) {
// Grab all the command files from the commands directory you created earlier
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
// Grab the SlashCommandBuilder#toJSON() output of each command's data for deployment
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
if ('data' in command && 'execute' in command) {
commands.push(command.data.toJSON());
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}
// Construct and prepare an instance of the REST module
const rest = new REST().setToken(token);
// and deploy your commands!
(async () => {
try {
console.log(`Started refreshing ${commands.length} application (/) commands.`);
// The put method is used to fully refresh all commands in the guild with the current set
const data = await rest.put(
Routes.applicationGuildCommands(clientId, guildId),
{ body: commands },
);
console.log(`Successfully reloaded ${data.length} application (/) commands.`);
} catch (error) {
// And of course, make sure you catch and log any errors!
console.error(error);
}
})();```
It appears that your code is trying to read the folders inside the commands folder, but from what you write it appears that there are only command files in this folder
Can you try to create a folder inside this commands folder and put your ping.js file there?
Even the comment explains what this piece of code does
// Grab all the command folders from the commands directory you created earlier
I did
It is commands then a subfolder called ping.js
ping.js is a file not a folder
Yea, make a proper folder and call it whatever you want
Will every command go in that folder
whatever you want
They don't have to, it only serves you so that you can "segregate" your commands
Ok i made a folder called etc
the code above is made to work with something that is organized like this:
commands
misc
ping.js
etc.js
games
game1.js
game2.js
chat
chat.js
fun.js
``` (example)
Oh alr
if you want to organize it differently then you need to change the code
for example if you want to organize like this ```
commands
ping.js
etc.js
game1.js
then the code needs to be changed to account for it
It worked i got a command now
await interaction.reply('Ping: ${Math.round(client.ws.ping)}ms!'); But how do i get that to say the real ping and not what that says
not in a .gradle file
it doesn't even highlight anything in a .gradle file
it's like using notepad
in js there are 3 ways to create text:
"abc"
'abc'
`abc`
only the third way supports templating with ${}
"abc ${1}"
'abc ${1}'
`abc ${1}`
notice the difference in colors
they all look the same in discord mobile :^)
Yeah
await interaction.reply(Ping: ${Math.round(client.ws.ping)}ms!);
So it should look like that?
yes
can u force a language upon a file?
Well, either you didn't manage to respond in time or you have some error in your code
if so, you can force groovy on it
Its cause of this
Right when i put it back to " it fixed it
Try using interaction.client.ws.ping instead
Probably your code doesn't have access to the client so it has to be taken from the interaction
I think its because it is taking to long to work
Respond time
Because it isnt coming back with any errors
yeah but you would have to write a language config containing every keyword 
a
So you need to defer your interaction with .deferReply() and instead of .reply() use .editReply()
What does the switch do?
Also didnt work
Interactions must receive a response within 3 seconds, otherwise their token is invalidated and the interaction will not work. If you are unable to reply within 3 seconds, you use .deferReply() which gives you up to 15 minutes to edit the deferred reply
Where do i put .derReply
here
await interaction.reply(Ping: ${Math.round(client.ws.ping)}ms!);
Like this
module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies With Bot Latency!'),
async execute(interaction, client) {
try {
await interaction.deferReply(); // Defer reply to buy time
await interaction.editReply(`Ping: ${Math.round(client.ws.ping)}ms!`);
} catch (error) {
console.error(error);
await interaction.editReply('There was an error trying to execute that command!');
}
},
};```
Should work
It dont
TypeError: Cannot read properties of undefined (reading 'ws')
at Object.execute (D:\Invite Manager\commands\etc\ping.js
59)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Client.<anonymous> (D:\Invite Manager\index.js:48:3)
Oh, so your client is probably not what a client should be
Can you change it real quick to interaction.client?
so i'm trying to make a server which when someone joins creates a new channel just for that single person, the person joining only seeing that single channel
it's supposed to let me verify that person before gaining access to the entire server, how would i start?
It worked
I went into my index.js and it said const command = interaction.client.commands.get(interaction.commandName);
Thats why it didnt work lol
Ty i didnt understand that
deferring is definitely not needed there
Has any of yall worked with discordeno
client.ws.ping is not an async call, it does not take any time to run
It wasnt working 😭 slow Bot ig
at Object.execute (D:\Invite Manager\commands\etc\bot-info.js:16:31)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Client.<anonymous> (D:\Invite Manager\index.js:48:3)``` Let me know if you need the code for the command
I am making a botinfo command
Certainly, without it we will not be able to find the source of the problem
it wasnt working because you were using the wrong client, not because of slowness
Oh
again, you're using the wrong client
How do i use the right one?
show the code
For the ping or the botinfo one
the botinfo
module.exports = {
data: new SlashCommandBuilder()
.setName('bot-info')
.setDescription('Replies with bot information'),
async execute(interaction, client) {
try {
await interaction.deferReply(); // Defer reply to buy time
const uptime = process.uptime();
const uptimeHours = Math.floor(uptime / 3600);
const uptimeMinutes = Math.floor((uptime % 3600) / 60);
const uptimeSeconds = Math.floor(uptime % 60);
const totalGuilds = client.guilds.cache.size;
const totalUsers = client.users.cache.size;
const embed = new EmbedBuilder()
.setColor(0x0099ff)
.setTitle('Bot Information')
.addFields(
{ name: 'Uptime', value: `${uptimeHours}h ${uptimeMinutes}m ${uptimeSeconds}s`, inline: true },
{ name: 'Servers', value: `${totalGuilds}`, inline: true },
{ name: 'Users', value: `${totalUsers}`, inline: true },
)
.setTimestamp()
.setFooter({ text: 'Bot Info', iconURL: client.user.displayAvatarURL() });
await interaction.editReply({ embeds: [embed] });
} catch (error) {
console.error('Error executing botinfo command:', error);
if (interaction.deferred) {
await interaction.editReply({ content: 'There was an error while executing this command!' });
} else {
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}
}
},
};```
you see where you have async execute(interaction, client) {
Yeah
that means the client needs to be given from the index.js file, in the line where you use command.execute()
but regardless, you dont need that at all, because all interactions have a valid client inside them
so you can just do interaction.client
and remove the unneeded client
show your index.js real quick
const path = require('node:path');
// My Intents
const { Client, Collection, Events, GatewayIntentBits } = require("discord.js");
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
]
});
// Bot Turn On Message Don't Touch
client.on('ready', () => {
console.log(`Yay! Logged in as ${client.user.tag}!`);
});
client.commands = new Collection();
const foldersPath = path.join(__dirname, 'commands');
const commandFolders = fs.readdirSync(foldersPath);
for (const folder of commandFolders) {
const commandsPath = path.join(foldersPath, folder);
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const filePath = path.join(commandsPath, file);
const command = require(filePath);
// Set a new item in the Collection with the key as the command name and the value as the exported module
if ('data' in command && 'execute' in command) {
client.commands.set(command.data.name, command);
} else {
console.log(`[WARNING] The command at ${filePath} is missing a required "data" or "execute" property.`);
}
}
}
client.on(Events.InteractionCreate, async interaction => {
if (!interaction.isChatInputCommand()) return;
const command = interaction.client.commands.get(interaction.commandName);
if (!command) {
console.error(`No command matching ${interaction.commandName} was found.`);
return;
}
try {
await command.execute(interaction);
} catch (error) {
console.error(error);
if (interaction.replied || interaction.deferred) {
await interaction.followUp({ content: 'There was an error while executing this command!', ephemeral: true });
} else {
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}
}
});
client.on('messageCreate', async message => {
if (message.content === '!ping') {
message.channel.send(`Ping: ${Math.round(interaction.client.ws.ping)}ms`);
}
});
// Bot TOKEN Don't Touch Unless Reset
client.login("TOKEN");```
so check this
// index.js
await command.execute(interaction); // <-- this is the caller, the caller sends "interaction"
// botinfo.js
async execute(interaction, client) {...} // <-- this is the receiver, the receiver expects "interaction" and "client"
the caller does not send anything in the second parameter, so the client in the receiver is invalid
you can just remove the client from the receiver
The receiver meaning?
what did you do?
Removed that from the code
which part of it did you remove?
async execute(interaction, client) {
you removed all of it?
I think so
I deleted the corresponding } from the line of code
oh
Ok i removed it without errors 🙂
ok now show your botinfo.js
module.exports = {
data: new Discord.SlashCommandBuilder()
.setName('bot-info')
.setDescription('Replies with bot information'),
async execute(interaction, client) {
try {
await interaction.deferReply(); // Defer reply to buy time
const uptime = process.uptime();
const uptimeHours = Math.floor(uptime / 3600);
const uptimeMinutes = Math.floor((uptime % 3600) / 60);
const uptimeSeconds = Math.floor(uptime % 60);
const totalGuilds = client.guilds.cache.size;
const totalUsers = client.users.cache.size;
const embed = new Discord.EmbedBuilder()
.setColor(0x0099ff)
.setTitle('Bot Information')
.addFields(
{ name: 'Uptime', value: `${uptimeHours}h ${uptimeMinutes}m ${uptimeSeconds}s`, inline: true },
{ name: 'Servers', value: `${totalGuilds}`, inline: true },
{ name: 'Users', value: `${totalUsers}`, inline: true },
)
.setTimestamp()
.setFooter({ text: 'Bot Info', iconURL: client.user.displayAvatarURL() });
await interaction.editReply({ embeds: [embed] });
} catch (error) {
console.error('Error executing bot-info command:', error);
if (interaction.deferred) {
await interaction.editReply({ content: 'There was an error while executing this command!' });
} else {
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}
}
},
};```
Idk how to remove it without getting errros
what are you removing?
async execute(interaction, client) {
I removed the client but i cant remove the whole line of code
uh, why?
show exactly what you are doing
like how it was before, and how it is after you changed it
module.exports = {
data: new Discord.SlashCommandBuilder()
.setName('bot-info')
.setDescription('Replies with bot information'),
try {
await interaction.deferReply(); // Defer reply to buy time
const uptime = process.uptime();
const uptimeHours = Math.floor(uptime / 3600);
const uptimeMinutes = Math.floor((uptime % 3600) / 60);
const uptimeSeconds = Math.floor(uptime % 60);
const totalGuilds = client.guilds.cache.size;
const totalUsers = client.users.cache.size;
const embed = new Discord.EmbedBuilder()
.setColor(0x0099ff)
.setTitle('Bot Information')
.addFields(
{ name: 'Uptime', value: `${uptimeHours}h ${uptimeMinutes}m ${uptimeSeconds}s`, inline: true },
{ name: 'Servers', value: `${totalGuilds}`, inline: true },
{ name: 'Users', value: `${totalUsers}`, inline: true },
)
.setTimestamp()
.setFooter({ text: 'Bot Info', iconURL: client.user.displayAvatarURL() });
await interaction.editReply({ embeds: [embed] });
} catch (error) {
console.error('Error executing bot-info command:', error);
if (interaction.deferred) {
await interaction.editReply({ content: 'There was an error while executing this command!' });
} else {
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}
}
},```
Thats after
🤦♂️
i mean, what part of this did you not understand?
you should go learn how functions work
anyway, there is still something else you need to change now
now that you removed client
these two lines are still looking for a client that doesnt exist anymore
so you need to change them to use the client that exists inside interaction
wouldn’t he use interaction.client now 
exactly
it looks so ugly without syntax
I cannot stand that
:^)
completed
good
is it bad to me if i get
Error executing bot-info command: ReferenceError: client is not defined
at Object.execute (D:\Invite Manager\commands\etc\bot-info.js:28:45)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Client.<anonymous> (D:\Invite Manager\index.js:48:3)
that means you did not do what i just said
about the client and the interaction
I just did
show what you did
interaction.client
const totalGuilds = interaction.client.guilds.cache.size;
const totalUsers = interaction.client.users.cache.size;
Thats the line now
Ill show the whole thing
whats line 28?

.setFooter({ text: 'Bot Info', iconURL: client.user.displayAvatarURL() });
change that
as well
need to change there as well
Completed
so now u should be okay
it worked 🙂
gj

now back to the deferring thing, you should not really be using defer for no reason
i mean, you can just keep it, but its not really correct
Will it do anything to my code if i dont need it?
no
it makes the bot slightly slower
it will run the same result
because the bot essentially has to respond twice
just quicker without deferring
instead of once
How would i know if i need it or not?
if your bot is doing some fetching/awaiting on some code (api, functions, etc)
that’s what I use it for mostly
^ ie does your command read a file from your pc? does your command access an api or website or database? or some function that is very slow (like AI)?
then you need it
otherwise no
From my PC
now that’s shade at the end.
:^)

I just removed it from my ping.js and it wont work
did u change editReply to reply
like for example posting an image from your pc

yeah
what’s the error then
module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies With Bot Latency!'),
async execute(interaction,) {
try {
await interaction.reply(`Ping: ${Math.round(interaction.client.ws.ping)}ms!`);
} catch (error) {
console.error(error);
await interaction.reply('There was an error trying to execute that command!');
}
},
};```
you can remove this comma lol interaction,
Nothing just won't load it
when running the command, does it say it’s outdated?
check ur interactionCreate event
and also please do this
i fixed that
it’s BOTHERING me.
hello i just joined a server
ok thanks 
client.on(Events.InteractionCreate, async interaction => {
if (!interaction.isChatInputCommand()) return;
You can report to a bot reviewer I think
no its private bot
or a moderator, idk…
@normal badge
so is it possible to report the server to justice
oh sorry
await command.execute(interaction);
} catch (error) {
console.error(error);
if (interaction.replied || interaction.deferred) {
await interaction.followUp({ content: 'There was an error while executing this command!', ephemeral: true });
} else {
await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
}
}
});```
if you joined someone else's server and their bot is pinging you, just leave the server?
Can't
why not?
a person from that server wants to give me nitro for my birthday in two days
and i can't get rid of constant pings
ur not serious…
LMAO
Then mute the server
thats an obvious scam
reached 1gb 🔥
Is this right?
wait my database is at 475kb?
How do i do that?
i dont see anything wrong with your code, did you save everything and restart the bot?
is 475kb alot for database
Mine wont work if i do ctrl C
because i only have 15GB for database
?
kb is not even close for the term a lot
wdym restart
ctrl C then node index.js
Ctrl C dont work




