#development

1 messages · Page 52 of 1

manic crane
#

Not in my vps

lament rock
#

That's great, but did you read the error

lyric mountain
#

how did u transfer the code to the vps?

manic crane
manic crane
lament rock
#

how

lyric mountain
#

I didn't ask IF, I asked HOW

lyric mountain
#

sigh

#

yes that is your code in ur pc

#

but how did u pass it to the vps?

manic crane
#

its not my pc

lyric mountain
#

it's the vps?

manic crane
#

its mobatexteditor

manic crane
#

i just wrote pasted the code there

lyric mountain
#

did u make sure both sides are expecting the same charset?

lament rock
#

Does the bot in the vps even have access to the emojis that are in there

lyric mountain
#

ah wait, found the issue

#

but to be honest, it wasn't working in ur pc

#

emoji cannot be just the id for buttons

manic crane
#

I fixed it lol

#

it was working

#

@lyric mountain copy paste wont work on vps

#

i just knew it

#

kek i am new ngl

lyric mountain
#

ah nvm, it does allow only ids

lament rock
#

probably only if it's cache

#

or they do the _:id trick

lyric mountain
#

it's not only safer, but guarantees both sides are exactly equal

lament rock
#

github!

lyric mountain
#

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

opaque marten
#

i'm too stupid to read, my bad, i skipped his new answers

lyric mountain
#

lul

earnest phoenix
#

I correctly understood that the site should be on the same server with the bot?

lyric mountain
#

that's one option, the other is having an api together with the bot

#

to allow requesting info from it

lament rock
#

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

lyric mountain
#

why are u using ids tho?

#

⏩ those emotes exist as default emojis

#

simply paste \⏩

#

@manic crane ^

manic crane
lyric mountain
#

yes but those emojis exist in discord already

manic crane
#

It was a filter thing lol

lyric mountain
#

...?

#

what I mean is that u don't need to use custom emojis if they already exist on discord

earnest phoenix
#

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

manic crane
manic crane
#

i used the disord ones

#

read this properly -_-

#

Filter

earnest phoenix
#

Wrongly formatted JSON & inconsistent quotes as sometimes using " and sometimes using '

#

But yeah okay, you showed a different screenshot than the emoji you use

lyric mountain
#

but u could put \⏩ instead of the id

earnest phoenix
#

It's for a different command

manic crane
earnest phoenix
#

They showed a screenshot unrelated to the JSON

lyric mountain
#

a

earnest phoenix
#

Showing in the select menu which they haven't opened, so we can't see

manic crane
earnest phoenix
#

Not allowed to say that, private information kryptonWriting

ancient nova
#

how does it feel

#

to hold such power

#

😳

earnest phoenix
#

wonderful KEKW

ancient nova
#

that's great KEKW

sick agate
#

i wish I was them smh

quartz kindle
#

inb4 abuse of power

#

:^)

lyric mountain
#

Day 53: They still didn't notice

boreal iron
#

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

quartz kindle
#

lmao

boreal iron
lament rock
#

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

sterile lantern
#

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

lyric mountain
#

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

sterile lantern
#

difference between the strings or

#

o

#

why is it the first char tho

#

since it should check the whole thing

lyric mountain
#

because why would u compare the second if the first is already different?

sterile lantern
#

o right

lyric mountain
#

java std lib is hugely optimized, they squeeze every single cpu cycle they can get

sterile lantern
#

alr thanks

boreal iron
#

Guess you should choose Tim!
I think he has some time to spend in between his 5000 projects he’s doing simultaneously

cursive musk
#

so true, this should be pinned

wheat mesa
#

Ain’t no way you replied to a nearly 10 month old message 💀

lyric mountain
#

damn necromancers

quartz kindle
#

neck romancers

sharp geyser
quartz kindle
#

lmao

boreal iron
#

smh

#

neck very sensitive area!

pale vessel
boreal iron
#

*sfw

#

never had a stalker yet

#

Im excited

