#development
1 messages · Page 52 of 1
That's great, but did you read the error
how did u transfer the code to the vps?
yes
i did
how
I didn't ask IF, I asked HOW
hmm
its not my pc
it's the vps?
its mobatexteditor
did u make sure both sides are expecting the same charset?
Does the bot in the vps even have access to the emojis that are in there
Yes
it does
ah wait, found the issue
but to be honest, it wasn't working in ur pc
emoji cannot be just the id for buttons
I fixed it lol
it was working
@lyric mountain copy paste wont work on vps
i just knew it
kek i am new ngl
ah nvm, it does allow only ids
ok so, you should use some kind of versioning instead of copypasting from local to server
it's not only safer, but guarantees both sides are exactly equal
github!
or in the very least, transfer the file as a whole
since windows LOVE to shit on file encodings
they need to make an api tho
to have the site call it to retrieve server count
i'm too stupid to read, my bad, i skipped his new answers
lul
I correctly understood that the site should be on the same server with the bot?
that's one option, the other is having an api together with the bot
to allow requesting info from it
god I really wish that a client with just the guilds intents could connect in parallel with main clusters and handle all of the guild caching
and only be in one shard
yeah it's working now
why are u using ids tho?
⏩ those emotes exist as default emojis
simply paste \⏩
@manic crane ^
custom emojis
yes but those emojis exist in discord already
It was a filter thing lol
...?
what I mean is that u don't need to use custom emojis if they already exist on discord
You can just copy paste \⏩ in your button instead of using custom, that's what is meant
No need to create a new custom emoji on a server for something that is already existing and will keep existing by default
I wanted it a animated cd player
and for the buttons
i used the disord ones
read this properly -_-
Filter
Wrongly formatted JSON & inconsistent quotes as sometimes using " and sometimes using '

But yeah okay, you showed a different screenshot than the emoji you use
ur using custom
but u could put \⏩ instead of the id
It's for a different command
yeah
They showed a screenshot unrelated to the JSON
a
Showing in the select menu which they haven't opened, so we can't see
if your allowed can u say how many bots are there in the queue must be 1000s 😂
Not allowed to say that, private information 
Yeah
i knew it
lol
congrats on being a bot reviewer
how does it feel
to hold such power
😳
wonderful 
that's great 
i wish I was them smh
Day 53: They still didn't notice
Guess I got some time to spend in 2 weeks, Tim
Guess “we” would be more productive if you finish anything already and I put my name under it later

lmao

nice dude. I have a huge task list I need help on!

My first order of business is making a library that takes a stream and an input format and decodes it to PCM using native addon libraries that don't exist for node 18 and then add on a pipeline to apply filters like gain, rate, etc
in java when using this
System.out.println("xxa".compareTo("aac"));
it returns 23, but what does 23 mean in this context? ik it returns a positive number if the first string is greater than the parameter, but what does the number signify
the difference between them
don't worry abt what it means, but if you do, simply ctrl + click at compareTo and read the source code
iirc it's the distance between x and a
difference between the strings or
o
why is it the first char tho
since it should check the whole thing
because why would u compare the second if the first is already different?
o right
java std lib is hugely optimized, they squeeze every single cpu cycle they can get
alr thanks

Guess you should choose Tim!
I think he has some time to spend in between his 5000 projects he’s doing simultaneously
so true, this should be pinned
Ain’t no way you replied to a nearly 10 month old message 💀
damn necromancers
neck romancers
Love your neck bro
lmao
Keep this nsw, please
smh
neck very sensitive area!
new south wales lmao
Are you stalking me watching for typos?

