#development
1 messages · Page 216 of 1
a combinação \0 significa full match
ou seja
Olá Mundo \0 ia tentar dar match em Olá Mundo Olá Mundo
eu ja te disse varias vezes pra passar apenas oq ta dentro das chaves ao invés do texto inteiro
regex tem replace-in-place
vc simplesmente itera sobre os matches
eh, vou ter que usar uma máscara temporária
n carai
aplica o regex no texto, e vai iterando sobre os matches
vc literalmente consegue ir de 1 em 1 e ir pegando os valores diretamente
esse é o texto do exemplo text = 'find a replacement for me [[:a:]] and [[:b:]]'
ele ta substituindo oq ta dentro de [[]]
usando uma função pra processar o conteudo
é literalmente oq vc ta tentando fzer
uhmm, n sei se consigo fazer isso com texto pré-feito
pois os cara pode criar diversos macros
cada um com um código diferente
I love spanish
desta vez tirei o bagulho
Such a beautifl langauge
?
### This part is making use of space easier to handle, so there is no need to always type \0
### forhandling wise
pattern = r"\[(.*?)\]"
pivots = re.findall(pattern, macro)
for num, i in enumerate(pivots):
piv = i
macro = macro.replace(f"[{i}]", f"[{num}]")
piv2 = re.findall(piv, r"\{(.*?)\}")
print(f"{piv = }")
print(f"{piv2 = }")
for num2, j in enumerate(piv2):
piv3 = j
note = ["{", "}"]
piv = piv.replace(f"{note[0]}{j}{note[1]}", f"{note[0]}{num2}{note[1]}")
piv = piv.replace(" ", "<xxspacematchxx>")
piv = piv.replace(f"{note[0]}{num2}{note[1]}", f"{note[0]}{piv3}{note[1]}")
macro = macro.replace(f"[{num}]", f"[{piv}]")
macro = macro.replace("<xxspacematchxx>", "\\0")
desta vez sem wild cards
i mean
confusing portuguese and spanish is a well known way to troll portuguese/brazilian people
somente usando quando n estiver usando regex
@lyric mountain da uma olhada
Spanish is basically portugese on steriods
e aqui foi eu tentando
Ngl, I dont see how people confuse the two
I guess a good bit of the words look similar, but in reality it's not
at least from what i've seen
@sharp geyser Have you looked into fixing your dataset?
indeed its pretty easy to differentiate
spanish = jajajaja
brazil = hueheuheuehueh
portugal = almost doesnt exist on the internet (caralho)
meu amigo, vc ainda n entendeu oq eu quero dizer
I've attempted to find out how, but I honestly dont even know what the current code does 
I am also juggling multiple projects rn

😭
tim me ajuda aki
Yeah it ain't worth it then lmao
what isnt
eu tbm n
to tentando explicar pra ele q ele n precisa jogar o texto inteiro no parser, é só usar regex pra fzer replace-in-place
Your site is very cool! I lived in spain for a few months so i can read it kinda
mas ele ainda n entendeu
What's not 
Improving your code 😭
I would recommend you to look into creating a bigger and more versatile databset
I have a larger dataset now
mano, roda o codigo do exemplo q vc vai entendeu oq eu to falando pra vc fazer
Because the hyperparameters are already pretty good using the gridsearch i applied
@urban delta ele ta tentando explicar pra voce que nao precisa jogar o texto inteiro no parser, é so usar regex pra fazer replace-in-place
there i helped
I have a dataset with 3k entries
1k of each level
There is just some duplicates so I gotta filter them out
simple yet cool design
entendi
mas tipo, e se eu tiver criando algo que usa um tipo de string diferente
Let me send you some more preprocessing code
no caso, pode ser qualquer coisa na string
to filter out entries
tipo, pode ser [Olá 25 mundos]
os seus comandos sempre vão estar entre {} n?
sim, mas dentro de {} vai estar mais é subcomando
The rest should be pretty good to be fair. What you can do is increase the amount of layers and densities of the neural network to make the genetaliziarions better but watch out for overfitting
ENTÃO
minha string inteira e o comando
é pra vc dar match no {}
esquece o resto
oq eu to te falando é pra vc usar o regex pra pegar esses grupos ESPECIFICAMENTE
AI vc passa o conteudo de dentro pro parser
e devolve pro texto original
é pra fzer isso antes de qualquer outra coisa
n sei, vc apertou alguma coisa
n sei o que apertei
apertei alguma coisa sem querer
e apareceu
n lembro o que ér
👍
what
wait what?

passar o conteudo pra dentro do parser
you didn't hear it wrong
I made it in a rush just cuz I needed a frontpage
it worked
se vc usar oq ta no link q eu mandei, vc vai ter justamente isso
vc da o conteudo pro parser, dps devolve pra função pro regex por no lugar
kuu i'm hearing those messages
i'm chuckling so hard for some reasons
it's complicated
i see something with regex
yes, they're trying to apply regex on a text that contains \0
which ofc ain't working cuz it's a reserved wildcard
null byte match?
full-match group lookbehind
would \x00 work?
assuming it's PCRE
iirc you can match by char code (hex, unicode)
oh no, it's another thing entirely
Like this text with { smth }
they want to evaluate what's inside {}
but their parser doesn't work with spaces
are they making a language parser?
so they're replacing it with \\0