radiant kraken
boreal iron
#

null stalking me, too

radiant kraken
#

everyone stalks you fake

wheat mesa
#

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

lyric mountain
#

Fake is so stalked that he might start doing photosynthesis

lyric mountain
#

Accelerate them towards each other using the formula

wheat mesa
#

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?

wheat mesa
#

I just don't know how to handle this in ECS

lyric mountain
#

Both have coordinates no?

wheat mesa
#

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

lyric mountain
#

Can't u set the coordinates after creation?

wheat mesa
#

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

lyric mountain
#

It indeed is

wheat mesa
#

Basically ```
Entity1 Entity2 -> Calc and apply force vector between these
Entity1 Entity3 -> Calc and etc..
Entity2 Entity3 -> Calc and etc..

lyric mountain
#

U don't need to calculate any combo, just calculate the net force

wheat mesa
#

I can only calculate the vector between two masses at a time

lyric mountain
#

Why?

wheat mesa
#

That's what the formula specifies

#

Fg = G(m1m2/r^2)

lyric mountain
#

Calculate the midpoint before applying to the third object

wheat mesa
#

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

lyric mountain
#

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 ...

wheat mesa
lyric mountain
#

In that case it's simple force calculus

#

A - B = C

wheat mesa
#

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

lyric mountain
#

Yes I just did the job of a rubber duck

wheat mesa
#

lol

lyric mountain
#

I have no idea what ecs even is

wheat mesa
#

this algo is gonna be really slow since it's O(n^2) but I'll figure out how to improve it later

wheat mesa
lyric mountain
#

Well yeah, gravitation calculation is really expensive

#

Ksp suffers heavily from it

wheat mesa
#

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

lament rock
#

does the simulation have to be accurate

wheat mesa
#

I would like it to be

#

It's not for a game, I'm making a physics sim

lament rock
#

oh ok

lyric mountain
#

Non-accurate simulation usually renders stuff like orbital mechanics impossible

wheat mesa
#

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

lament rock
#

highly inefficient

wheat mesa
#

Not too much of a choice from what I've seen

radiant kraken
#

not blazing fast 😔

wheat mesa
#

Might need to resort to pre rendering the sim

#

Or a better algo

lament rock
#

do you at least have a PlayerLoop you can control the speed of

radiant kraken
#

copy other people's code

wheat mesa
#

so no

#

lol

lament rock
#

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

wheat mesa
#

Yeah I've got it limited at 60fps right now

lament rock
#

in Unity, all of the logic is usually placed on void Update()

wheat mesa
#

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

lament rock
#

good. Having Update and deltaTime is really huge

wheat mesa
#

this is probably a better way to go about the algorithm lol

lament rock
#

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

wheat mesa
#

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

wheat mesa
#

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

lyric mountain
#

My days at ksp tells me that orbit is a bit...off

wheat mesa
wheat mesa
#

That blue one has a mass of like 10^13kg but the white one is 100kg

lyric mountain
#

Lul talk about black holes

deft rock
#

Y

wheat mesa
#

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

lyric mountain
#

Quack quack

wheat mesa
#

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

radiant kraken
#

hi voltrex

earnest phoenix
radiant kraken
#

banned for advertising

earnest phoenix
#

Oh no! :^)

radiant kraken
#

since you are a member of llvm this counts as a promotion

wheat mesa
#

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

earnest phoenix
#

The way you're doing it isn't the same as Waffle's, the error messages shown are completely different

radiant kraken
#

that's because Waffle is using msbuild

earnest phoenix
#

They're using MSVC, look at the program path

radiant kraken
#

yes but msbuild specifically

earnest phoenix
#

Doesn't change anything

radiant kraken
earnest phoenix
#

Did you just not read what I said?

radiant kraken
earnest phoenix
#

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

radiant kraken
#

???

earnest phoenix
#

"???"?

radiant kraken
#

you've clearly never used msbuild

earnest phoenix
#

Have you not realized that MSBuild uses MSVC? Do you even know what MSBuild is?

radiant kraken
#

yes i know that

#

but msbuild's errors are different compared to the compiler (cl)'s output

earnest phoenix
#

Nope

#

MSBuild does not report different errors than MSVC

radiant kraken
#

same case for gcc

#

they even provide candidates

earnest phoenix
#

My guy are you even reading what I'm saying

radiant kraken
#

yes i am

#

i'm just proving my point

earnest phoenix
#
  1. 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
  2. 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

radiant kraken
#

??? i literally just did what Waffle said, Constructor with 0 arguments does not exist for '[className]'

earnest phoenix
#

I'm pretty sure you're misinterpreting what they're doing

radiant kraken
#

that's literally what the error is about

#

mismatched constructor calls

earnest phoenix
#

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

radiant kraken
#

sigh

wheat mesa
#

sanest c++ argument

earnest phoenix
wheat mesa
#

volt

#

I have a question about c++

#

why is C++ so FUCKING stupid

#

and how do I fix the stupidity

earnest phoenix
wheat mesa
#

Yes I can

#

because I said so

earnest phoenix
#

👀

#

Did you overload the operator or something?

sage bobcat
wheat mesa
#

I'm giving up

sage bobcat
#

One message removed from a suspended account.

wheat mesa
#

I'm just gonna use glm

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
wheat mesa
#

nah it's apparently just c++ cancer operator overloading

earnest phoenix
#

May I see the way you overloaded it?

wheat mesa
#
    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

earnest phoenix
#

Yeah I think your IDE is on black tar heroin

wheat mesa
#

Nope

#

Doesn't build

earnest phoenix
#

Oh yeah the compiler is right, you can't convert the copied (non-&) value to a reference just like that

wheat mesa
#

AHA I GOT IT TO SHUT THE FUCK UP

#

Stopped it from returning a reference in the operators I wanted to use

earnest phoenix
#

Yeah

wheat mesa
#

aka unlimited performance waste on making copies 😈

earnest phoenix
#

🥶

#

@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

wheat mesa
#

That's what I'm using rn

#

lol

earnest phoenix
#

Ah

wheat mesa
#

so close to working dude

earnest phoenix
wheat mesa
#

Making a physics sim

earnest phoenix
#

Oh alright, good luck with that

wheat mesa
#

it works

#

fuck yeah

#

wish I could record longer than 7 seconds

#

but too lazy to download obs

radiant kraken
wheat mesa
#

I do

#

It doesn't like it

#

lvalue rvalue dogshit something like that

radiant kraken
#

whenever you are overloading C++ operators, the input and return type must match

radiant kraken
wheat mesa
#

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

radiant kraken
#

can you show me the constructors

wheat mesa
#

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

earnest phoenix
#

Get off it null

radiant kraken
#

...

wheat mesa
#

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)

pale vessel
#

plugins are broken atm so I could open blocked messages and I hate it so much pain

radiant kraken
#

then don't open them

pale vessel
#

hard

lean wedge
#

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?

manic crane
#

TypeError: player.search.has is not a function

sick agate
#

its not an funcition

radiant kraken
#

then mmLol

manic crane
opaque marten
uneven heath
#

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

quartz kindle
uneven heath
#

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

quartz kindle
#

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:

#
  1. 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
#
  1. 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
#
  1. 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
raw nest
#

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. ThinkO_O

quartz kindle
#

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

quartz kindle
#

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

raw nest
# quartz kindle check this out https://web-frameworks-benchmark.netlify.app/result?l=javascript

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

quartz kindle
#

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

raw nest
#

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

quartz kindle
#

for example you can check the headers before deciding if you accept or reject the request and avoiding unnecessary data processing

raw nest
raw nest
astral path
#

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.

sudden geyser
#

Have the user authenticate with Discord and have a backend that can handle requests from users?

lean wedge
#

How do i check my bot's permissions in a guild?

sudden geyser
#

What library?

lean wedge
#

d.js

#

i have looked in the docs but im too stupid to find anything good mmLol

sudden geyser
#

You can use <Guild>.members.me to get your bot's guild member instance

#

Then access some property like .permissions/.permissionsIn(...)

lean wedge
#

Thanks ill try it

neon ingot
#

is this where i report a problem

quartz kindle
neon ingot
#

my bots

quartz kindle
#

i mean, this is a place where you can get help with your coding

neon ingot
#

oh

#

i think its like a coding problem but im not sure

quartz kindle
#

is it a bot you made?

neon ingot
#

idk how to make a bot

quartz kindle
#

well this is the place to help people who own their own bots

neon ingot
#

oh

quartz kindle
#

are you using someone elses bot?

neon ingot
#

yes

quartz kindle
#

then you have to contact the owner of the bot

neon ingot
#

oh

frigid canyon
#

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

quartz kindle
wheat mesa
#

inb4 "autocode"

neon leaf
#

Is this how I properly prevent sql injections?

frigid canyon
quartz kindle
#

discord.js?

frigid canyon
#

yes

quartz kindle
#

client.guilds.cache.size

frigid canyon
#

thanks

quartz kindle
neon leaf
#

do I need quotes around the question marks to allow for spaces?

quartz kindle
#

no

neon leaf
#

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 ?%

eternal osprey
#

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 >>

boreal iron
quartz kindle
#

the actual type of an an enum is an int

eternal osprey
#

yup i know

quartz kindle
#

so you have to type the month number in cin

#

not the month name

boreal iron
#

finally, my PC is running again after swapping the psu, so... guess we're good to go soon, Tim

eternal osprey
#

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
quartz kindle
#

use a switch with cin

eternal osprey
#

uhh okay let me try

boreal iron
#

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

quartz kindle
#

thats why i recommend 1000w psus

boreal iron
#

I mean... it was 7yo so good job I would say

quartz kindle
#

xD

boreal iron
#

tf

#

it was 850W and much more than I need

eternal osprey
boreal iron
#

but older PSUs can't handle the power peaks newer hardware, especially graphic cards reach

quartz kindle
eternal osprey
#

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

boreal iron
#

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

quartz kindle
quartz kindle
boreal iron
#

Stalin, good boy

#

praise the communisn!

quartz kindle
#

do you putin or do you putout?

boreal iron
neon leaf
#

what exactly does this mean?

sudden geyser
#

did you pass nothing

boreal iron
#

well your parameter is undefined

neon leaf
#

I did pass something

boreal iron
#

the var is undefined then

#

(or it's value)

neon leaf
#

ig, it only happens after one successful usage

boreal iron
#

why actually username LIKE ?

neon leaf
#
  • copied code *
boreal iron
#

you wanna get multiple user names as result?

neon leaf
#

no

boreal iron
#

or need to do non-case-sensitive checks?

#

if not use ...username = ?

neon leaf
#

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

boreal iron
#

that fairly depends on if you host the database locally or externally

neon leaf
#

locally, kinda

boreal iron
#

well locally is pretty much 0 latency

neon leaf
#

with a ping I get 0.2ms to the other server, so kinda local

lament rock
#

as long as its in the same datacenter, there should be no issues

boreal iron
#

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

lyric mountain
sudden geyser
#

The actual unicode

lyric mountain
#

emojis are actual characters

#

like A or 5

boreal iron
#

ah i thought it would parse the name for me to an unicode char

sudden geyser
#

\🇻🇳

lyric mountain
#

discord just uses placeholders so people dont need to bring unicode keyboard

#

they don't have a name at all

rigid maple
lyric mountain
#

lmao forget abt it

rigid maple
#

like this

lyric mountain
#

if there's someone in this server that could do it that one is Sayuri

#

that's uber level of difficulty

rigid maple
#

😕

lyric mountain
#

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

sudden geyser
#

I can only imagine the site/page being unmaintained

rigid maple
#

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

lyric mountain
#

I mean, u can

#

press F12

#

all non-SSR web pages are technically open-source

#

and ssr pages aren't as interactive

rigid maple
#

I was just wondering how it was done I don't plan to do such a thing.

lyric mountain
#

probably with webassembly

#

or perhaps, java applet

#

since it took some time to load the page

quaint rampart
#

how do i add a buffer image to an embed thumbnail

#

?

#

v13

#

djs

deft rock
#

@solemn latch

quaint rampart
#

msged aurel

deft rock
#

?

quaint rampart
#

ab dis

deft rock
#

ok

#

people are dumber then what I thought lol

#

I have a pic if he deleted it lol

quaint rampart
#

lmfao

earnest phoenix
deft rock
#

thank you

lyric mountain
knotty quartz
#

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.

knotty quartz
#
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

lyric mountain
#

"how easy" is kinda hard to answer

#

it all depends on how you structured your commands

knotty quartz
lyric mountain
#

in the ideal scenario you'd just need to hit "replace in files" and you're done

knotty quartz
#

ooo

knotty quartz
#

Has subcommands changed because I tried it and it said no repeating names but when I removed the subcommands it worked fine ;/

boreal iron
#

huh... how's possible this.requests is undefined?

sharp geyser
#

cause your bad

boreal iron
boreal iron
knotty quartz
boreal iron
#

that means you have a (sub)command with that name already

knotty quartz
#

But I don't? I'm confused rn

boreal iron
#

then fetch the commands and see

knotty quartz
#

Im probs gonna rewrite subcommands manually, but the rest seem to work with v14 like there was no changes

knotty quartz
boreal iron
#

or explain your command structure, please

#

like so

knotty quartz
boreal iron
#
command
  -> sub command
  ...
command2
knotty quartz
boreal iron
#

that's how you should explain it to me, your structure since i cant see it

boreal iron
sharp geyser
#

idk

boreal iron
#

IK

knotty quartz
#
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 🙂

sharp geyser
#

I have run into this issue before though

spark flint
#
const fs = require('fs');

for (file of fs.readdirSync("./methods").filter(f => f.endsWith(".js"))) {
    module.exports[file.split('.')[0]] = require(`./methods/${file}`);
}```🗿
knotty quartz
#