*sfw
never had a stalker yet
Im excited
yes because in the internet grammar and typos matter
null stalking me, too
everyone stalks you fake
Ok so I've got a bit of a complex issue for anyone that knows much about ECSs, what would be the best way to go about applying gravitational forces between 2+ masses? I thought of storing a vector of pairs of references to the transform and physics components of the entities, but doing that wouldn't work as vectors won't store refs like that
Fake is so stalked that he might start doing photosynthesis
Inverse square falloff
Accelerate them towards each other using the formula
Say I have like these entities: ```
Entity1 -> PhysicsComponent, TransformComponent
Entity2 -> PhysicsComponent, TransformComponent
Entity3 -> PhysicsComponent, TransformComponent
// How to create a combination of Entity1, 2, and 3's components to mutate them since I need to calculate the gravitational vector between them?
I'm familiar with the physics behind it
I just don't know how to handle this in ECS
Both have coordinates no?
The issue isn't the math or anything like that, I just don't know how to store references to each of the entity's components so that I can modify them AFTER creating all the combinations I need to create
Can't u set the coordinates after creation?
I had this, but obviously it wouldn't work because I can't mutate them after the first loop without looping over the entities again
Basically for each entity, I need to be able to calculate the gravitational vector between the two, and do the same for all of the rest of the entity combos, then I can add all of the vectors together and get the final resultant force
I just don't know how to modify it
Sorry this is a difficult problem to put into words
It indeed is
Basically ```
Entity1 Entity2 -> Calc and apply force vector between these
Entity1 Entity3 -> Calc and etc..
Entity2 Entity3 -> Calc and etc..
U don't need to calculate any combo, just calculate the net force
I can only calculate the vector between two masses at a time
Why?
Calculate the midpoint before applying to the third object
Doesn't work like that unfortunately
All the resources I found online about this said for systems with more than 2 masses to calculate each force individually and add them together accordingly for the net force
In physics and classical mechanics, the three-body problem is the problem of taking the initial positions and velocities (or momenta) of three point masses and solving for their subsequent motion according to Newton's laws of motion and Newton's law of universal gravitation. The three-body problem is a special case of the n-body problem. Unlike ...
The math isn't the issue
It's figuring out how to actually apply the forces to the components of each entity properly
Since in the foreach loop I don't know how many entities will exist
Actually wait I might be really stupid
I might be able to just store the combinations of entities because my entities are just indices into my ECS
Yeah I might be able to get this to work, hold up I'm gonna try it
Yes I just did the job of a rubber duck
lol
I have no idea what ecs even is
this algo is gonna be really slow since it's O(n^2) but I'll figure out how to improve it later
entity component system
Well yeah, gravitation calculation is really expensive
Ksp suffers heavily from it
basically my own crude implementation of the way Unity works
At a certain point I might have to pre-render simulations instead of doing real time if I want it to be accurate
does the simulation have to be accurate
oh ok
Non-accurate simulation usually renders stuff like orbital mechanics impossible
There's probably some advanced math wizardry I can do
But I'll try this first and see if I can get it to work
lol this is gonna suck
4 for loops running every frame so far
technically even more because there's one that's nested
highly inefficient
Not too much of a choice from what I've seen
not blazing fast 😔
do you at least have a PlayerLoop you can control the speed of
copy other people's code
no idea what that is
so no
lol
Basically a loop that runs on a timeout so that you can control how often all of your game's logic runs through an "fps" setting
that way you can limit cpu and gpu time
Yeah I've got it limited at 60fps right now
in Unity, all of the logic is usually placed on void Update()
It's a very crude impl but I just threw it together to get other things working first
Yeah I've got an update function in my physics system that takes dt
That's basically the main loop
good. Having Update and deltaTime is really huge
this is probably a better way to go about the algorithm lol
You'd be best off referencing actual physics papers and interpreting the expression yourself rather than referencing someone else's code. And to sanity check, you can set up tests to make sure you get physically accurate results
Actually that's for 3d motion
I only have to consider a 2d plane for this
you know I'm genuinely surprised that I can understand most of this math lmao
No idea what the last part of that equation is but I understand the first two parts of it
ok I have finished writing my "test"
hopefully this works
doubt it though
so much that could go wrong with it
fuck off C++ "duplicate constructor" bullshit
how would I get past this issue, I need to have a constructor for my vec2 class like Vec2(T x, T y) but I also need one that's Vec2(T magnitude, double angle)
And whenever T is double, it collides with the other ctor
ok big news: it doesn't work
HOLY SHIT IT WORKS
It's not perfect but I got it to work a little bit
And it's actually pretty good
I gotta fix the forces a little bit
My days at ksp tells me that orbit is a bit...off
oh if you think that's bad: https://gyazo.com/04b2ca6d82aa29d882585adc5be930f7
And the sizes aren't proportional to mass
That blue one has a mass of like 10^13kg but the white one is 100kg
Lul talk about black holes
Y
I mean you have to have pretty big masses for a noticeable gravitational effect to be fair
otherwise the gravity is virtually unnoticable
oh I think I know what's wrong
I'm just applying the force to the object, not calculating the net force
Gonna fix that rq
Quack quack
Shortly after the Big Bang 
in C++ we don't say "Constructor with 0 arguments does not exist for 'PhysicsComponent'" we say this
uh so it works a... little better now? Still fucked up though
this is also a pain in the ass to debug
ok I think I found another problem that I need to fix
these are all the pairs for each frame iteration of the sim
I should only be doing 0, 1; 0, 2; 1, 2;
ok fixed that
now I've got weirder behavior lmao
hi voltrex
GCC and MSVC has very misleading error messages, their diagnostics are not that helpful and are way weaker, you are better off using Clang honestly
banned for advertising
Oh no! :^)
ok so turns out my math is fine, I just need to figure out what the fuck is happening with the vector math
because a mass with 10^12kg is barely even moving a mass of 100kg from 22 meters away
There should be 13.6N of force between the two, which seems to be just fine in my program, which means the accel of the 100kg object should be roughly 0.3something m/s^2
oh maybe I'm big dumb
I think I am
I have the velocity of the 100kg object start at like 75m/s
probably gets too far before the other mass can affect it
msbuild in a nutshell
doesn't look misleading to me
The way you're doing it isn't the same as Waffle's, the error messages shown are completely different
that's because Waffle is using msbuild
They're using MSVC, look at the program path
yes but msbuild specifically
Doesn't change anything
this is msvc and it looks pretty readable, doesn't it 
Did you just not read what I said?
hmmmm
The way you're doing it differs from Waffle's, that's why there's a completely different error message
MSBuild doesn't change it, it's MSVC
???
"???"?
Have you not realized that MSBuild uses MSVC? Do you even know what MSBuild is?
yes i know that
but msbuild's errors are different compared to the compiler (cl)'s output
My guy are you even reading what I'm saying
- MSBuild is a build tool, it's not a compiler; it directly passes everything to MSVC and reports exactly what MSVC reports, does not change anything
- You're NOT doing the same thing as Waffle, which is why you get a different error message that the compilers provide a better error message for
GCC and MSVC are terrible at diagnostics
??? i literally just did what Waffle said, Constructor with 0 arguments does not exist for '[className]'
I'm pretty sure you're misinterpreting what they're doing
I do not see any references to a mismatched constructor call in that error message Waffle got whatsoever, not even one
Again the error messages are completely different, MSBuild does not change errors, so what you're doing would've given you the same error message with MSVC if you were doing what Waffle was doing
Unfortunately it doesn't so the cases are different here
sigh
sanest c++ argument
More like sanest argument with null
volt
I have a question about c++
why is C++ so FUCKING stupid
and how do I fix the stupidity
Um, you're using a binary expression on a vector; you can't append two vectors like that
One message removed from a suspended account.
One message removed from a suspended account.
I'm just gonna use glm
One message removed from a suspended account.
Then it's probably the IDE messing up or something, but ¯_(ツ)_/¯
nah it's apparently just c++ cancer operator overloading
May I see the way you overloaded it?
Vec2& operator-=(const Vec2& v) {
x -= v.x;
y -= v.y;
return *this;
}
Vec2& operator+(double s) {
return Vec2(x + s, y + s);
}
Vec2& operator-(double s) {
return Vec2(x - s, y - s);
}
Vec2& operator*(double s) {
return Vec2(x * s, y * s);
}
Vec2& operator/(double s) {
return Vec2(x / s, y / s);
}
Vec2& operator+=(double s) {
x += s;
y += s;
return *this;
}
// Etc
Now I'm getting this
Yeah I think your IDE is on black tar heroin
Oh yeah the compiler is right, you can't convert the copied (non-&) value to a reference just like that
AHA I GOT IT TO SHUT THE FUCK UP
Stopped it from returning a reference in the operators I wanted to use
Yeah
aka unlimited performance waste on making copies 😈
🥶
@wheat mesa btw if you aren't doing so already, I would recommend checking out the CLion IDE for C/C++ development, it's awesome
Ah
Are you making a physics engine or just simulation?
Making a physics sim
Oh alright, good luck with that
it works
fuck yeah
wish I could record longer than 7 seconds
but too lazy to download obs
you don't have a ```cpp
Vec2& operator+(const Vec2& v);
whenever you are overloading C++ operators, the input and return type must match
average "Voltrex argues about something he never used before" argument
To settle the argument the error was complaining about not knowing how to construct a PhysicsComponent without arguments because I changed the component from a struct to a class and gave it ctors
can you show me the constructors
Well actually looking back at my code that doesn't make sense
But once I added a default ctor it worked
this is the function that was complaining
from this line
Average null assuming that people haven't used certain things, hmm yes you exactly know what I use yeah?
Get off it null
...
This is an amazing sim
It perfectly represents NLUG and UCM
I can find the velocity needed to keep it in perfect uniform circular motion by doing sqrt(G(m1)/r)
plugins are broken atm so I could open blocked messages and I hate it so much 
then don't open them
hard
Anyone here who can help me with select menus.
I managed to make the menu itself
but i want to send a different message for each thing you select.
how would i do that?
its not an funcition
then 
return
Listen for the select menu interaction event and get the value of the item selected (you normally specify a Label and a Value for each option when sending the menu.) Then you can send a message dependant on the item selected
So currently I want to have a statistic page where I can customize some variable from my bot (Aka metric) and send those custom variable to a website of mine. Is there any good framework/library/project that does this?
Oh forgot, I am using TS/JS for my bot
what are you using for your website?
Technically I use Ghost CMS which is a Node.JS Blog CMS
I only want to implement a metric page that receive the data my bot send it to
So I am looking for any project that does this already then I will figure out the rest myself
do you have access to the backend code? or do you have some plugin that allows you to write backend code?
you basically have 3 options:
- add a small webserver to the bot that responds with the bot data, and have your website's backend make a request to your bot and put the data in the page
- if your website is fully static and has no backend you can still do the above via frontend javascript, but your bot's webserver will be exposed to be public
- use a shared database, your bot periodically stores data in a database and your website's backend fetches data from the same database on page load
Some people don't recommend ExpressJS because it doesn't get updates very actively etc. but is it now a good choice or not? I've just seen that they are working on v5 and development is still active. 
express is fine for most people, it doesnt really need updates
but if you're an enthusiast, there are more performant options
usually in exchange for being simpler or having less features
Web Frameworks Benchmark. There are many frameworks, each one comes with its own advantages and drawbacks. The purpose of this project is to identify them and attempt to measure their differences (performance is only one metric).
the top 5 use a separate c++ webserver instead of the node's built in http which makes the comparison unfair to other libs
but its an additional native dependency
also keep in mind that these scores are basically for empty responses, aka just respond and do nothing
as soon as you start adding some backend code, your performance will be much lower, regardless of which framework you use
Very interesting. Well I do care a bit about performance but definitely not that much.. I just want a working, easy to use and especially easy to structure framework. (Most likely NodeJS) And a good documentation also... I saw some nice frameworks but the docs are not that good and it doesn't have a big community so...
I'm very close to just build such a damn framework myself even if I know it's kind of a bad idea xD
its not a bad idea to work directly with node:http
thats what i do, and i find it much more comfortable than using something that i dont know what exactly it is doing
Yes I also thought about that and also to understand the thing more deeply. Would also be a good choice. And after I learnt how it really works I can still decide to build my own framework on top of it xD
for example you can check the headers before deciding if you accept or reject the request and avoiding unnecessary data processing
Also the NodeJS docs are clean and helpful
ye you can do nearly everything with it
fastify
i need to start looking for some sort of web framework to use for my bots dashboard. problem is i'm not exactly sure how to make it interact with my bot.
Have the user authenticate with Discord and have a backend that can handle requests from users?
How do i check my bot's permissions in a guild?
What library?
You can use <Guild>.members.me to get your bot's guild member instance
Then access some property like .permissions/.permissionsIn(...)
Thanks ill try it
is this where i report a problem
not really, but problem about what?
my bots
i mean, this is a place where you can get help with your coding
is it a bot you made?
idk how to make a bot
well this is the place to help people who own their own bots
oh
are you using someone elses bot?
yes
then you have to contact the owner of the bot
oh
Guys what is the command to let the Bot count the Servers the Bots in?
Whats the code for it?
I dont have it in my head rn
what language/library?
inb4 "autocode"
Is this how I properly prevent sql injections?
node
discord.js?
yes
client.guilds.cache.size
thanks
yes
do I need quotes around the question marks to allow for spaces?
no
ok, thanks
I currently have this await db.query("select * from userapps where appname like '" + appname + "%';") but if I replace it with await db.query("select * from userapps where appname like '?%';", [appname]), it stops working, why?
nvm, ? also works instead of ?%
hey guys
void show_months()
{
int year;
Month month = {};
cout << "Welcome User! Please input the desired year: (Note: your input must be real numbers!)" << endl;
cin >> year;
while(cin.fail()){
cout << "Error, You may only input real numbers!\nPlease input the desired year:" << endl;
cin.clear();
cin.ignore(256, '\n');
cin >> year;
}
cout << "Now please input the desired month: (Note: your input must include real text only!)" <<endl;
cin >> month;
while(cin.fail()){
cout << "Error, You may only input real text!\nPlease input the desired month:" << endl;
cin.clear();
cin.ignore(256, '\n');
cin >> month;
}
```Month is an enum. I am trying to save my console into a variable that is part of an enum.
enum Month = {January, February etc etc).
So if i would type January, it should get the Month January value for example
However right now it says that there's no mattch for operator >>
that happens because ? will be treated as normal character when using quotes
an enum is a collection of integers that are identified by name in the code
the actual type of an an enum is an int
yup i know
finally, my PC is running again after swapping the psu, so... guess we're good to go soon, Tim
But my teachers asks me to input the month name
enter a year and month, and responds with displaying the month calendar as described above by printing
to cout. For the user of your application it should be clear what input is expected by the program``` I asked around and you apparently must input a month name
use a switch with cin
xD
uhh okay let me try
that ain't funny... I was freaking out for like 10d, since the pc randomly turned the power off and restartet
which was a "well" working overload protection by the psu
it couldn't handle the gpu power peaks
thats why i recommend 1000w psus
I mean... it was 7yo so good job I would say
xD
huh but wait, a switch case only works with integers?
but older PSUs can't handle the power peaks newer hardware, especially graphic cards reach
are you using c or cpp?
c++
so cpp
rn i am trying to find a way to input a string like January
and it would convert to the actual enum
which turns out to be a much higher investment than I planned, means there's not much left for you, Tim
gonna pay you with water and dry bread
use if else then lol
lmao what are you, a communist?
do you putin or do you putout?

what exactly does this mean?
did you pass nothing
well your parameter is undefined
I did pass something
ig, it only happens after one successful usage
why actually username LIKE ?
- copied code *
you wanna get multiple user names as result?
no
how big is the speed / latency difference between mariadb and mongodb btw? Im switching over easy parts right now but want to get the motivation to do everything
that fairly depends on if you host the database locally or externally
locally, kinda
well locally is pretty much 0 latency
with a ping I get 0.2ms to the other server, so kinda local
as long as its in the same datacenter, there should be no issues
What's the accurate name for standard emojis? Does it include the : in the name or not?
..., emoji: { id: null, name: ":flag_us:" }
surprisingly I'm getting an Invalid Form Body for both :flag_us: and flag_us
unfortuanlly that's all I can see in the docs
doesn't provide the name for me, sadness
the accurate name is literally that
The actual unicode
ah i thought it would parse the name for me to an unicode char
\🇻🇳
discord just uses placeholders so people dont need to bring unicode keyboard
they don't have a name at all
https://ogmmateryal.eba.gov.tr/panel/upload/etkilesimli/kitap/almanca/a11/unite1/index.html
How can I make this kind of page switching animation?
You can also fold it with the mouse.
lmao forget abt it
like this
if there's someone in this server that could do it that one is Sayuri
that's uber level of difficulty
😕
to do something like that it requires extensive knowledge of css animation framework and js
you were struggling with canvas masking not long ago, go easy buddy
I can only imagine the site/page being unmaintained
frankly if i can find the source code for something like this it would be very helpful because I don't think our state did such a thing itself
I mean, u can
press F12
all non-SSR web pages are technically open-source
and ssr pages aren't as interactive
I was just wondering how it was done I don't plan to do such a thing.
probably with webassembly
or perhaps, java applet
since it took some time to load the page
@solemn latch
msged aurel
?
ab dis
lmfao
Got banned 
thank you
attachment://name.ext
Can someone actually help me with V14 like its getting my hea done it and I literally only have index.js
I hit start and it says Ready, yet it doesnt make the bot online, I check the login and its correct.
show how u did
const { Client, GatewayIntentBits } = require('discord.js');
const { token } = require('./config.json');
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.once('ready', () => {
console.log('Ready!');
});
client.login(token);```
(nvm i fixed the error 🙂
Question, how easy is it to just change current commands to V14 bc I don't want to have to rewrite them all
I have all the main files now in V14
"how easy" is kinda hard to answer
it all depends on how you structured your commands
I think alot of it is quite close actually
in the ideal scenario you'd just need to hit "replace in files" and you're done
ooo
Has subcommands changed because I tried it and it said no repeating names but when I removed the subcommands it worked fine ;/
huh... how's possible this.requests is undefined?
cause your bad
wdym? you can't set the same (sub) command names for the same command group
i'm probably blind but not bad
like the .setname('help') for example and when you deploy it says names cant be the same when sub commands are like 'mod'
that means you have a (sub)command with that name already
But I don't? I'm confused rn
then fetch the commands and see
Im probs gonna rewrite subcommands manually, but the rest seem to work with v14 like there was no changes
ty
Yep give me a second, bc i already deleted them
command
-> sub command
...
command2
Thats the new layout?
that's how you should explain it to me, your structure since i cant see it
WHERE IS THE ISSUE BITCH
idk
IK
const {SlashCommandBuilder, EmbedBuilder} = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('echo')
.setDescription('Repeats what your input is. We have 3 different styles.')
subcommands here
async execute(interaction) {
if (interaction.options.getSubcommand() === 'normal') { //normal
const value = interaction.options.getString('input');
await interaction.reply({content:'Echo submitted.', ephemeral: true});
if (value) return interaction.followUp(`${value}`);
return interaction.followUp({content: 'No option was provided!', ephemeral: true});
} if (interaction.options.getSubcommand() === 'command-box'){ //Command Box
const value = interaction.options.getString('input');
await interaction.reply({content:'Echo submitted.', ephemeral: true});
if (value) return interaction.followUp(`\`${value}\``);
return interaction.followUp({content: 'No option was provided!', ephemeral: true});
} else if (interaction.options.getSubcommand() === 'embed'); { //Embed
const value = interaction.options.getString('input');
await interaction.reply({content:'Echo submitted.', ephemeral: true});
const echoEmbed = new EmbedBuilder()
//.setColor(0x0099FF)
.setColor('Random')
//.setTitle('Click Here: Support Server')
//.setURL('https://discord.gg/VHbGUmUNPs')
//.setDescription('Message from Trestic.')
.addFields(
{
name: 'Greetings!',
value: `${value}`,
inline: false
},
)
.setTimestamp()
.setFooter({ text: '© This bot belongs to Trexie. (Run /info bot for accurate tag and User ID.)'});
await interaction.followUp({ embeds: [echoEmbed] });
}```
I jsut send this for ya 🙂
I have run into this issue before though
const fs = require('fs');
for (file of fs.readdirSync("./methods").filter(f => f.endsWith(".js"))) {
module.exports[file.split('.')[0]] = require(`./methods/${file}`);
}```🗿
I had to remove the .addsubcommands bit so it would send
Are sure it is looking in the right place?
dont use relative paths for read dir sync
use absolute paths
^
h
Show full code
that's causing an api error?
that's the full code lol
except you wanna see the class name
alr that worked ty
Deploy error says soemthing like DUPLICAT_NAMES-NOT_Allowed
u cant have 2 commands with the same tree
means that there must be another command with the name echo
How are yoyu using loadRequests @boreal iron
ok ty
Like in the initServer method is that the only place you use it?
getting called insite initServer()
of course, yeah
just once
I mean we're speaking about js basics and I'm being dumb right now and dont get it
https://stackoverflow.com/questions/4011793/this-is-undefined-in-javascript-class-methods the only thing I could think of this guy's answer explains it better than I could
must be something obvious like a typo
but I don't see how his answer applies here
I dont see a typo
what in the world...
?
could it be it isn't available since handleRequest() is used as callback function of createServer()?
killing this as class scope in it?
Well thats very likely
as this will no longer be the class
it would be whatever createServer passes
you'd wanna bind this to it probably
yeah I see, I logged this
it's really because it's been used as callback
Yea any time you do that you wanna just bind this to it so it keeps it's class props
that confuses me a little bit
How so
how to bind it within my context
this.handleRequest.bind(this)
actually before using it as callback or after?
http.createServer(this.#handleRequests.bind(this)).whatever
So it worked?
yeah
should have thought about that earlier since it's been used as callback function
me dumbass didn't log this to see the issue
Yea
You gotta think that this isn't just related to the class
once you go out of scope of the class this is whatever the new scope is
This is why people use arrow functions when they wanna preserve the original scope
yeah... it's just not really what I want here
but yeah at least we could figure out the issue
oh god
ik
actually wanna expand my app by a few endpoints I can receive external data from
and want to keep things as modular as the rest of my app
to handle each possible request endpoint in modules
which makes it much more easier
idk why I tend to overengineer things
but it's fun
.
I have no fucking clue what you are making bbut go for it
anyone know how I can upload something (my command handler) to NPM? Fixed
Ping or DM me thanks in advance
did u check the docs?
gotta link to that?
Also, lets say I want to update it again, am I able to do a command to update it or would I have to make a whole new NPM
you'd make another release, like you'd do with github
not another npm, another release
thank you
is there a way to silently acknowledge a slash command? for example, im making a simple /say slash command. i just do /say (my message) and my bot will send that message to a channel. i dont want my bot to reply to my original slash command, but just send a normal message
unfortuanlly not
no
damn
but
They do it by default
what you can do is
i have this rn lol
deferring the reply, then deleting the initial response
oooo
you will have to defer the interaction which actually is the first response (reply)
before deleting it
makes a "bot is thinking" then goes away
but yes i don't a reason to do this, too
how long does this last?
until you delete it
haha theres no practical reason for it, its a cmd that only i can use to just mess around with friends
🤔
I see, I am thinking of something like Prometheus and then work from there
you should think about just sending an ephermal message telling the client, the action has been successful
much smarter
ty
but lemme test the deferring trick real quick
wanna see if you can delete the deferring state
🫡
i tried the deferreply method and for a very brief second you can see "bot is thinking" as a third person
yes works perfectly
await interaction.deferReply();
await interaction.deleteReply();
but... yeah responding with an ephermal message still makes more sense
yea i like the latter method bc diff user cant see the messages quickly appear/disappear
but thank you!
np
JDA (Java) has deferEdit() which acknowledges the command but avoids the the thinking thingy, idk what exactly they do though, never looked at the code
There's no such a possibility
It's possible it does what I mentioned above
There's no callback type which would allow just an ACK without responding accordingly
Or the interaction will fail
deferEdit is the "Bot is thinking" ack
yeah what I already expected
but avoids the the thinking thingy
just that is what's technically impossible
what IS possible, is acking, editing then deleting the message
tho at the cost of 3 requests
no
see above
ack (deferring) and deleting this (initial) response is just 2 requests
and the "bot is thinking" will not blob up
ah yes
at least just for a millisecond maybe
since we (users) can have different pfps in different servers, does that mean bots can too 
since they can use animated emojis
assuming its possible that bots can do the same too ?
Afaik they can not do any of that
I'm sure they will eventually
bot nitro subscription soon
Imagine having a well coded and working bot…
Fuck this!!1!
Buy bot-nitro and add a fancy banner
@solemn latch hi
It is entirely possible bots will be allowed to have custom profiles as the discoverability page Discord is working on makes use of the profile accent color to display a banner
async with cs.get("https://avwx.rest/api/metar/KFRG?options=&airport=false&reporting=true&format=json&onfail=cache&token=TOKEN") as r:
How do I get this to look at the token inside the .env file? I already have the code in to load the .env file. Python code
Use an fstring
Like:
print(f'Command r!{ctx.command} used in a channel outside airport')```?
Yes
K
I love websockets!!!
@lyric mountain @boreal iron
These component interactions offer 4 response types:
Reply
Deferred Reply
Edit Message
Deferred Edit Message
The reply and deferred reply responses are identical to the Slash-Commands response types. However, these new edit response types are used to update the existing message the component is attached to. If you just want to acknowledge that the component was successfully interacted with, you can simply call
deferEdit()without any further updates, which will prevent the interaction from failing on the user side.
Quote from https://jda.wiki/using-jda/interactions/
As i said, they are probably just using this as a shortcut to the trick you showed
i haven't looked at the code
deferEdit is the only way to noop an interaction
which is cool that it exists
but I wish an op noop just existed or it got renamed to noop
The only downside is you cannot edit the original interaction response iirc
Ye i'm not quite sure there
Correct me if i'm wrong, but isn't value 6 what this is doing?
That is deferEdit
Yeah, because they cited it and said it doesn't exist and it literally stands there
why isnt it centered?
idk why its suddenly working but it is ig
yoo question! any documentation that shows which intents are allowed for SERVER MEMBERS INTENT
This is available exclusively for components, for example for button interactions.
The context was about command interactions which is not possible to just ACK them.
See here:
So… this still isn’t possible for any other interaction type except component interactions
Unfortunately
const fs = require('node:fs');
const path = require('node:path');
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord.js');
const { clientId, guildId, token } = require('./config.json');
const commands = [];
const commandsPath = path.join(__dirname, 'commands');
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);
commands.push(command.data.toJSON());
}
const rest = new REST({ version: '10' }).setToken(token);
rest.put(Routes.applicationGuildCommands(clientId, guildId), { body: commands })
.then(() => console.log('Successfully registered application commands.'))
.catch(console.error);```
How do i stop it going to just the designated guild on V14?
I tried removing GuildId in routes and I just get an error
I mean the method is called “applicationGuildCommands()”
So… just removing the guild ID will cause an error, yes
You need to register them globally if you wanna push ‘em to all guilds
Also you dont need to import REST or routes
There are inbuilt methods in djs to register/edit/delete commands
<client>.application.commands.create(<array of commands>);
I have a curious question, if I have a domain: example.com. I have a subdomain: mc.example.com, is it possible to have shop.mc.example.com?
In your case
Sure why not
Wait, really?
Yeah
super.top.secret.shop.mc.something.org is also possible
Wouldn't that be a suspicious link?
Its still just a subdomain
Im confuzzled
oh ty, it just said on V14 guide so i added it
Yes! Sweet.
commands.push… is your array of commands already
This is what you can use to push to your client.application.commands.create(…); method
Unfortunately the v14 guide is absolutely trash
Agree
Looks like a replica of V14 with just intro changed
If youre curious
This tree of subdivisions may consist of 127 levels.
Each label may contain up to 63 characters. The full domain name may not exceed a total length of 253 characters
So… you can nest a few levels if you wish to 
Idk… pigs will learn to fly before I will ever touch that ugly ts
Is there a list of all the embed colour options?
You mean Embed()?
Yes but the colours you can have
E.G: Aqua (I know thats there) and random
Do you want the list of colors?
yes please
export declare const Colors: {
Default: 0x000000;
White: 0xffffff;
Aqua: 0x1abc9c;
Green: 0x57f287;
Blue: 0x3498db;
Yellow: 0xfee75c;
Purple: 0x9b59b6;
LuminousVividPink: 0xe91e63;
Fuchsia: 0xeb459e;
Gold: 0xf1c40f;
Orange: 0xe67e22;
Red: 0xed4245;
Grey: 0x95a5a6;
Navy: 0x34495e;
DarkAqua: 0x11806a;
DarkGreen: 0x1f8b4c;
DarkBlue: 0x206694;
DarkPurple: 0x71368a;
DarkVividPink: 0xad1457;
DarkGold: 0xc27c0e;
DarkOrange: 0xa84300;
DarkRed: 0x992d22;
DarkGrey: 0x979c9f;
DarkerGrey: 0x7f8c8d;
LightGrey: 0xbcc0c0;
DarkNavy: 0x2c3e50;
Blurple: 0x5865f2;
Greyple: 0x99aab5;
DarkButNotBlack: 0x2c2f33;
NotQuiteBlack: 0x23272a;
};
There you go.
:)
Now all i have to do after reworking embeds out, is begin database work 🙂
All the best.
hmmmm then JDA has some trick / shortcut implemented
Yeah probably defers the interaction as initial response and deletes it immediately
But I still dislike that for command interactions
anyone knows why it bugs when i try filtering this?
like if i search for the second element in the contacts array
and then delete that search
the first and second contacts are the same
idk if exists better way of making this
cause then i am using it this way
wdym delete that search?
I have an search state set to ""
When the input changes it changes that state
When I clear the input
Set the state to "" again
hey guys
collector.on("collect", (i) => {
console.log(i.user.id === gamedatabase[key].user1)
console.log(i.user.id)
console.log(gamedatabase[key].user1)
if (i.user.id === gamedatabase[key].user1) {
if (i.customId === `${key}-bottomleftshoot`) {
status = true;
shootingposition = "bottomleft";
}```How the fuck can the collector still save an interaction
eventhough the if i.user.id === gamedatabase[key].... is false?
Like how the fuck
this is a createMessageComponent collector btw
Dont see you returning it or using a filter
Sorry forgot to include it
look
if ((i.user.id === gamedatabase[key].user1) === true) {
if (i.customId === `${key}-bottomleftshoot`) {
status = true;
shootingposition = "bottomleft";
}
}else{
return;
}```
It still accepts all users to click the button
how the fuckkk
@lyric mountain - I have a question I'd like to ask you...
I currently have the following directories: https://cdn.hamoodihajjiri.com/Hantg0mIla
The code for Shoe.java is:
package com.hamoodihajjiri.items;
public class Shoe {
private int size;
public void wear() {
System.out.println("I wore the shoe.");
}
}
And the code for Main.java is:
package com.hamoodihajjiri;
import com.hamoodihajjiri.items.Shoe;
public class Main {
public static void main(String[] args) {
Shoe shoe = new Shoe();
shoe.wear()
}
}
Why can't I use wear() if I add static to public void wear() {...}?
@harsh nova
Don't forget his shoes on his way out.
UUHMMMM
if(i.user.id !== gamedatabase[key].user1) return;
if(i.customId === `${key}-bottomleftshoot`)
{
status = true;
shootingposition = "bottomleft";
}
// or
if(i.user.id === gamedatabase[key].user1)
{
// id matches
}
else
{
// id doesn't match
}
const filter1 = i => i.member.id === gamedatabase[key].user1
const collector = r.createMessageComponentCollector(filter1,{
componentType: "BUTTON",
time: 10000,
max: 1,
});```would anyone know why this freakin fucking filter isn't working?
owh i used filters now
if you change a method to be static, you have to call the method on the class itself, instead of the class instance
in this case it will be Shoe.wear() instead of shoe.wear() (note the case)
^
OOP 🤮
OOP C:
gross
strict OOP and purely functional programming are two sides of the same coin - seems good at first but it gets really fucking ugly when the codebase grows
If I want for each individual object to have the method.. do I not make it static?
ok, I have a website, on it you can create accounts, login and stuff; my biggest problem rn is to find a way to prevent spam accounts, user sided captchas wont help because you can just make a request to the backend directly
yes correct
Captchas is what you want - you're probably misunderstanding the way they work
especially if you are mutating any of the non-static instance properties, then use a non-static method
captchas are what you are looking for, either means you didn't not implement them properly or they are too simple and can be solved too easily
So I somehow need to check in the backend if the user provided a valid captcha result?
yes, that is the intended usage
what captcha would I use to make it impossible to automate? google?
Lastly, how does this work?
You can call wear() inside oops()?
https://cdn.hamoodihajjiri.com/FmrmTl0dQk
this.
yes
What?
you can call methods inside other class methods
for brevity/best practices you call the function with this.function, though in java it is optional and it will refer to the current class method with the name
What? I thought you need to use static?
Like in main, you need to make the method static to call it in your main method.
Captcha Provider (e.g. reCAPTCHA) -> Provides captcha challenge to user -> User completes challenge -> Token obtained from captcha provider
User submits account creation form (note: with token as well) -> Backend should verify captcha token with Captcha provider to confirm challenge has been solved
this should work, right?
https://www.youtube.com/watch?v=UzCkSzmEq8E
In this video we will implement Google's reCaptcha v2 in a client-server environment with Node.js. We will submit the client side form to the server using the Fetch API.
CODE: Code for this project
https://github.com/bradtraversy/recaptchav2_node
BECOME A PATRON: Show support & get perks!
http://www.patreon.com/traversymedia
ONE TIME DONATION...
If you have a method called lmao and you want to call it in your main method, instead of doing Main main = new Main(); main.lmao(), you can just call lmao() but having the method be static.
main is the only place where you truly need a static function. However, the right way should be that you instantiate an instance of the class you need access to and call its member methods from there
that is intended
A static method is attached to the class, regular methods are attached to instances of the class
how do I make the link clickable on embed ?
Ohh.
make it a proper URL
or use link markdown syntax
I may not be too clear about this, let me rephrase
for a typical Java application, the Main class should only be the entrypoint to call on your other classes and then your application code should go into those classes instead. Example:
public class Main {
public static void main(String[] args) {
MyApp myapp = new MyApp();
myapp.start();
}
}
public class MyApp {
public void start() {
// do stuff here
}
}
@fluid basin damn thats a face I dont see often
i'm prolly really dumb but how do i create a command that displays fields that contains the json objects per resource
can you provide an example of what you'd like the bot to display?
discord.py^
example, a command called resources that includes the json fields, so item name, rarity, description, icon, and collection
but it would automatically grab the information from the json file
displaying all of them or just one at a time
hey um how do i get all slash commands by their name?
so like a paginator?
and kinda delete it
You can just PUT an empty array to your commands
that will remove all of the previously registered commands?
would it be possible to display all by collection provided
Yup
so if a user wanted a collection for iron, they'd click iron and itd bring up the resources for that specific colection
You'd just have to filter through the JSON to see if a descriptor's collection matches a specific value
ah
thanks
👍
uh how'd i do that
ty
Idk if I understood it right, but are you saving user data in json files?
^
Ah, nvm then
K, I'm back
You can make it static, yes, but your example is a bit weird
In your example, the proper thing would be having instance methods and a constructor to set the size
Static methods are more for scenario-independent cases
how do I make a google captcha centered?
Where the current values don't matter
Center the div, unironically
@quartz kindle so... i was playing around with node:http(s) recently, starting to build something modular and i'm running into some issues
After creating the server I'm gonna check the property <server>.listening to make sure the server is running (https://nodejs.org/api/net.html#serverlistening)
for some reason the property is always undefined until the first client request has been made
is that supposed to be like that... or?
that's exactly what i was looking for, thank you so much!

Perhaps ur server is running in on-demand mode, if that exists for that lib
Making it only go up when theres a request, returning to standby after a while
I saw some libs work like that, idk for node http tho
On the server.listen function, there's a callback where you can assign a value to a variable
uh no
or maybe? idk
oh yeah
listening event
If you want to reference something
https://github.com/AmandaDiscord/Amanda/blob/rewrite/source/website/server.ts#L64
listen is async, so if youre checking for listening right after it will never be true
yeah.. but hmm thought that would be written down somewhere explicitelly
for dumbasses
You have to keep in mind that the http lib was made before Promises existed
well idk about that one but okay
its right there lol
This function is asynchronous. When the server starts listening, the 'listening' event will be emitted. The last parameter callback will be added as a listener for the 'listening' event.
huehuehue
Oh, fair enough. 👍
what does { success: false, 'error-codes': [ 'bad-request' ] } mean for recaptcha?
nvm, I entered an acciental character in my request
How do I make bot removed a role then add role after doing verification ?
interaction.reply({ files: [image], fetchReply: true }).then(function (msg) {
const filter = s => s.author.id == interaction.user.id;
interaction.channel.awaitMessages({ filter, max: 1 }).then(response => {
if (response.first().content === captcha.value) {
response.first().delete();
msg.delete();
client.succNormal({
text: "You have been verified by our system"
}, interaction.user).catch(error => { })
var verifyUser = interaction.guild.members.cache.get(interaction.user.id);
verifyUser.roles.add(data.Role);
}```
^ this add new role after verification but doesn't remove the unverified role so user keep both of the roles and can't see channels till the unverified role removed
Why does node:querystring parse this as result?
curl -v https://... -H "Content-Type: application/x-www-form-urlencoded" -X POST -d "param1=value¶m2=value2"
let body;
request.on("data", (chunk) => body += chunk.toString());
request.on("end", () =>
{
console.log(body);
body = querystring.parse(body);
console.log(body);
response.writeHead(200).end();
});
// result
undefinedparam1=value¶m2=value2
[Object: null prototype] { undefinedparam1: 'value', param2: 'value2' }
where tf is the undefined are coming from?
where's our nodejs maintainer if you need 'em... @earnest phoenix
randomly pinging the entire server
FIXEDthe "path" argument must be of type string or an instance of buffer or url. received undefined any idea or help? Ping or dm me
show code
test
?
Test successfully passed 
Even though you've already figured it out, you shouldn't use the node:querystring built-in module as it's legacy and no longer updated, use the global URLSearchParams class for that
yup
user_banner and guild_banner being the hash of course
Good to know, I will do thanks
const commands = message.client.botCommands
.array()
.filter((c) => c.category.toLowerCase() === type);