Like\\0this\\0text\\0with\\0{\\0smth\\0}
I told them, but they insist in that specific thing
eg. \uffff (if it supports unicode)
or use one of the reserved ascii codes
or just use space
treat 0x20 as if it's a special token like \\0
if able can you ask them why?
was about to say they might want to do lexer + AST since it looks like they are making a scripting language
AST is hard for me however
it's because in my code when i try to separate a subcommand in a command with space it will joint the subcommand without space
like
this behaviour can't be controlled?
Hello 20 worlds becomes Hello20worlds
replace with one of reserved ASCII codes
i see, but lark would use that as an error
or would just keep the same behavior
unless i test it here rq
try it
oh
i remember now
lark don't support ASCII
we need to use at least one character outside of your character range that is valid to it
cus if it do
what are valid character ranges
what is unicode?
that's... very weird for a web application
characters that are outside ASCII range, dynamic size (up to 4 bytes)
eg. this
yeah, it don't support
that's Lark
yeah don't support
called themselves "enterprise" 
i had to jurry rig it to make those characters work
async def conversor(macro: str):
### This part is ASCII transformation
# special characters
macro = macro.replace("ç", r"{ cid }")
# punctuation
macro = macro.replace("à", r"{ ` a }")
macro = macro.replace("è", r"{ ` e }")
macro = macro.replace("ì", r"{ ` i }")
macro = macro.replace("ò", r"{ ` o }")
macro = macro.replace("ù", r"{ ` u }")
macro = macro.replace("á", r"{ ´ a }")
macro = macro.replace("é", r"{ ´ e }")
macro = macro.replace("í", r"{ ´ i }")
macro = macro.replace("ó", r"{ ´ o }")
macro = macro.replace("ú", r"{ ´ u }")
macro = macro.replace("ã", r"{ ~ a }")
macro = macro.replace("ñ", r"{ ~ n }")
macro = macro.replace("õ", r"{ ~ o }")
macro = macro.replace("â", r"{ ^ a }")
macro = macro.replace("ê", r"{ ^ e }")
macro = macro.replace("î", r"{ ^ i }")
macro = macro.replace("ô", r"{ ^ o }")
macro = macro.replace("û", r"{ ^ u }")
# positional symbols
macro = macro.replace("ª", r"{ pos-a }")
macro = macro.replace("º", r"{ pos-o }")
macro = macro.replace("°", r"{ deg }")
# inverted punctuations
macro = macro.replace("¡", r"{ invert ! }")
macro = macro.replace("¿", r"{ invert ? }")
return macro
that's my jurry rig to enable compatibility with unicode
😔
now you can see why
also
can you modify the whitespace rule?
like choosing not to join it when encountering one
another option is to preprocess it before passing into lark
i ran out of options, since i don't have any knowleghe about it
convert the space to unique sequences of characters, is another option
that's what i'm trying it here
### This part is making use of space easier to handle, so there is no need to always type \0
### forhandling wise
pattern = r"\[(.*?)\]"
pivots = re.findall(pattern, macro)
for num, i in enumerate(pivots):
piv = i
macro = macro.replace(f"[{i}]", f"[{num}]")
piv2 = re.findall(piv, r"\{(.*?)\}")
print(f"{piv = }")
print(f"{piv2 = }")
for num2, j in enumerate(piv2):
piv3 = j
note = ["{", "}"]
piv = piv.replace(f"{note[0]}{j}{note[1]}", f"{note[0]}{num2}{note[1]}")
piv = piv.replace(" ", "<xxspacematchxx>")
piv = piv.replace(f"{note[0]}{num2}{note[1]}", f"{note[0]}{piv3}{note[1]}")
macro = macro.replace(f"[{num}]", f"[{piv}]")
macro = macro.replace("<xxspacematchxx>", "\\0")
i'm gonna try the Kuuhaku way
best of luck
@lyric mountain how do i match multiple groups in a function for regex?
ignore this, i was just showing it to sayu
essa coisa aqui:
tipo, acho que isso só agrupa 1 grupo só
ae queria ver se dá pra fazer com vários
Em regex um grupo é definido por ()
A ordem é da direita pra esquerda, de fora pra dentro
Pq vc precisaria de varios?
No seu caso é só 1 n?
N
É pra vc dar match nas chaves
N no espaço
Eu falei pra vc usar isso especificamente pra pegar apenas oq é pra ser executado
Alias match.group(1) n vai existir se vc n declarou nenhum grupo
Vc tem q entender oq ele ta fzendo ai
N é só copiar
Ele pegou o grupo 1 pq o grupo 1 da declarado la em baixo
(.+?)
N
No seu caso vc precisa usar o regex \\{ *(.+?) *\\}
Pra pegar o conteúdo dentro das chaves
esse regex aqui? \{(.*?)\}
Desisto
Mano eu te dei a manteiga, o pão e a faca
Mas vc ta tentando passar a manteiga na parede
Pega o re.sub, coloca o regex q eu te passei e pronto
A função q vc passa pra ele vai rodar pra cada match
N tem truque, traduz a pagina do stackoverflow qlqr coisa
Mas eu n sei como te explicar de forma mais simples q isso
kkkkkkkkkkkk
can anyone confirm im doing this right?
x**5 + (u - 3)*x**4 + (3 - u*2)*x**3 - u*x**2 + u*2*x - u
looks right to me
thanks
got my function working, not best pefromance tho
might try a ternary search instead of binary
L1 point is the point of gravitational stability between two masses, ie the exact point between the sun and the earth where their gravity cancels out each other
Ah I see
I vaguely remembering doing solutions to this by hand when I was writing tests for my physics simulator
Granted they were much simpler than a quintic because I was only doing two dimensions
this is the function i came up with
function L1Exact(p1, p2, dist) {
const u = p2 / (p1 + p2);
let r = Math.cbrt(u/3) * dist;
let r1 = r + r/2;
let r2 = r - r/2;
let x1 = r1 / dist;
let x2 = r2 / dist;
let t1 = x1**5 + (u - 3)*x1**4 + (3 - u*2)*x1**3 - u*x1**2 + u*2*x1 - u;
let t2 = x2**5 + (u - 3)*x2**4 + (3 - u*2)*x2**3 - u*x2**2 + u*2*x2 - u;
for(let i = 0; i < 100; i++) {
const m = (r1 + r2) / 2
const mx = m / dist;
const mt = mx**5 + (u - 3)*mx**4 + (3 - u*2)*mx**3 - u*mx**2 + u*2*mx - u;
if(mt === 0) {
return m;
}
if(Math.sign(mt) === Math.sign(t1)) {
r1 = m;
t1 = mt;
} else {
r2 = m;
t2 = mt;
}
}
}
its basically a binary search to solve for r from an initial r estimate
I'd imagine there's a way to write a solution to this as a function, since there is in theory a ring of gravitational stability around a given mass
yes there is this one
which is what i use to get the initial estimate
the margin of error seems to be around 0.01 million kilometers
Not bad
Are these two points assuming either body has no velocity?
Since that matters for problems to do with centripetal acceleration
it says it accounts for centripetal force
Perhaps I'm not fully understanding the model of the problem
Lagrange points are the constant-pattern solutions of the restricted three-body problem. For example, given two massive bodies in orbits around their common barycenter, there are five positions in space where a third body, of comparatively negligible mass, could be placed so as to maintain its position relative to the two massive bodies. This occurs because the combined gravitational forces of the two massive bodies provide the exact centripetal force required to maintain the circular motion that matches their orbital motion.
Alternatively, when seen in a rotating reference frame that matches the angular velocity of the two co-orbiting bodies, at the Lagrange points the combined gravitational fields of two massive bodies balance the centrifugal pseudo-force, allowing the smaller third body to remain stationary (in this frame) with respect to the first two.
Oh it's a 3 body problem
I was imagining something like this, a more simple diagram
The velocity of the moon here would matter because if it had 0 initial velocity it would just get pulled into the sun
Yeah this is famously complex
i guess i got it working for L1, now for L2 and L3 should be similar
then L4 and L5 are literally an equilateral equidistant triangle, or exactly 60 deg ahead and behind, from what i understand
also, things i learned today, the nth root of a number is equal to the power of 1/n of that number
ye
i was confused because the formula shows a cubic root, but chatgpt gave me code with Math.pow
Another one is x^-n = 1/(x^n)
lmao
Exponents are fun
so negative power of a number = 1 divided by positive power of that number
Yup
Is this for a bot? 👀
Math is really fun, especially calculus
There's tons of little things that seem counterintuitive but turn out to be really elegant
its for the astronomy api lol
Ah neat!
i still need to figure out how to use hyperbolic orbits
Like for example, doing
1/1 + 1/2 + 1/3 + 1/4 + 1/5 + .... + 1/n never converges to a singular value, but
1/1 + 1/4 + 1/9 + 1/16 + .... + 1/n^2 will converge to a singular value
Are all these files and folders really needed?
It's not technically necessary, but it helps with organization and you'll be glad you did it later on
I learned you only need the index.js, config and a folder for commands
What does handler do
its mostly personal organizational preference, if you want it you can have everything in only one file lol
You can "technically" stuff everything into one index.js file, but that gets very difficult to maintain over time as you add more code
Yeah i don't want that. Would should I do instead?
Handlers in this case are basically code that figures out which command/event file to call
By default your code has no idea what your files mean unless you tell them to do something with those files
Handlers tell javascript "hey, there's a function in here for the command named [some command name], please call the execute() function of it when the user uses this command"
Oh
Do you have any videos you have to help me learn to build a bot
Videos aren't going to help you much, you're probably going to end up blindly following along without learning anything
https://discordjs.guide/#before-you-begin
This is a somewhat decent intro to discord.js, I highly recommend actually reading what they say though, don't just blindly copy the code
That is hard to read because I don't know what most of it means
That's okay, just try to read it
Everybody starts somewhere
I usually don't understand much of what's being said in a new topic until I dive deeper into it, perfectly natural
Will I eventually learn some of it?
Absolutely
Fast or slow or medium?
Depends on how much time you put into it
Alright
Some people said it took them 2 years to learn code. That scares me because I don't wanna learn for 2 years.
Plus I don't know you personally, everyone learns at different speeds
Are you wanting to do coding as a job in the future?
Like a money job?
I don't know
I haven't really thought of it
Because i haven't really knew how to code or been taught
I don't want to scare you but learning how to code is a lifelong adventure. If you end up pursuing a career in this field you will always be learning
I have been doing this for almost 4 years now and I am still learning
What would you be learning about? That is new
I have a good bit of knowledge but I am nowhere close to being an expert
Code isn't about learning the syntax of a language or its features
Programming is about problem solving and translating ideas to structures
coding is pretty much the same thing as learning a new language, like spanish
its something that takes time, and practice
Ohhhhh
you can say you can learn it in 1-2 months, but how good will you be with it really? will you be able to hold a conversation?
its the same with coding
One message removed from a suspended account.
same honestly
been so busy
wish I was rich enough to not have to have a job
One message removed from a suspended account.
or lucky enough to get a job in this field before my degree
Is this your job coding?
I mean yes and no, I am teaching programming to younger kids as a job right now
But in the sense of building software, that's not my job right now
I do it as a hobby
I am pursuing a degree in computer science so I am working towards that area though
Nice
Good luck
I would definitely recommend giving some effort to try out programming though
4 years ago I made a discord bot because I was bored and it ended up being what I wanted to pursue as a career
Before that I wanted to do astrophysics
Thank god I didn't
One message removed from a suspended account.
lmao
One message removed from a suspended account.
My friend is a good coder. And I wanted to code I've always wanted to own something or make something. So that'd why I wanted to make a discord server. But then my friend said you can make a bot. It could help you grow your server and your in control the whole thing. So I said why not. So i wanted to make a bump bot and some other things in it. But i don't know where to start and coding is hard. So yeah but it is something I want to try out
the best way to start is by wanting to do something with it
^^
i started because i wanted to create astrology charts lol
i had 0 idea how to do that
And the best way to continue is by making more things you want to make with it
Yeah
I've fallen victim to some burnout because I'm so busy nowadays and it sucks, but I'm trying to get to a point where I program more often
Gotta get back into that mindset
Javascript?
I know javascript but I'm not too big of a fan of writing it
I prefer C++, Java, and Rust mostly
For discord bots typescript is my language of choice
For making Bots is this the most common or is it something else
Python and javascript are the most common
python and javascript are the go to options
depends on what you wanna do though
Bump bot
image manipulation is more of a python job
And more
wont pythoin be slower? xD
image manip libs are probably bindings to C++ DLLs
Highly doubt that python is going to power through images fast by itself
is bump bot like that disbo*rd? you need pretty much a lot of servers for your bot to join so people can notice
Um more like BumpIt, WeBump, OneBump
Those bots
That's what I am aiming for
the thing is
you're bumping it where?
like if you wanna bump your server in a server list
you need to have the server list already
or have access to an existing list
So when you do /bump it will take your ad and put it to all channels who have the bot
so your bot will need to be very popular
Yeah
Kinda
But it could grow if it is good
Hopefully
But it would have other things not just bumping
yeah, the bump system is like putting your server into the top of the server listing so the user can see it. if there are only a few users, then there's a low chance the listing will be seen. well idk how those bot get popular, so you need to find a way to make your bot popular so more people can see others servers. good luck
cmiiw
Hello a little query!
I just started learning C#, it's my second language let's say. Other than that I know py which I always wrote in vsc
For C#, I downloaded VS for the first time yesterday however I couldn't make myself fit into it lol it all seemed a lot more complicated and uneasy compared to VSC so I downloaded some extensions into vsc to make c# work there. Frankly I've only worked with vsc so far for all my projects
Did some research and found out the core differences between VS and VSC, however would still like someone to tell me if I'm all good sticking to vsc for now/for long term or if I should root out and start writing in vs 
I recommend vsc
VS is the most common IDE for C#, made by Microsoft
and then jetbrains rider, paid one
VSC can work as a CS editor, but it wasn't purpose built like VS was since CS is a Microsoft language. Naturally, VS made by MS would be a good pair
notepad++
"you shouldnt use something made by ms on ms software but instead on ms software"
Very funny. VSC wasn't designed for CS. It can support it, but VSC is more of a swiss army knife than a steak knife to cut through steak.
least annoying eslint warning
or you want a typescript error (Could not find 'body-parser' type declaration)
i use typescript
and you called it "better"
based
@lyric mountain @covert gale do you guys know how to publish a gradle library to maven central? i've been using jitpack and it refuses to work today
for sure
yes that's it, was trying to remember the name
idk, but sonatype will also publish it there
ik cuz I could find my libs
and I published it on sonatype
alright, thanks
friendly reminder, exponentiation is js is SLOW AF
you coding in java?
mhm!
make it faster 
make it faster 
make a node addon ezpz
make it make a web request to a supercomputer
every time you want an exponent
and dont cache it
already did:
before:
x1**5 + u3*x1**4 + u23*x1**3 - u*x1**2 + u2*x1 - u;
after:
(x1*x1*x1*x1*x1) + u3*(x1*x1*x1*x1) + u23*(x1*x1*x1) - u*(x1*x1) + u2*x1 - u;
...
literally 10x faster
exactly
did anyone here ever install a rasberry pi 1 a+ without wifi (ssh over usb)?
TOPGG_TOKEN = "My TOKEN I PASTED"
@bot.event
async def on_connect():
bot.topgg_api = topgg.DBLClient(bot, TOPGG_TOKEN)
print("top.gg client initialized")
bot.remove_command("help")
async def update_stats():
while True:
try:
await bot.topgg_api.post_guild_count()
print("Server count updated successfully!")
except Exception as e:
print(f"Failed to update server count: {e}")
await asyncio.sleep(1800)
@bot.event
async def on_ready():
print(f'{bot.user} is now jamming')
await update_stats()
try:
synced = await bot.tree.sync()
print(f"Synced {len(synced)} commands.")
except Exception as e:
print(e)
top.gg client initialized
CodeGuard#8181 is now jamming
Server count updated successfully!
nothing happen
ed
Opps
took long it worked
lol
wait u can post a 1000 server
s
Also is it ok if u post 45 and ur bot is in 43?
you can technically post whatever number you want, there is no way to check if its true
however if someone finds out you're cheating and reports it, you can get banned from top.gg
but for small differences there is no problem
most bots do have some margin of error, due to discord also being inaccurate sometimes
ok
is there a point to users submitting server counts now anyways?
discord shows a rounded version publicly now
Some users look at the number of servers when browsing top.gg
I'm not that kind of person, but I know that there are people for whom the number of servers = quality I guess
nano 
bruh what nvm realized i accidentally inherited the class 💀
result.h(97,69): error C2280: 'topgg::internal_result::internal_result(void)': attempting to reference a deleted function [C:\Users\user\Desktop\cpp-sdk\build\topgg.vcxproj]
@quartz kindle need your consultation on a thing
lets say I have a websocket server
and I need to request an image that'll be sent over the wire from the client
what'd be the best way to transfer it?
image is a png btw
Any way to place the two icons at the bottom next to each other instead of underneath?
They're both images placed inside the bottom most div
I'd use a flexbox for that
Our comprehensive guide to CSS flexbox layout. This complete guide explains everything about flexbox, focusing on all the different possible properties for the parent element (the flex container) and the child elements (the flex items). It also includes history, demos, patterns, and a browser support chart.
I've tried but doesnt seem to work
Or
I mean i manage to place them next to eachother, but then the "justify-content: space-around" wont work
wont work how?
Doesnt apply at all
intresting, have you used your browsers dev tools to look at what the flexbox looks like?
put a flex div before and after them
this will mimic the space-around
binary message or a cdn link
cdn is not doable, not anything involving cache
reason being the image is dynamically generated
assuming its over ws theres not many options you have anyways
either send it over the connection in binary format with lossless compression or convert it into a b64 string and send it as a regular string in ws
I am using b64 currently, guess I'll try direct binary to see if it improves
it definitely will because that way youre not doing any additional processing (minus the compression if you were to use any)
with b64 you first have to convert the binary data into b64 string and then have to unpack that b64 into binary again
youll also end up sending less data since b64 data tends to be longer
well, depending on how you display the image, you could just use the b64 stirng directly in html
but yeah
binary is probably better
most of the time devs choose to send images over base64 for convenience
like being able to fit the image into an object
but its not good from a performance standpoint
but depending on image size that performance penalty and extra network doesnt matter that much
binary can be annoying to deal with in high level langs
. to you too
Do you need dotenv
?
not 1000% necessary, but you should use it.
What does it do?
It gives nodejs access to local .env files
A=123
B=456
DISCORD_TOKEN=your-token-goes-here
the first two are example numbers, the last one is your bots token that discord provides.
👀 I dont think the guide says to use npm run does it?
Did you read the whole tip?
what does it say back?
node.: The term 'node.' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
It says something different now
"token"= "My Real Token Just took it out of here"
^^^^^^^
SyntaxError: Invalid left-hand side in assignment
at wrapSafe (node:internal/modules/cjs/loader:1350:18)
at Module._compile (node:internal/modules/cjs/loader:1379:20)
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 Module.require (node:internal/modules/cjs/loader:1271:19)
at require (node:internal/modules/helpers:123:16)
at Object.<anonymous> (D:\Infinity Bump\index.js:2:19)
at Module._compile (node:internal/modules/cjs/loader:1434:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1518:10)
Node.js v22.2.0
that probably means you tried to assign a value to something that you cannot assign to
Now it says my token it wrong
TokenInvaild
"token"= "Token"
}```
Did i do that wrong?
The Token is the real token
yeah
It has a error in the code then
...no, replace = with :
i did then there is a error
Whoops
go reset it just in case
anyway, the issue is that ur trying to write a json in a .js file
either rename the file to config.json or export it
Oh
would prefer to use dotenv over config.json cuz you will to push and also deploy the app/bot ,can't really push the config.json file yk

Alright how would i switch then?
- D:\Infinity Bump\index.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1186:15)
at Module._load (node:internal/modules/cjs/loader:1012:27)
at Module.require (node:internal/modules/cjs/loader:1271:19)
at require (node:internal/modules/helpers:123:16)
at Object.<anonymous> (D:\Infinity Bump\index.js:2:19)
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) {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'D:\Infinity Bump\index.js' ]
}
Now i am getting another error
For my token?
ReferenceError: Token is not defined
at Object.<anonymous> (D:\Infinity Bump\index.js
14)
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
Node.js v22.2.0
Now i got another one lol
@lyric mountain
because u named it "token"
It worked
not "Token"
rookie numbers
ReferenceError: Collection is not defined
at Object.<anonymous> (D:\Infinity Bump\index.js:12:23)
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
Node.js v22.2.0
Do you know what happened?
show what's in line 12 of index
client.commands = new Collection();
I made a command
And my bot stopped working because of this
whatever Collection is, you didn't npm i it
How do i figure out what it is
where did u get your code from?
The guide
@lyric mountain
you dont need to ping me
read the guide, dont just copypaste any code you see in it
mb
it's wrong that u didn't import it
first few lines of the guide
I fixed it but i am getting another error
SyntaxError: Identifier 'Client' has already been declared
at wrapSafe (node:internal/modules/cjs/loader:1350:18)
at Module._compile (node:internal/modules/cjs/loader:1379:20)
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
read the guide please
for that error it's because u literally copypasted the line, instead of getting what u needed
thus adding another Client
also your editor should show you what's wrong before u even attempt to run it
dont ignore the errors, it wont run if there's any on the editor
also read the first line of the error, it usually tells the exact cause of it
ReferenceError: Collection is not defined
That just says that
But you said it might be a npm i
What page of the guide are you on? 👀
That one
The first code block, you need to define Collection before using it
First i turned on debugger and i dont know how to turn it off
That worked
But i cant turn off debugger 😭
^
99% of your errors will solve themselves if you read the guide
i highly suggest to avoid copying code without knowing what each line does
otherwise you'll never be able to make your ideas become a thing in your code
True
plus all the debugging issues that come with it
what IDE are you using?
IDE?
from the image they sent earlier it was vscode
intergraded development enviorment
whats on the debug menu? 👀
I just closed it and reopened it
i dont even know what happened
But the commands dont work
It just says the thing when a bot is offline
But i dont have any errors and the bot is online
have you made any?
Yeah 3
pick one and show the code ^-^
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Replies with Pong!'),
async execute(interaction) {
await interaction.reply('Pong!');
},
};
Thats the ping
did you register it?
I assume they did if they got the didnt respond message
ah
Ah
Did you try the first step inside receiving command interactions?
https://discordjs.guide/creating-your-bot/command-handling.html#receiving-command-interactions
It should log the interaction the first time you try.
in the terminal
I put it in my index
Did it log the interaction?
So what do i do?
try this ^-^
then determine if it logs the interaction
PS D:\Infinity Bump> client.on(Events.InteractionCreate, interaction => {
console.log(interaction);});
ParserError:
Line |
1 | client.on(Events.InteractionCreate, interaction => {
| ~
| Missing argument in parameter list.
@solemn latch I didn't get everything, what exactly is it about?
Did i do that wrong?
They're learning to program, but commands are responding with the standard didnt response code.
Ohhh
Confused on what your asking sorry
have you performed this step?
client.on(Events.InteractionCreate, interaction => {
console.log(interaction);
});
This is a test to check if your bot is receiving when someone runs a slash command.
When you have this code, and run a slash command it should show up in the box you ran node . in.
with a whole bunch of information
I have ran it
and?
client.on(Events.InteractionCreate, interaction => {
console.log(interaction);});
ParserError:
Line |
1 | client.on(Events.InteractionCreate, interaction => {
| ~
| Missing argument in parameter list.
ah hi tim
binary will be 33% smaller and faster since you skip the b64 encoding
client.on(Events.InteractionCreate, interaction => {
console.log(interaction);
});
do i put this in my index.js too
encoding stuff as string should be avoided whenever possible because you're just double/triple encoding things
you convert binary to b64 string then it will be converted to utf8 binary before being sent, then unconverted from binary to utf8 string, then unconverted again from b64 string to binary lol
What about this Woo
@quartz kindle Its been awhile since I've played with bots, do you recognize this error?
that doesnt look like a js error, are they using typescript?
just js
thats not something you run in powershell lol, that goes in your index.js file
i havent seen that one before
😐
client.on(Events.InteractionCreate, interaction => {
if (!interaction.isChatInputCommand()) return;
console.log(interaction);
});
What about that
Same
Does that also go into index.js
Yes
everything goes into js files
the only thing that you run in your shell/cmd/terminal is npm commands and node commands
Even this
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 });
}
}
});```
👀 alright, I gotta go
looks good
Still didnt work
Tyy
I put it in my index.js
nobody promised it would work, we just told you that bricks go into a wall, not onto the roof
How do i fix it?
lay your bricks correctly