I had to remove the .addsubcommands bit so it would send

sharp geyser
boreal iron
#

use absolute paths

sharp geyser
#

^

boreal iron
#

__dirname/methods

#

errr yeah

#

in the right form of course

sharp geyser
#

Hey fake you should solve your issue next

spark flint
#

h

boreal iron
#

i dont see what im doing wrong

#

i must be blind as fuck

sharp geyser
#

Show full code

boreal iron
#

except you wanna see the class name

spark flint
#

alr that worked ty

knotty quartz
#

an deploy error

boreal iron
#

which one exactly?

#

english on point today

knotty quartz
lyric mountain
#

u cant have 2 commands with the same tree

boreal iron
#

means that there must be another command with the name echo

sharp geyser
#

How are yoyu using loadRequests @boreal iron

sharp geyser
#

Like in the initServer method is that the only place you use it?

boreal iron
#

of course, yeah

#

just once

sharp geyser
#

Weird

#

If its in the class it should always have access to this and its props

boreal iron
#

I mean we're speaking about js basics and I'm being dumb right now and dont get it

sharp geyser
boreal iron
#

must be something obvious like a typo

sharp geyser
#

but I don't see how his answer applies here

sharp geyser
boreal iron
#

what in the world...

sharp geyser
#

?

boreal iron
#

could it be it isn't available since handleRequest() is used as callback function of createServer()?

#

killing this as class scope in it?

sharp geyser
#

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

boreal iron
#

yeah I see, I logged this

sharp geyser
#

So I was looking in the wrong place entirely

boreal iron
#

it's really because it's been used as callback

sharp geyser
#

Yea any time you do that you wanna just bind this to it so it keeps it's class props

boreal iron
#

that confuses me a little bit

sharp geyser
#

How so

boreal iron
#

how to bind it within my context

sharp geyser
#

this.handleRequest.bind(this)

boreal iron
#

actually before using it as callback or after?

sharp geyser
#

http.createServer(this.#handleRequests.bind(this)).whatever

boreal iron
#

ah

#

wonderful

#

misty, good boy

#

sometimes

sharp geyser
#

So it worked?

boreal iron
#

yeah

sharp geyser
#

Good cause I was talking out my ass

#

had no idea if it'd work

boreal iron
#

should have thought about that earlier since it's been used as callback function

#

me dumbass didn't log this to see the issue

sharp geyser
#

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

boreal iron
#

in this context, yes

#

or case

sharp geyser
#

This is why people use arrow functions when they wanna preserve the original scope

boreal iron
#

yeah... it's just not really what I want here

#

but yeah at least we could figure out the issue

sharp geyser
#

welcome to the fuckery that is js

#

:)