show full code
Without bot token please
in my index.js
yes
const path = require('node:path');
const { Client, Collection, Events, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.once(Events.ClientReady, readyClient => {
console.log(`Ready! Logged in as ${readyClient.user.tag}`);
});
client.login(token);
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, interaction => {
console.log(interaction);
});
client.on(Events.InteractionCreate, interaction => {
if (!interaction.isChatInputCommand()) return;
console.log(interaction);
});
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 });
}
}
});```
ok so, you dont need to have an interaction event 3 times
Yes.
you only need one client.on(Events.InteractionCreate, ...)
For now we dont need the bottom two. we just need the first one until we figure out if you're receiving interactions
then what exactly is not working? do you get any error? when you run node index.js?
does this show up when you run it? Ready! Logged in as ${readyClient.user.tag}
Yeah
alright then
Bye Bye
i still need to re-verify my bot >.>
shitty discord doesnt accept images, they want me to take a live photo
youre a developer find a way around it
Not limited to? What they gonna do next to removing verification? Hunt me down or sum 
Bruh
ban you until 2394
Oh hellll nah fr?
I need this dc account man
But I don’t want to post my ugly ahh again
i cant take a pic of my id now because its dark
gonna have to do it tomorrow
i hope they will accept the image because my phone's camera is borked
the glass lens cover is broken
I am thinking about turning my bot into a file system lmao. Basically a way to store data safely, download it etc. What you think? Good idea?
No, on my dfs.
I want to create an actual backup type of system, like iCloud type shit
Hi
like your bot sees your uploads and mirrors them into your cloud?
Any way to show the servers of my application on the page?
Nah you send a file, the bot keeps it save for you on a dfs. You can download it whenever you want.
Like an actual datastoring system for backups
how are you gonna send the file tho, you gotta upload it to discord first no?
I most likely will do so through a web interface
But idk I need some creative minds to help me find a purpose for my bot. Do you have any ideas?
I know but it says 0 and I did everything correctly, then I saw that other bots on top.gg have an icon that says servers and mine doesn't have it
what does it do right now? or are you looking to remake it from scratch?
perhaps you did something wrong, can you show what you did?
I will remake it from scratch
name it It's 4 o'clock
and have it send a message saying It's 4 o'clock on all channels everyday at 4h
Mine doesn't have that icon next to the star.
Why can I never take you serious whahahaha
i mean what did you do with the top.gg api? like show the code you tried
lmao
whats that?
I'll come back tommorow because I suck at coding rn.
Just says your application didn't respond
Don’t worry bout it
ok so in your code, remove everything about the InteractionCreate events, and leave only this one:
client.on(Events.InteractionCreate, interaction => {
console.log(interaction);
});
Alright I'll do that when I get on PC again
I get the variable No Disponible, but the votes do appear on my website.
then restart your bot, and try using a command on discord, your bot should show up the command data on your console
And that code stays in the index.js
that code is to get the stats from top.gg
top.gg doesnt not create those stats for you automatically
you need to send the stats to top.gg
for example, inside your bot code, you create a fetch like this:
From my bot folder right? And how do I send that data?
yes, you make a post request with the body parameters above
for example ```js
fetch("https://top.gg/api/bots/YOURBOTID/stats", {
method: "POST",
body: JSON.stringify({
server_count: client.guilds.cache.size
})
})
i dont remember if top.gg uses json
might need to change it to urlencoded
Ok thank you so much
thats a good idea im stealing that for myself
use discord as a free file backup
each channel is a form of stash
if the file you upload is bigger than discord upload limits, just split it into multiple files then rejoin it later when downloading
encrypt it also so discord cant look inside of your files
literally unlimited secure storage
discord is cooked
jokes on you, you cant anymore
files now have expiring urls
so u need to manually find the file through client and download it
no problem
i save the message ids of the attachments then fetch the message each time i wanna download a fragment
although im not sure how practical it is
it might take a while and a lot of fragments to upload a big enough file
if you have nitro you could be cheeky and make a user bot that uploads 100mb fragments
but then again you might as well pay for storage hosting like a normal person
some terabytes of storage is like $7 on contabo
but it could get you a bang for your buck when it comes to nitro
not only do you get nitro benefits but free unlimited file storage
50 missed calls from harvard just now
lmao
although if enough people do it discord will just finally add expiring attachments
or add some kind of internal cap of attachments per user
they probably already have that
is there a difference betwee these?
like, aside from one being u-3 and the other 3-u
what is the difference between x being on the right side or the left side? isnt it a multiplication the same way and thus same result?
3 - u is not the same as u - 3
yeah aside from that
like isnt x4(n) and same as (n)x4?
Yes
Probably just an inconsistency
@_@
People usually prefer having less negatives as well
Oh wait nvm that doesn’t make sense
Yeah it’s just inconsistent
damn maths confusing me
Makes the multiplication look more explicit, harder to overlook the u
Also just to be consistent with the rest of the terms
so
L1 and L2 have this
but L3 doesnt have the second option
i need the quintic equation one, i dont understand the first equation, and the other small equation is an approximation, not the one i want
how would i convert the L3 equation into the corresponding quintic equation like above in the L2?
also, the small one at the end would be this? R * (7/12) * u?
tf kind of maths is this
the annoying kind
💀
One message removed from a suspended account.