boreal iron
#

yeah, true

#

soon me rewriting anything to php again

#

since js sucks

sharp geyser
#

oh god

boreal iron
#

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

pearl mantle
#

.

sharp geyser
#

I have no fucking clue what you are making bbut go for it

deft rock
#

anyone know how I can upload something (my command handler) to NPM? Fixed

#

Ping or DM me thanks in advance

deft rock
#

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

lyric mountain
#

not another npm, another release

deft rock
#

thank you

near ether
#

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

boreal iron
#

unfortuanlly not

sharp geyser
#

no

near ether
#

damn

boreal iron
#

but

sharp geyser
#

They do it by default

boreal iron
#

what you can do is

near ether
#

i have this rn lol

boreal iron
#

deferring the reply, then deleting the initial response

near ether
#

oooo

sharp geyser
#

Why do you even wanna do this

#

I see no benefit

boreal iron
#

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

near ether
boreal iron
#

until you delete it

near ether
#

haha theres no practical reason for it, its a cmd that only i can use to just mess around with friends

sharp geyser
#

🤔

uneven heath
boreal iron
#

you should think about just sending an ephermal message telling the client, the action has been successful

boreal iron
#

but lemme test the deferring trick real quick

#

wanna see if you can delete the deferring state

near ether
#

🫡

#

i tried the deferreply method and for a very brief second you can see "bot is thinking" as a third person

boreal iron
#

yes works perfectly

#
await interaction.deferReply();
await interaction.deleteReply();
near ether
#

perfect

#

its unnoticeable

boreal iron
#

but... yeah responding with an ephermal message still makes more sense

near ether
#

yea i like the latter method bc diff user cant see the messages quickly appear/disappear

#

but thank you!

boreal iron
#

np

opaque marten
#

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

boreal iron
#

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

lyric mountain
boreal iron
#

yeah what I already expected

#

but avoids the the thinking thingy

#

just that is what's technically impossible

lyric mountain
#

what IS possible, is acking, editing then deleting the message

#

tho at the cost of 3 requests

boreal iron
#

no

#

see above

#

ack (deferring) and deleting this (initial) response is just 2 requests

#

and the "bot is thinking" will not blob up

lyric mountain
#

ah yes

boreal iron
#

at least just for a millisecond maybe

sterile lantern
#

since we (users) can have different pfps in different servers, does that mean bots can too spinthink

#

since they can use animated emojis

#

assuming its possible that bots can do the same too ?

boreal iron
#

Afaik they can not do any of that

sterile lantern
#

o rip

#

would be pretty dope tho

#

and if they could have user banners

solemn latch
#

I'm sure they will eventually

boreal iron
#

bot nitro subscription soon

#

Imagine having a well coded and working bot…
Fuck this!!1!
Buy bot-nitro and add a fancy banner

wheat mesa
#

@solemn latch hi

lament rock
#

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

hasty mulch
#
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

wheat mesa
#

Use an fstring

hasty mulch
#

Like:

print(f'Command r!{ctx.command} used in a channel outside airport')```?
wheat mesa
#

Yes

hasty mulch
#

K

lament rock
#

I love websockets!!!

opaque marten
# boreal iron just that is what's technically impossible

@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.

#

As i said, they are probably just using this as a shortcut to the trick you showed

#

i haven't looked at the code

lament rock
#

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

opaque marten
#

Ye i'm not quite sure there

opaque marten
#

Correct me if i'm wrong, but isn't value 6 what this is doing?

lament rock
#

That is deferEdit

opaque marten
#

Yeah, because they cited it and said it doesn't exist and it literally stands there

neon leaf
#

why isnt it centered?

neon leaf
#

idk why its suddenly working but it is ig

winged linden
#

yoo question! any documentation that shows which intents are allowed for SERVER MEMBERS INTENT

boreal iron
#

So… this still isn’t possible for any other interaction type except component interactions

#

Unfortunately

knotty quartz
#
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

boreal iron
#

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>);

feral aspen
#

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?

boreal iron
#

In your case

feral aspen
#

Wait, really?

boreal iron
#

Yeah

feral aspen
#

What do you call such case?

#

Sub-domain stacking? Sub-domain nesting?

boreal iron
feral aspen
#

Wouldn't that be a suspicious link?

boreal iron
#

Its still just a subdomain

feral aspen
#

Oh, fair enough.

#

Also, what would it be called?

boreal iron
#

Third-level-subdomain

#

At least that’s how I know its been called

knotty quartz
feral aspen
boreal iron
#

This is what you can use to push to your client.application.commands.create(…); method

boreal iron
knotty quartz
#

Fixed it

#

I found it and I am safe to say v14 is weird

knotty quartz
#

Looks like a replica of V14 with just intro changed

boreal iron
#

The docs however show you the inbuilt methods and examples to use ‘em

boreal iron
#

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 freerealestate

feral aspen
#

Oh, waaat.

#

Alright, lastly... should I be using ts-node or tsc?

boreal iron
#

Idk… pigs will learn to fly before I will ever touch that ugly ts

knotty quartz
#

Is there a list of all the embed colour options?

feral aspen
#

You mean Embed()?

knotty quartz
#

E.G: Aqua (I know thats there) and random

feral aspen
knotty quartz
feral aspen
#
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.

knotty quartz
#

OMG TYSM

#

You are a savior

feral aspen
#

:)

knotty quartz
#

Now all i have to do after reworking embeds out, is begin database work 🙂

feral aspen
#

All the best.

opaque marten
boreal iron
#

Yeah probably defers the interaction as initial response and deletes it immediately

#

But I still dislike that for command interactions

stuck dawn
#

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

quartz kindle
stuck dawn
#

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

eternal osprey
#

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

boreal iron
#

Dont see you returning it or using a filter

eternal osprey
#

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

feral aspen
#

@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() {...}?

Content Delivery Network
#

@harsh nova

#

Don't forget his shoes on his way out.

boreal iron
eternal osprey
#
  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?
fluid basin
wheat mesa
#

^

cinder patio
#

OOP 🤮

wheat mesa
#

OOP C:

cinder patio
#

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

feral aspen
neon leaf
#

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

earnest phoenix
#

Captchas is what you want - you're probably misunderstanding the way they work

fluid basin
#

especially if you are mutating any of the non-static instance properties, then use a non-static method

fluid basin
neon leaf
fluid basin
#

yes, that is the intended usage

neon leaf
#

what captcha would I use to make it impossible to automate? google?

feral aspen
feral aspen
#

What?

fluid basin
#

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

feral aspen
#

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.

cinder patio
#

what do you think a static method is?

#

like what's your idea of it

fluid basin
neon leaf
#

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...

▶ Play video
feral aspen
fluid basin
cinder patio
#

A static method is attached to the class, regular methods are attached to instances of the class

fickle arch
#

how do I make the link clickable on embed ?

feral aspen
#

Ohh.

fluid basin
#

or use link markdown syntax

fluid basin
# fluid basin `main` is the only place where you truly need a static function. However, the ri...

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
  }
}
lament rock
#

@fluid basin damn thats a face I dont see often

swift niche
#

i'm prolly really dumb but how do i create a command that displays fields that contains the json objects per resource

lament rock
#

can you provide an example of what you'd like the bot to display?

swift niche
#

discord.py^

swift niche
#

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

lament rock
#

displaying all of them or just one at a time

crystal wigeon
#

hey um how do i get all slash commands by their name?

swift niche
#

so like a paginator?

crystal wigeon
#

and kinda delete it

lament rock
#

You can just PUT an empty array to your commands

crystal wigeon
#

that will remove all of the previously registered commands?

swift niche
#

would it be possible to display all by collection provided

lament rock
#

Yup

swift niche
#

so if a user wanted a collection for iron, they'd click iron and itd bring up the resources for that specific colection

crystal wigeon
#

are you responding to me lol

lament rock
swift niche
#

ah

crystal wigeon
#

thanks

lament rock
#

👍

swift niche
#

uh how'd i do that

lament rock
#

Look up how to filter a json in python

#

idk python

swift niche
#

ty

lyric mountain
#

Idk if I understood it right, but are you saving user data in json files?

lament rock
#

no

#

seems like game assets

swift niche
#

^

lyric mountain
#

Ah, nvm then

swift niche
#

saving user data in json files is uh

#

very bad idea

lyric mountain
#

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

neon leaf
#

how do I make a google captcha centered?

lyric mountain
#

Where the current values don't matter

lyric mountain
boreal iron
#

@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?

swift niche
lament rock
lyric mountain
#

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

lament rock
#

On the server.listen function, there's a callback where you can assign a value to a variable

boreal iron
#

ah

#

so i'm gonna listen to the event listening then

lament rock
#

uh no

#

or maybe? idk

#

oh yeah

#

listening event

quartz kindle
#

listen is async, so if youre checking for listening right after it will never be true

boreal iron
#

where does it actually says it's async in the docs?

#

am I blind?

lament rock
#

The behavior is async

#

http is mostly made on callbacks

boreal iron
#

yeah.. but hmm thought that would be written down somewhere explicitelly

#

for dumbasses

lament rock
#

You have to keep in mind that the http lib was made before Promises existed

boreal iron
#

well idk about that one but okay

quartz kindle
#

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.

boreal iron
#

tf where

#

oh nvm

#

lol

#

the blame is real

quartz kindle
#

huehuehue

feral aspen
neon leaf
#

what does { success: false, 'error-codes': [ 'bad-request' ] } mean for recaptcha?

#

nvm, I entered an acciental character in my request

fickle arch
#

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

boreal iron
# quartz kindle its right there lol

Why does node:querystring parse this as result?

curl -v https://... -H "Content-Type: application/x-www-form-urlencoded" -X POST -d "param1=value&param2=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&param2=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

quartz kindle
#

let body = ""

#

you didint initialize it as a string

boreal iron
#

ohhh... stupid me

#

this day is getting worse and worse

#

thanks anyways

deft rock
#

the "path" argument must be of type string or an instance of buffer or url. received undefined any idea or help? Ping or dm me FIXED

lyric mountain
#

show code

waxen saffron
#

test

lyric mountain
#

?

earnest phoenix
earnest phoenix
ancient nova
#

is there endpoint for banners yet ?

#

@lyric mountain ?

earnest phoenix
#

banners/user_id/user_banner.png

#

banners/guild_id/guild_banner.png

ancient nova
#

fr?

#

u don't need hashing anymore?

earnest phoenix
#

user_banner and guild_banner being the hash of course

ancient nova
#

oh

#

rip

lament rock
#

caching purposes

#

browsers are really eager to cache media elements

cursive musk
#
const commands = message.client.botCommands
      .array()
      .filter((c) => c.category.toLowerCase() === type);