can you send me the article so I can take a look at the equations?
In celestial mechanics, the Lagrange points (; also Lagrangian points or libration points) are points of equilibrium for small-mass objects under the gravitational influence of two massive orbiting bodies. Mathematically, this involves the solution of the restricted three-body problem.
Normally, the two massive bodies exert an unbalanced gravita...
I'll try to see if I can do something with this but no promises because this looks complex
ty
i have L1 and L2 working, based on the quintic example they show
L3 should be simple, but idk how to proceed with that equation, as it doesnt have the same quintic example as L1 and L2
yeah honestly I'm not sure how they get from L1 & L2 to the quintic function
actually I can maybe see how they do it but it's so exhaustingly tedious I don't think I'm going to even attempt it (on the very real possibility that my thought process is wrong)
FINALLY
i asked chatgpt
look at this
jesus christ
it gave me this end result, no idea if its correct tho
chatgpt is bad at math but this doesn't look like a standard LLM model, is it?
image 2, line 1 step 3
where did (1 - x)^2 go in the denominator
image 3, the last expression was not completed
no idea
don't trust it 😔
rip
wait
so in L3, x = r/R and u = M2/(M1 + M2)?
peak web development
i couldn't even scroll to the right to see the whole equation
yes
M1 = mass of the sun
M2 = mass of the earth
R = distance between sun and earth
Discord has announced an update to their developer policy. This new update now restricts the use of AI tools on Discord user data, unless express permission is granted by Discord staff.
- Do not use API Data to: profile Discord users, their identities, or their relationships with other users...
- Do not use message content obtained through the APIs to train machine learning or AI models (including large language models) unless express permission is granted by Discord.
Read more here:
https://discord.com/developers/docs/policies-and-agreements/developer-policy
gimme around an hour to boot
lmao
is there a rate limit with the model forms?
Lmao now u can't even use self-teaching AI
Also the first one technically makes anti alt account bot's illegal
As you'd be trying to identify which accounts are alts
Didn't even think of that lmao. I can only hope this will be as ignored as the rest of the stuff that goes on on Discord in violation of TOS is. Otherwise this is gonna be a disaster
sorry tim, the bed is just extra comfy today
i agree
@quartz kindle
i got to this
need to isolate u and x to each side though
split M1 from R^2
simply L3 formula to x and mu
see the L3?
i need to convert it to just x and u
oh i thought you were doing physics in drawing something
icic
i'm into astronomy but not really into physics 
idk why but physics never really clicked with me
hey whats the rate limit for sending dms to multiple users?
is that counted as a global rate limit?
if i want to send some kind of notification dm to 100 users. how should i approach the logic?
Any dms that are not the result of user action (e.g. using a command) are a terribly bad idea
Sounds like a bot that end with 6 would do
||/j?||
It’s more like a reminder and yes it’s up to the user to set it up
Didn’t get you
client's server seems to does this whenever it just started for a few minutes
discord.js doesn't seem to care and it never properly starts and it just errors
this error isn't catched by discord.js and i do not know how to fix it
it just gives up
change their dns servers if you can
dns server is failing to find discord.com
a lot of hosts force you to use their dns servers, i always change to either 1.1.1.1 + 1.0.0.1 or 8.8.8.8 or 8.8.4.ed
since better reliability and sped
no it's their internet
it fixed itself after like a minute or two
but discord.js doesn't retry
wow i dont understand anything
how would i use this in code tho xd
like i know its an iterative process
i have an initial value for r
the annoying part is convert M1*R^2 to x and u
and i need to iterate until i find an r value that produces an exact fit
or as close as possible fit
for L1 and L2 using the quntic form of the equation, that has to equal 0
yeah, and it would be easier if i can reduce the number of variables by converting it to quintic form
i iterate and i find values smaller and smaller until its 0 or as close as possible to 0
i found a youtube video explaining all the maths and shit but at the end he shows a python script to calculate them, im gonna take a look at that too later
🙏
ew
lmao
also something i dont quite understand, i keep getting the result of r as a positive number
and it says and r being defined such that the distance of L3 from the centre of the larger object is R − r.
so L3 should be at distance - r away from the sun
but the description of the L3 point says it should be slightly farther away than earth's orbit around the sun, not closer
so r should be a negative number, not positive
or distance - r is wrong
i have no idea
like even this
that gives a positive number, not negative
thats the simplified formula that should give an approximate answer to r

can't say it's wrong when following formula
but the explanation is sound tho
but it says r being defined such that the distance of L3 from the centre of the larger object is R − r
the distance from L3 to the center of the larger object cannot be R - r if r > R
i think i found an answer on reddit
should I use unidici.request or built in fetch api to make api calls in nodejs? i heard fetch api is based of unidici but which one is better and faster?
undici.request is faster
My bot can now switch between my nodes so if one goes offline for whatever reason it switches to another node. This should prevent downtime
Is that a good idea?
depend on what your bot does
seems like tictactoe bot requires the user to give inputs multiple times, idk how you handle your bot nodes, but prob if someone is in the middle of the game and the bot switches nodes, it'll be stuck. well yeah back again, idk how you handle the system


the ui looks nice
yes
i host on my own servers
i know
i have the same server again but with windows lmao
posting here too coz yall smart
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:
- ConnectTimeoutError: Connect Timeout Error
- SocketError: other side closed
- Error: write EPIPE
- RequestAbortedError [AbortError]: Request aborted
please help
i really cant figure this issue out
Are you using your own lib?
no, discordjs 
What version
v14.13
shit, i meant to mention- this spawns from undici
huh
undici CPU leak? idk never heard of that


