#development

1 messages · Page 97 of 1

sharp geyser
#

I see

quartz kindle
#

a normal for is the fastest

sharp geyser
#

I always thought for of being faster

hushed robin
#

guys

#

could using setTimeout in a cron job mess with it

lyric mountain
#

Well, no, but why?

hushed robin
#

well

sharp geyser
#

Im wondering why you want to use setTImeout in a cron job

hushed robin
#

i have this issue i can't figure out

#

my cron jobs keep getting messed up

#

like they offsetting

#

it should do it x:05 but does it at x:06

#

etc

#

etc

lyric mountain
#

Cron is usually extremely precise

hushed robin
#

and goes more and more offset

quartz kindle
#

actually yes, forEach is much slower

wheat mesa
#

Perhaps your computer clock is off

hushed robin
#

at least node cron isn't duplicating my jobs like node schedule but this issue is very annoying

sharp geyser
hushed robin
wheat mesa
#

Me when empty loop bodies are undefined behavior:

wheat mesa
#

That’s gotta be a troll right

lyric mountain
hushed robin
#

no

#

it's on linux

#

idk how to do that

#

it's command line

wheat mesa
quartz kindle
#

something similar to for(const item of a) { (item => {})() }

lyric mountain
#

Ah

wheat mesa
hushed robin
#

no

#

it works fine at first

wheat mesa
#

Your local PC’s time probably isn’t as precise as the server’s time

hushed robin
#

then fucks up after a day or two

dry imp
#

do u get a msg from discord?

lyric mountain
#

What are u even doing inside the cron?

hushed robin
lyric mountain
#

And at what rate is it scheduled?

hushed robin
#

every 5 minutes

dry imp
quartz kindle
#

how do you create this cron job?

sharp geyser
#

tim rapid fast at fixing spelling mistakes

#

:^)

quartz kindle
#

do you use a cron library?

quartz kindle
hushed robin
hushed robin
#

node cron

quartz kindle
lyric mountain
#

Wasn't it 76+?

hushed robin
#

no

#

that number is exact

sharp geyser
quartz kindle
sharp geyser
#

sucks to suck /s

hushed robin
lyric mountain
#

Try adding it to one more server

sharp geyser
#

Also tim you have a bot in 10k servers?

wheat mesa
#

inb4 he gets hit with the artificial growth slap in the face

hushed robin
#

imma wait till another server adds it

quartz kindle
#

ah yes, create a server, add it, and get denied for unnatural growth :^)

sharp geyser
#

yet you wont finish your astrology api

quartz kindle
quartz kindle
#

:^)

sharp geyser
hushed robin
#

sooooooooooo

sharp geyser
#

At this point ima just look at the stars myself

lyric mountain
#

Astrology api? If tim adds a "what phase is the moon in" I'd use the hell out of it

quartz kindle
#

my 10k bot uses the old version of the astrology api

#

since it still works

#

i just let it be

#

lmao

hushed robin
#

is there a alternative to node cron

sharp geyser
#

I'd just have to go back to the jurassic era to not have any pollution in the sky to see the stars clear enough

lyric mountain
hushed robin
#

😵‍💫

sharp geyser
#

tim just has to stop trying to make everything giga performant and work on the api

lyric mountain
#

Show how u created ur cronjob

hushed robin
#

sure

#

there

#

ya go

sharp geyser
#

Honestly tim should just use chatgpt in his api

lyric mountain
sharp geyser
#

So what is updateTrackers

hushed robin
#

it

#

updates

#

the

sharp geyser
#

it could also be whatever is in that function

hushed robin
#

trackers

sharp geyser
#

No shit sherlock

hushed robin
#

lemme

lyric mountain
#

Show what ur doing inside it

sharp geyser
#

My god this guy is as dumb as a box of nails

hushed robin
#

ill send the file

wheat mesa
#

updateTrackers sounds like a very api-heavy task

#

You could be getting ratelimited to some extent if it uses a lot of api requests

hushed robin
#

well

#

kinda

hushed robin
#

nothing in my logs indicate that

sharp geyser
#

or it could be taking so long to complete that it doesn't until 1 minute later than its scheduled time trollface

lyric mountain
#

Heavy processing might hang cron yeah

hushed robin
#

thats the purpose of the setTimeout to prevent rate limiting

lyric mountain
#

That's why u use cron to call async tasks

#

Not process them directly

quartz kindle
hushed robin
#

theres like 80 trackers

#

four per second

#

takes like 20 seconds

#

lemme just send

#

the code

#

one moment

wheat mesa
#

Hence…why it gets slower every day…

lyric mountain
hushed robin
lyric mountain
#

Just kidding btw, the library is enough for what I use it for

hushed robin
#

it should just schedule at the same time, no?

#

how would it get delayed

lyric mountain
#

It's basically a quantity/rarity multiplier for cards and drops

quartz kindle
#

haha cool

sharp geyser
#

I wanted to make a tcg back in the day

#

then I gave up once canvas was too confusing and didn't wanna bother

hushed robin
#

can i send 60 lines of code here

sharp geyser
#

sure

hushed robin
#

ok

sharp geyser
#

in a pastebin

hushed robin
#

bruh

#

ok

sharp geyser
#

or some other kind of bin

hushed robin
#

one moment

lyric mountain
#

I need to optimize my renderer, it's taking 2 seconds per frame

#

Tbh, the delay is kinda good because it prevents spam

#

But it bothers me

#

Actually, 1s per frame

sharp geyser
#

If you want it to be super optimized just let tim handle it

lyric mountain
#

The other second is packing and sending to discord

sharp geyser
#

man will get it to render at .5s per frame

lyric mountain
#

Lmao

hushed robin
wheat mesa
#

My renderer works at 0.00007s per frame 🧌

quartz kindle
wheat mesa
lyric mountain
#

It's surprisingly not taking much cpu time, it's just slow

#

Plus it'd decrease by 10 fold if I could use jpeg instead of png

#

But oh well, transparency

quartz kindle
hushed robin
#

why not

quartz kindle
#

you're currently waiting 250ms then updating all trackers at once anyway

hushed robin
#

how

quartz kindle
#

setTimeout does not interrupt forEach

#

setTimeout only starts a timer, does not pause anything else

hushed robin
#

bruh

wheat mesa
#

setTimeout just runs a callback after a certain amount of time has elapsed

hushed robin
#

how would i

#

then

#

⁉️

quartz kindle
#

a forEach cannot be delayed

lyric mountain
#

There's the promise-based sleep

quartz kindle
#

use a for(...of) with async await

hushed robin
#

😵‍💫

wheat mesa
lyric mountain
#

What'd happen?

wheat mesa
#

Not entirely sure, I just know you’re not meant to make async callbacks to iterative functions like that for some reason

quartz kindle
#

forEach encapsulates everything into a callback function

#

so if you have 100 items, you execute 100 functions

#

so even if you use async await, it will only affect the inside of the function scope

lyric mountain
#

Ah

hushed robin
#

is this right for await (const tracker of trackers)

wheat mesa
#

uh no

hushed robin
#

bruh

lyric mountain
#

Btw, u don't need to declare a variable for each tracker value

hushed robin
#

yeah i know

#

should i not

quartz kindle
#
for(const tracker of trackers) {
  // do something
  await new Promise(r => setTimeout(r, 250))
}
lyric mountain
#

And if (something === undefined) can be translated to if (!something) in your case

quartz kindle
#

there are also async timers in nodejs, which are already promisified for you

lyric mountain
#

Since ur just checking if the value exists

#

Oh wait, oh wait

#

How...how didn't I notice this?

hushed robin
#

notice what

lyric mountain
#

Why are u declaring a function inside a forEach?

hushed robin
#

is that bad

quartz kindle
#

nah, just a tiny waste of resources

hushed robin
#

how many

quartz kindle
#

microseconds

hushed robin
#

ram?

#

memory?

quartz kindle
#

0

hushed robin
#

oh

#

ok

quartz kindle
lyric mountain
#

The code isn't the worst I saw around here, but most of it is redundant

wheat mesa
#

Bae flashbacks

quartz kindle
#

xD

lyric mountain
#

There's also the uncanny amount of comments

#

Did u copy that from someone?

hushed robin
#

what's wrong with comments

#

no

#

i just like to comment

wheat mesa
#

If they’re redundant then they’re useless

hushed robin
#

all my code has comments

lyric mountain
#

There's nothing wrong with it, it's just odd

wheat mesa
#

Every beginner goes through that phase

#

You’ll learn to become lazy dw

lyric mountain
#

Wonder how long your resolve will go

wheat mesa
#

Your code will soon be between you and your religious (or lack thereof) figure of choice

lyric mountain
#

I gave up even on git commits long time ago

hushed robin
#

🤨

quartz kindle
#

most of my code has 0 comments lel

hushed robin
#

i will remove the comments

quartz kindle
#

except jsdoc comments which im using quite a lot lately

lyric mountain
#

No no, keep them

wheat mesa
#

I comment something if I know I made the design for a reason

wheat mesa
#

Just saying at some point we all get lazy lol

#

And/or write more understandable code from just looking at it

quartz kindle
#

or more unreadable

#

:^)

lyric mountain
#

Wonder if the "commiter" job exists

#

Like, someone who's sole purpose is to write commits

quartz kindle
#

does he have to read someone else's code to understand what it does ?

lyric mountain
#

I guess, but that could be solved with pair programming

quartz kindle
#

one codes, the other writes notes?

lyric mountain
#

Yep

quartz kindle
#

i've never actually had a job, so i have no idea how coding in teams looks like lol

#

and i have no idea what all those concepts like agile mean

lyric mountain
#

In my workplace we just use github

#

Like, each programmer has its own module, whenever we go outside our modules we need to grab the latest file version with the other module's programmer

#

Usually ignoring git entirely cuz they didn't finish their part yet

quartz kindle
#

xD

lyric mountain
#

Surprisingly works, we rarely need to steer away from our modules

#

That said, I'm in a separate project, having to deal with an api made in delphi and an app made in react

#

Oh well

quartz kindle
#

jesus

lyric mountain
#

It'd not be half as bad if the former maintainer knew what "reusability" meant

#

All fucking screens are inside two-file folders, and every file is named index.js

#

Working with programming is nowhere as enjoyable as programming as hobby, but it has its perks

#

Namely money

earnest phoenix
#

This is pretty much how we work on Node.js, and other projects within the OpenJS Foundation, it's pretty fun and much simpler to go off of

#

Here's a better one

hushed robin
#

so i assume you can actually only verify your bot at 76 guilds, right?

earnest phoenix
#

Discord will only send you the verification system message when your bot surpasses the 75 guild count, so it's sent at 76 guilds

hushed robin
#

so, yes?

earnest phoenix
#

Yes moyai_gold

hushed robin
#

bruh

#

stinky

#

😵‍💫

#

!variable.length is the same as variable.length === 0 right

earnest phoenix
#

Not exactly, the logical NOT operator (!) checks for all falsy values, which are false, null, undefined, 0, and ''

#

Basically it looks for more than just 0, it's better to just directly compare to the value you expect instead of shortening them

hushed robin
#

i see, thanks

#

also, if anyone knows, with better sqlite if I were to do database.prepare(`SELECT * FROM table WHERE id = '...';`).get(); and there were no results, is it suppose to return undefined.

earnest phoenix
#

The documentation should tell you that

hushed robin
#

true

earnest phoenix
hushed robin
#

If the statement was successful but found no data, undefined is returned. If execution of the statement fails, an Error is thrown.

#

found the answer 😵‍💫 z

lyric mountain
#

Just a tip, always use explicit columns instead of *

#

Unless u absolutely need all columns

#

For sqlite it might not matter much since it's fast, but it's a good habit to have

hushed robin
lyric mountain
#

Without the parentheses

hushed robin
#

where

lyric mountain
#

Run it and the error will tell you where

hushed robin
#

id = '...';?

#

don't u need to have them if it's a string

#

oh parentheses

#

i'm stupid ☠️

#

i see

#

why though

neon leaf
#

how can I add a property to process with typescript?

#

I mean intellisense, not literally a property

quartz kindle
#

you'd have to cast it

tulip ledge
#

Dont think there are any libraries as they require a virtual driver maybe try a virtual usb device

#

No idea

#

Seems really outdated tho

torpid helm
#

hi guys

#

who can help me?

wheat mesa
#

If you ask a question someone might be able to help

torpid helm
#

i was writing

#

today after 14 the slash command of my bot no longer work

#

I tried hard to fixare, as long as trying it on my pc I got these errors

#

my bot never had problems like this

#

I also tried to put back an old backup and update configs but it gives me the same thing

deft wolf
#

That should help

torpid helm
#

thanks

deft wolf
#

You're welcome

torpid helm
deft wolf
#

But this has nothing to do with the previous error

#

The previous one was related to the database and here is just a bad webhook token

quartz kindle
# torpid helm

this essentially means mongoose is not connected properly

#

i have no idea why mongoose even lets you run stuff without being connected, but for some reason it does

torpid helm
quartz kindle
# torpid helm

this one means your webhook token is invalid, as it says in the error

torpid helm
#

wtf

#

now it works

#

i didn't make anything

quartz kindle
#

it still says invalid webhook token tho

deft wolf
#

What is this webhook?

torpid helm
quartz kindle
#

👍

torpid helm
quartz kindle
# torpid helm

this one is coming from your interactionCreate.js line 18

torpid helm
#

yes

deft wolf
#

Is it possible that this is related to not responding to the interaction within 3 seconds?

deft wolf
#

Because after 3 seconds the token is deleted, that would explain why it is inavlid

torpid helm
#

now i will check with my devs team

deft wolf
#

Are you using interaction.deferReply() anywhere?

#

Mainly where you use the database

quartz kindle
deft wolf
#

Could you show the code of the command that could cause such an error?

stiff dust
#

anyone know any good and free ChatBot API ? 👀

deft wolf
#

Most people seem to use this from openai

#

But I've never used it myself

stiff dust
deft wolf
#

Quality = price I guess although I've never understood this interest in AI

#

You can have paid but good or free but not so good

#

This rule probably applies to most things

stiff dust
lyric mountain
viral badge
#

there are plenty of free AIs out there but you are likely to need to train them yourself in many cases

lyric mountain
#

yeah

#

chatbots are very resource intensive, nobody will give u a free pre-trained bot with unlimited calls

scenic kelp
#

except training your own AI will take thousands of GPU hours which will in turn cost you thousands of dollars

#

is running a GPU for 10 thousand hours really free

#

if you assume the GPU uses 400 W = 0.400 kW • 10 000 h = 4 000 kWh • 0.10 ¢/kWh = $400

#

and chances are you're using your 200 W gaming GPU

eternal osprey
#

oowhhhh now i understand

lyric mountain
#

that was late

eternal osprey
#

so for example this.size will give me the size of the current object i used the method on, but super(size) will give me the size of the superclass object?

eternal osprey
lyric mountain
#

super(...) is calling the superclass constructor

eternal osprey
#

what's a constructor?

lyric mountain
#

the same way that this(...) will call the current class' constructor

#
public TheClass() {
  ...
}
eternal osprey
#

but why would we want to call the constructor?

#

like, what would we be able to do

lyric mountain
#

the constructor is the method called when u do new TheClass()

#

so anything inside the constructor is called on instantiation time

#

meaning u can assign final constants or do some setup

eternal osprey
#

like super.size would give us the size of the superclass object right

lyric mountain
#

no, u said super(size)

#

not super.size

eternal osprey
#

owh

#

how come that they have () and lots of variables inside it?

eternal osprey
#

is that like the way to use super when handling with multiple variables?

lyric mountain
#

the same way u can do new TheClass("steve", 12, true)

#

when you extend a class you need to call its constructor if it doesn't have a zero-arg constructor

#
public class ClassA {
  public ClassA(String name) {

  }
}

public class ClassB extends ClassA {
  public ClassB() {
    super("default"); // <-- required because parent class has no zero-arg constructor
  }
}
#

this isn't a java thing btw, all languages that support inheritance also require calling superclass constructor

#

it's just that whatever-typed languages like js simply default the arguments to undefined

eternal osprey
#

owh i see so for example this constructor:

#

if we now create a new object of type parent and we for example use new Parent(1) it will system.out?

#

and this will basically create a new object of type Super, with the given variables?

#

then the class belonging to super prob also has a custom constructor that already sets the data of the object? Like:

Bike(frameMaterial, size, color, speed){
this.framematerial = ...
...
}```
lyric mountain
#

no, you're never creating any super

#

you're just deferring the call to super constructor

eternal osprey
#

but a constructor is the same as the classes' new class() right?

lyric mountain
#

no

#

new TheClass() CALLS the constructor

#

because it's constructing an object

#

imagine it as an object initializer

#

an automatically called method basically

#

no object can ever be created without going first through the constructor

eternal osprey
#

ah i see okay, thank you!

#

I will read more about it online because i still don't get the super() tbh, like the this. and super. were clear but those fucking () are hard to understand tbh

lyric mountain
#

sigh

#

you're confusing it because you're thinking it's any different to a function

#
void doStuffA(String name) {
  ...
}

void doStuffB() {
  doStuffA("default");
}

doStuffB(); // automatically calls doStuffA("default")
#

@eternal osprey

#

this is LITERALLY what it's doing

eternal osprey
#

So if we call doStuffB() it will in fact perform the method of doStuffA?

lyric mountain
#

yes

#

same thing for extended constructors

eternal osprey
#

for example:

public void method1(int size, int weight){
super(size,weight);
will actually perform the function of super?
}

#

oowhh wait is it a thing to seperate methods from a superclass and subclass?

#

Imagine i have 2 classes with the same method name: setSize()

lyric mountain
#
public class ClassA {
  public ClassA(String name) {
    System.out.println(name);
  }
}

public class ClassB extends ClassA {
  public ClassB() {
    super("default"); // <-- required because parent class has no zero-arg constructor
  }
}
#

new ClassB()

#

will print "default"

#

even tho ClassB doesn't print it, its parent does

eternal osprey
#

hold on, so basically super() allows us to actually perform a method of the superclass, while invoking our own method?

#

i think i get it now!
]

#

and with the super keyword we can actually perform methods on a superclasse's object!

earnest phoenix
#

The super keyword is literally just a pointer to the extended class, calling super() will call the extended class' constructor, meanwhile super.foo() will call the extended class' foo() method

eternal osprey
#

yeah, the thing is... i don't know what a constructor is, or does when we use super()

#

like do we create a new superclass object or..?

earnest phoenix
#

A constructor is the function that initializes a value, for example:

public class Foo {
  public Foo(String bar) { // the constructor 
    System.out.println(bar);
  }
}

You see a class named Foo, but it has a method named the exact same as the class, that's the constructor, which is what sets up the class when you do new Foo()

#

Though it differs on how constructors are declared in other programming languages, that example I showed is Java, but here's the same thing in JavaScript:

class Foo {
  constructor(bar) { // the constructor, obviously 
    console.log(bar);
  }
}
eternal osprey
#

owhhhhh

earnest phoenix
#

When you call super(), it calls the extended class' constructor, which is required to initialize the class you've made as well

eternal osprey
#

so imagine we have
2 classes, one subclass, other one is superclass.|

class superclass{
public superclass(int size, int weigt){
this.size = size;
this.weight = weight;
}
}
class subclass extends superclass{
int type;
public subclass(int size, int weight, int idk){
super(size, weight);
this.type = 1;
}
}```
earnest phoenix
#

Use a codeblock

eternal osprey
#

am i correct?

earnest phoenix
#

You can't even use the super keyword in subclass because it doesn't extend a class

eternal osprey
#

owh yeah i know

#

forgot that

#

but would the idea/reasoning of my explanation be correct?

earnest phoenix
#

The extended class (superclass) is initialized before your class (subclass), but the explanation is correct

eternal osprey
#

owhhh damnnn thanks for your help!

#

i finally understand this shit

earnest phoenix
#

The extended class won't be initialized until you call super()

eternal osprey
earnest phoenix
#

Wherever you need to initialize the extended class, putting it right at the first is absolutely fine

#

But you can of course do stuff before initializing the extended class, for example:

public class Foo extends Bar {
  public Foo(String bar) {
    // Do stuff before initializing the extended class 
    String something = getStringFromSomeFunction() + bar;

    super(something); // Initialize the extended class (`Bar`) by calling it's constructor and passing a String to it (`something`)

    // Do other stuff after initializing the extended class 
  }
}
eternal osprey
#

ahh i see, so the extended class will be created first, and then the subclass will follow? Makes sense!

#

tho, the super() is clear now, but the this() would that be the opposite?

#

so in a superclass if the constructor is called, we can use this() to also call the constructor of the subclass?

lyric mountain
#

In java you're obligated to have super in the first line of the constructor

#

It'll refuse to compile otherwise

lyric mountain
#
public AClass() {
    this("default");
}

public AClass(String name) {
    this.name = name;
} 
#

It's mostly used when you want to have more than one constructor

#

Same works for methods (having many of the same method but with different arguments)

#
void doStuff(String a, int b, boolean c) {
    ...
} 

void doStuff(String a, int b) {
    doStuff(a, b, false);
} 

void doStuff(String a) {
    doStuff(a, 0);
} 
eternal osprey
earnest phoenix
lyric mountain
#

Not really, it guarantees you respect the hierarchy

#

Many weird bugs could happen otherwise

earnest phoenix
#

That's not the compiler's job, it's not up to the compiler to decide what should be done before extended class initialization

#

Pretty much no other compiler fails like this

lyric mountain
#

Java usually doesn't allow you to do unsafe operations or things that'd break inheritance

eternal osprey
earnest phoenix
#

Weird Java semantic, there's usually a very good use for operations before extended class initialization, but eh ¯_(ツ)_/¯

lyric mountain
#

Like a chain

eternal osprey
#

ahaaa

#

i see

sharp geyser
#

is this more java stuff

#

what a bunch of nerds

lyric mountain
#

The object will only be created when the constructor finishes

earnest phoenix
#

I very well know that, doesn't change my point

#

I've seen people do a lot of stuff before passing things to the super() call

lyric mountain
#

That's why sometimes you see static constructors in java

#
static TheClass of(BasicParams a) {
    // do some processing to get ComplexParams
    return new TheClass(params);
} 

TheClass(ComplexParams p) {
    super(p);
} 
#

Then u do var abc = TheClass.of(...)

earnest phoenix
#

Yeah seen that pattern before, though extra steps, but Java so be extra worried about inheritance considering pretty much everything is a class WiseTree

lyric mountain
#

Gotta respect the elderly (superclasses) mmLol

earnest phoenix
#

Modern JavaScript users seeing var in other programming languages: 😱

lyric mountain
#

I wonder if one day they'll finally put var to rest

#

Damn browsers not staying up to date smh my head

flat copper
#

so i have a message with button,
i want the first one to click get the loot

i have an interaction create event
what i tried:
when clicked remove button

but it dont work like if 2 or more users click it at same time

earnest phoenix
#

We most likely won't ever remove var considering the tons of programs using it

flat copper
#

any solution?

lyric mountain
#

Why doesn't it work if 2 press?

earnest phoenix
#

Same case as the non-strict equality/inequality operators (==/!=)

lyric mountain
#

Any error?

flat copper
#

nope

lyric mountain
#

The why doesn't it work?

flat copper
#

it gives loot to both

deft wolf
#

Just filter

lyric mountain
#

So it ain't just removing the buttons

#

That's important detail

flat copper
#

the buttons are removed

#

being

lyric mountain
#

Yes, but the important part is that it's doing something else

#

The prevent both from collecting it you need something to lock it on first click

#

Like a mutex

#

Are u storing the drop somewhere?

#

Like, before collecting

earnest phoenix
#

Better to show the code instead

flat copper
#

code ^

lyric mountain
#

Don't store which loots were claimed

#

Store which loots are up to claim

#

Them right after someone claims it remove from the list

#

Tho it'll not work if two people click the exact same time

flat copper
#

oh

lyric mountain
#

For that you'd need to synchronize the block, which idk if it's possible in js

flat copper
#

oh i see thank you

wheat mesa
#

Why did you delete the codeblock I was reading 😠

#

(Also just don’t do that, it could potentially help someone else in the future with a similar problem even if you don’t realize it)

earnest phoenix
#

Love to see people delete their questions

#

Still don't understand the purpose of doing that but yeah

#

Seen it quite a lot CatJAM

lyric mountain
#

Does js support atomic operations btw?

wheat mesa
#

I don’t see why it would given it’s a single threaded language

quartz kindle
#

but they only really have one use case

#

sharedArrayBuffers

#

atomic i/o is OS-dependent mostly, but node does expose low level fs operations via fs.open

lyric mountain
#

that's probably overkill for OP's context

#

but good to know it does allow

eternal osprey
#

hey i am back... i had a quick question about overloading, hiding and overriding?
overriding is simply, we have the same method name, parameters but a different body right?

superclass:
public void name(int a){
this.size = a;
}
subclass:
@override
public void name(int a){
System.out.println("heey " + a);
}

overloading is that we have the same name, but a different body and parameters right?

public void name(int a){
this.size = a
}

public void name(int a, int b){
this.size = a;
this.size = b;
}```
wheat mesa
#

Yes

eternal osprey
#

yeye gottem thanks!

quartz kindle
#

overload doesnt mean different bodies

#

it means different signatures

#

meaning the function accepts different sets of parameters and may return different values

#

but the body of the function is just one

wheat mesa
#

Yeah

#

The body doesn’t matter, just the signature of the function itself

#

The compiler just needs a way to differentiate between two functions of the same name

hushed robin
#

🤨 why is trackerName returning as null

wheat mesa
#

What’s that linebreak in your code between the else statement and the console.log

hushed robin
#

nothing

#

weird thing is

#

it seems to be working locally but

quartz kindle
#

that doesnt look like nothing

hushed robin
#

not on my server

wheat mesa
quartz kindle
#

it looks like you're covering something up

wheat mesa
#

Seems like the only reasonable explanation as to why it’s null

quartz kindle
#

what are you so afraid of, you conspiracy theorist

hushed robin
#

what?

#

☠️

wheat mesa
#

Also I highly suggest using the curly brackets in else blocks the same way you do with if blocks, since it’s much easier to read

lyric mountain
#

I used to use bracket-less if clauses a lot before, until I had to solve a bug that caused by me not realising it didn't have a body

#

now I put brackets even in one-liners

quartz kindle
#

same

hushed robin
#

sooooooooooooooo

#

whats the issue with it

wheat mesa
#

You didn’t show us the line you blanked out

hushed robin
#

???

#

theres no blacked out line

#

thats just what my visual studio code does when on a line

#

it makes it dark

wheat mesa
#

That looks very weird

#

Looked like it was edited

#

Try putting your else statement in a block

hushed robin
hushed robin
wheat mesa
#

That’s very dark compared to mine, that’s why I was confused

wheat mesa
#

Even though I suspect there’s nothing wrong with it

hushed robin
#

well i'll try that i guess

hushed robin
wheat mesa
#

Yes

hushed robin
#

ok

quartz kindle
hushed robin
#

sure one sec

#

(null)

quartz kindle
#

thats what i thought

#

its a string

#

so !== null wont work

hushed robin
#

i see

#

let me test that out

quartz kindle
#

it would possibly be a better idea to test for the existance of {data}, depending on what exactly is your goal

hushed robin
#

so

#

i should check if it includes {data}?

quartz kindle
#

yeah

hushed robin
#

alright

#

woahhhh part 1 of my issue is fixed

#

now, what would cause a for of loop to end?
from what i can see, it's stopping after looping over only 4 items.

wheat mesa
#

An unhandled error within the loop body or a break statement

#

(Or reaching the end of your loop obviously)

hushed robin
#

er

#

there's no errors

wheat mesa
#

Then your collection you’re looping over only has 4 items

hushed robin
#

no

wheat mesa
#

Would also help if you provided a little code

hushed robin
#

this is .length on the array

hushed robin
wheat mesa
#

The code related to your problem?

hushed robin
#

😵‍💫

#

getting the array from the db

const trackers = database.prepare('SELECT * FROM trackers').all();```
looping over it
```js
for (const tracker of trackers) {
  ...
};```
wheat mesa
#

What are you doing inside of the loop

hushed robin
#

well

lean ridge
#

h

wheat mesa
#

Also, log the trackers variable

hushed robin
#

why

wheat mesa
#

Because it’s relevant to your issue…

lean ridge
#

how do i make a bot

hushed robin
#

well, ok 🫡

wheat mesa
# lean ridge how do i make a bot

In simplified form,
Learn a programming language of your choice
Pick a discord bot library of your choice for said language after you’ve learned most of the fundamentals
Follow the examples for that library and try to make your own stuff until you get the hang of it

hushed robin
#

question

#

would doing return in a for of loop end it?

wheat mesa
#

Yes

lean ridge
#

well i made i made it but how do i get it aproved

hushed robin
#

well

#

that's my issue i guess

hushed robin
#

submit

#

they review

#

you approved

#

🎉

wheat mesa
hushed robin
#

so, your saying return will end the entire loop, correct?

wheat mesa
#

Yes

hushed robin
#

ok

wheat mesa
#

It will end the method in fact

hushed robin
#

i'll look into something else

wheat mesa
#

It transfers control back from the callee to the caller

#

Aka when you use return in a function, it continues back from wherever it was called

hushed robin
#

so

#

would i use continue

#

instead

wheat mesa
#

Yes

#

Continue skips the rest of the iteration and continues on the next one

hushed robin
#

with continue is there anyway to do js if (!channel) return database.prepare(`DELETE FROM trackers WHERE id = '${tracker.id}';`).run(); or would i have to do js if (!channel) { database.prepare(`DELETE FROM trackers WHERE id = '${tracker.id}';`).run(); continue; }

wheat mesa
#

You’d do the latter

hushed robin
#

what does that mean

wheat mesa
#

The 2nd one

hushed robin
#

ok

#

3 extra lines

#

💔

wheat mesa
#

More readable

hushed robin
#

thank you waffle and tim i appreciate your help 🇼

lean ridge
#

how to create a bot for my server

hushed robin
#

did you read what waffle said above?

lean ridge
#

i did submit it

hushed robin
#

how are you asking "how to create a bot for my server" but you've already created a bot

#

⁉️

lean ridge
#

idk

#

but they did not approve yet

hushed robin
#

it needs to be reviewed

#

which takes quite awhile right now, like 2 weeks

lean ridge
#

😴

#

i have read

hushed robin
#

ok 👌

lean ridge
#

thats how i got to this server

scenic kelp
#

why are you asking how to create a bot for your server though that has nothing to do with being approved

hushed robin
#

what would cause the missing access error when editing a voice channel if my bot has the Manage Channels + Connect permissions

deft wolf
#

The instructions were not clear

quartz kindle
#

ie, the bot was kicked

hushed robin
#

besides that

quartz kindle
#

maybe not having view channel permission

hushed robin
#

hmmm, will test that out

lyric mountain
#

That was a terrible question

#

Are u trying to use image recognition or u already have one running?

#

Opencv

#

Never used it, but ik people use opencv

#

Just note that the "open" family is extremely low level

#

Can't u just ask for the link and scrap it?

#

Besides, why don't u simply use valorant api?

#

All riot games have an api

quartz kindle
#

so you want them to send an image and read the text in the image to get the rank?

lyric mountain
#

If there are sites for global rank there's definitely an api u can use

#

Also, u can request api keys

#

If nothing works I'd still recommend scrapping

#

Leave image recog for the last option

quartz kindle
#

even if you need image recognition, if it has text, use OCR, no need for ai

lyric mountain
#

That's why I suggested opencv

wheat mesa
#

I'm sure there's a better way to do this

#

Aka using their API instead of image recognition

#

have you thought about the "opt in" thing being there for a reason...

rustic nova
#

What difference does 4 fucking bytes make lol

earnest phoenix
# rustic nova What difference does 4 fucking bytes make lol

It actually makes a considerable difference because it expands the amount of information that can be sent, and considering the incredible amount of packets being sent so many times, it gradually helps to optimize and reduce the amount of packets needed to send

But that's if they're trying to optimize, they could also be requiring more information on every packet to properly work

flat copper
#

can you access
interaction.message
without messageIntent?
in discord.js

#

interaction given by interactionCreate event

next storm
#

my bot is taking so much memory, how can I have a control on this Thinking_Pedrito

dry imp
#

shut it down

next storm
#

😂

wheat mesa
next storm
wheat mesa
#

It also depends on what is actually causing the high memory usage

#

How many guilds is the bot in and how many members (estimated) does it serve in total? How much RAM is it using?

next storm
#

3k guilds, and it has around 3657704 members (568930 in cache), and it has used 3.8gb ram within the uptime of 46h

wheat mesa
#

That’s quite a lot of cached users so I can see why it’s using that much

#

Do you cache messages as well? Do you need to have messages cached?

next storm
#

I don't think so there's any need of old messages

wheat mesa
#

If your bot can function entirely on slash commands, you can save a considerable amount of memory without caching any messages (assuming you’re using message intent already)

#

Member cache is where most of your memory usage is probably going to reside, I’m not sure if there’s a way to change it in djs but in the library I used there was a way to set how long it took before items were removed from the cache

next storm
wheat mesa
#

Ah

#

Is that unavoidable?

next storm
#

like what I can do is, that I can clear the cache, and if I need the details of a member, then I can just fetch it from the client

wheat mesa
#

You can also use chrome’s devtools heap snapshot to look at what’s taking a majority of your memory, or some other memory profiler

wheat mesa
next storm
#

the <Client>.users.fetch("id") fetches directly from API, right?

wheat mesa
#

The best way to get rid of excessive ram usage in a bot is to find a way to cache less or ideally not need to cache at all. If your bot needs member data and message data frequently then that’s not really an option, so you might have to deal with some higher memory usage

wheat mesa
#

(Technically it checks the cache first and then goes to the api if there’s no key match)

next storm
#

ahh

wheat mesa
#

Ideally you’d want to probably convert to interactions, but if that isn’t an option then unfortunately messages will eat a lot of ram

flat copper
#
const avatar = await Canvas.loadImage(int.user.displayAvatarURL({
            format: "png"
        }))
        ctx.drawImage(avatar, 1000, 500, 50, 50)

error: unsupported image type

#

int = interaction given by interactionCreate event

earnest phoenix
flat copper
#

oh ty

eternal osprey
#

@lyric mountain hey i had a question, we had to do this for class and I wanted some confirmation before i'll spend a lot of time designing this. I thought about creating an abstract class with the given methods, uninitialized, and then create a new class named newQuestion, extending this abstract class?

#

but we actually also had to save the objects, could i somehow do that in the abstract class?

#

like, newQuestion[] test = ...

eternal osprey
#

or am i tripping

lyric mountain
#

As long as the classes have a common ancestry you can always put them together

next storm
#

I'm trying to make a role all command, which will provide the specified role to all the users of the server.
My bot will be ratelimited if I don't make a time gap between every member getting the role, so how much time should I gap in between, so that it doesn't ratelimit my bot

rustic nova
#

Check discords docs

next storm
#

can't find there iara_smh

digital swan
next storm
earnest phoenix
#

Hey, How do I fix this footer when the screen size is changing?

#

this is the normal size

civic scroll
#

like 100% of body

#

instead of a fixed size

#

to set a limit on size you can grow / shrink, you can check out clamp

earnest phoenix
#

on media query class?

#

or non media query class?

civic scroll
earnest phoenix
#

oh still not working

tulip ledge
quartz kindle
earnest phoenix
# quartz kindle show your current css

CSS Code

.footer{
    border-top: 1px black solid;
    border-bottom: 1px black solid;
    background: rgb(14,0,255);
    background: linear-gradient(90deg, rgba(14,0,255,1) 0%, rgba(30,30,143,1) 47%, rgba(21,140,164,1) 100%);
    color: white;
    font-family: Arial, Helvetica, sans-serif;
    padding: 30px;
    bottom: 0px;
    margin-top: 1000px;

    position: relative;
}

footer .contents{
    display: flex;
    
}

footer .contents .left-content{
    width: 500px;
    margin: 20px;
}
footer .contents .left-content .title{
    font-size: 20px;
}

footer .contents .right-content .title{
    font-size: 20px;
}

footer .contents .center-content .title{
    font-size: 20px;
}

footer .contents .center-content{
    width: 500px;
    margin: 20px;
    display: flex;
    flex-direction: column;
    
}

footer .contents .right-content{
    width: 500px;
    margin: 20px;
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    
}

footer .contents .right-content .ul{
    text-decoration: none;
    
}

footer .contents .center-content .links{
    position: relative;
    text-decoration: none;
    color: white;
    padding: 2px;
    transition: 0.5s;
    line-height: 25px;
}


footer .contents .center-content .links:hover{
    background-color: aqua;
    
    border-radius: 10px;
    
    position: relative;
}
#

HTML Code

    <footer class="footer" id="footer-section">
        <div class="contents">
            <div class="left-content">
                <span class="title">ABOUT US</span>
                <br>
                <br>
                <hr>
                <br>

                <p style="line-height: 25px;">An Friendly, Powerful, And Discord Bot Dev Comminuty Since Started On <b>01/05/2023</b>. So What are you Waiting For? Come On
                And Join With Us And Test Our Discord Bots How There are Good</p>
            </div>

            <div class="center-content">
                <span class="title">LINKS</span>
                <br>
                <hr style="margin-bottom: 15px;">
                <ul class="ul" style="list-style: none; text-align: center; line-height: 29px;">
                <li class="links"><a href="" class="links" ><span>Home</span></a></li>
                <li class="links"><a href="" class="links" ><span>About</span></a></li>
                <li class="links"><a href="" class="links" ><span>News</span></a></li>
                <li class="links"><a href="" class="links" ><span>Contact</span></a></li>

                </ul>
            </div>

            <div class="right-content">
                <span class="title">CONTACT US</span>
                <br>

                <div class="contact-info">

                <hr style="margin-bottom: 15px;">
                <i class="fa-solid fa-house"></i>&nbsp; |&nbsp;  Location: Nugegoda, Colombo, Sri Lanka <br><br>
                <i class="fa-solid fa-envelope"></i>&nbsp; |&nbsp; kevinbandara0000@gmail.com <br><br>
                <i class="fa-solid fa-phone"></i>&nbsp; |&nbsp; 078996770

            </div>
            </div>


            
        </div>
    </footer>
hushed robin
#

guys

#

In discord.js what does channel.manageable do

hushed robin
#

no

quartz kindle
#

ah channel, not member

#

mb

#

probably the same thing tho

hushed robin
#

yes I know that

#

but

boreal iron
#

Tim the walking and breathing documation

quartz kindle
#

@_@

hushed robin
#

does that mean the channels role/member permissions or editing the channel, because those require two different permissions (manage roles and manage channels)

#

I want to check if my bot can edit the channels name, however, just checking if the bot has Manage Channels doesn’t seem to be enough

#

because im getting missing access errors

earnest phoenix
hushed robin
#

wanted to know if channel.manageable would be a solution for that ❓

earnest phoenix
#
@media screen and (max-width: 600px) {
    .topnav a:not(:first-child) {display: none;}
    .topnav a.icon {
      float: right;
      display: block;
      
    }

    .footer{
        width: 500px;
        display: flex;
        flex-direction: column;
        
    }

    .bottom{
        width: 450px;
    }
  }
  
  @media screen and (max-width: 600px) {
    .topnav.responsive {position: relative;}
    .topnav.responsive .icon {
      position: absolute;
      right: 0;
      top: 0;
    }
    .topnav.responsive a {
      float: none;
      display: block;
      text-align: left;

    }
  }

  @media screen and (max-width: 600px) {
    footer .contents{
        display: flex;
        flex-direction: column;
        text-align: center;
    }
    
  }
#

Here's the media query

quartz kindle
hushed robin
#

wrong message

quartz kindle
#

then you can control the flexbox from footer .contents, for example using justify-content: space-around;

#

wtf

hushed robin
#

lol

quartz kindle
#

its not the first time, wtf is going on with discord

frozen dagger
#

poggythumbsup waiting since 12 days for verification how much more

lament rock
#

forever

#

touch grass in the meantime

earnest phoenix
hushed robin
#

how can i ignore if a value is null in a if statement

deft wolf
#
if(!value)

no?

hushed robin
#

i want to ignore if the value is null

#

in an if statement

#

so i don't get the typeerror

lyric mountain
#

that's what they showed

hushed robin
#

no

lyric mountain
#

null is falsy, the inverse of false is true

hushed robin
#

ok

#

but

#

i don't want to get this error TypeError: Cannot read properties of null

lyric mountain
#

show some code

hushed robin
#

why?

earnest phoenix
#

LMAO

lyric mountain
#

because you want help, and we cant help if you dont give the slightest context

earnest phoenix
#

You won't get help if you don't share your code

hushed robin
earnest phoenix
#

You expect to get help, yet don't want to share code

#

Is it maybe copy pastaed code bravemmlol

hushed robin
lyric mountain
#

use ?.

hushed robin
#

i coded this myself

earnest phoenix
#

Minecraft

hushed robin
#

minecraft?

quartz kindle
#

as huuhaku said, if you use ?. the entire expression is converted to undefined in case of null or undefined.
for example
variable.property?.includes() will return undefined if property is null or undefined, and not proceed with reading includes

hushed robin
#

bruh

#

so

#

how can i

#

not have it error

quartz kindle
#

i just said how

lyric mountain
#

tell me you don't understand what the error means without saying it

hushed robin
#

oh nvm

#

it worked

#

w

quartz kindle
#
let variable = {};
let a = variable.property.something // error
let b = variable.property?.something // undefined
hushed robin
#

(slightly)

hushed robin
quartz kindle
#

anything after ?. is canceled

hushed robin
#

bruh

quartz kindle
#

so it will never reach there

#

and thus, not error

hushed robin
#

sooooooo

#

if i were to use that with includes

#

it would not check if it includes

quartz kindle
#

its a short circuit, its exactly the same as doing this

let a
if(variable.property) { a = variable.property.something }
else { a = undefined }
#

using your example of if (variable.property.includes('...')) it would be like this:

#
let a;
if(variable.property) { a = variable.property.includes("...") }
else { a = undefined }

if (a)
#

the above is shortened to: ```js
if (variable.property?.includes('...'))

hushed robin
#

hm

#

ok

quartz kindle
#

or using ternary:

solemn latch
#

timdocs

deft wolf
#

timgoat

lyric mountain
#

timotei

quartz kindle
#
if (variable.property?.includes('...'))

is equal to

if (variable.property ? variable.property.includes('...') : undefined)
#

if only i got paid for this

#

lmao

hushed robin
#

so if I had this and it was null

if (variable.property?.includes('...')) {
  ...
} else {
  ...
}

it would do the else, right

quartz kindle
#

yes

hushed robin
#

ok

#

thank you

quartz kindle
#

because it would shortcircuit to undefined, and if(undefined) is falsey

#

hey guys when you're all rich and famous company owners consider hiring me :^)

hushed robin
#

🤞

sharp saddle
#

Tim Javascript course when?

hushed robin
#

how can I prevent this access error? right now i'm using <Channel>.manageable which it seems to get pass / bypass.
I am catching the error, so it really does nothing, but i want to know if there's anyway to check if my bot has access to the channel or not.

quartz kindle
# hushed robin

is this still about the voice channel thing? what permissions does your bot have?

hushed robin
#

yes it's related to that

#

i'm not exactly sure what permissions it has. this is a public bot, which is why i don't really know how to reproduce it.

though, i can check the permissions, give me a second.

quartz kindle
#

try channel.manageable && channel.viewable

hushed robin
#

🤦

#

how did i not see that in the docs

#

thank you again, tim

#

that'll probably solve it

quartz kindle
#

👍

hushed robin
#

If I had a user-set variable which the application would enter into the database, how would I go about preventing possible SQL injections?

quartz kindle
#

each lib does them differently, for example better-sqlite3 does them like this db.prepare("... ? ...").get(variable)

hushed robin
#

yeah I see

#

so if I use prepared statements already, I should be fine?

quartz kindle
#

yes

hushed robin
#

I'm using better sqlite3

#

alright

quartz kindle
#

sql injections can only happen when you mix variables directly into the sql query, for example using string concatenation

#

when the lib has functions that separate the query from the variables, it means they are probably using prepared statements internally and should be protected by default

hushed robin
#

good to know

#

thank you 🤲

viral spade
#

is there a way to detect peoples button presses on menus from other bots?

#

in d.js

hushed robin
#

no

viral spade
#

ok thx

hushed robin
#

is the "first row" the entry nearest to the top of the database?

hidden gorge
#

Node version: Undefined

 const { Client, Events, GatewayIntentBits } = require("discord.js");
const packageJSON = require("./package.json");
const discordJSVersion = packageJSON.dependencies["discord.js"];
const { token } = require("./config.json");
const clc = require("cli-color")

const client = new Client({ intents: [GatewayIntentBits.Guilds] });

client.once(Events.ClientReady, c => {
    console.log(clc.blue("[INFO]"), clc.green("-"), clc.yellow(`Logged in as ${c.user.tag}`));
});

client.once(Events.ClientReady, c => {
    console.log(clc.blue("[INFO]"), clc.green("-"), clc.yellow("Server Logged in."));
    console.log(clc.blue("[INFO]"), clc.green("-"), clc.yellow(`User ID: ${c.user.id}`))
});

client.once(Events.ClientReady, c => {
    console.log(clc.blue("[INFO]"), clc.green("-"), clc.yellow(`Guilds: ${client.guilds.cache.size}`));
    console.log(clc.blue("[INFO]"), clc.green("-"), clc.yellow(`Channels: ${client.channels.cache.size}`));
    console.log(clc.blue("[INFO]"), clc.green("-"), clc.yellow(`DJS Version:  ${discordJSVersion}`));
    console.log(clc.blue("[INFO]"), clc.green("-"), clc.yellow(`Node Version: ${process.Version}`));
});

client.login(token);```
earnest phoenix
lament rock
#

why do you have multiple listeners of the same event right next to each other

#

that is so useless

hushed robin
#

true

#

why 3 of the same event

crystal furnace
#

const { Permissions } = require('discord.js');

const channel = message.channel;
const botPermissions = channel.permissionsFor(message.guild.me);

if (!botPermissions.has(Permissions.FLAGS.SEND_MESSAGES) || !botPermissions.has(Permissions.FLAGS.EMBED_LINKS)) {
  message.author.send('I do not have permission to send messages or embeds in this channel/server!');
  return;
}


#

My discord.js-v13 code for logic "if the bot can't send message / embed in a channel (don't care it is missing the server permissions or channel permissions), the bot will DMS a user to announce "

#

Is my logic and my code right?

earnest phoenix
boreal iron
#

Also send() is a promise you neither await nor catch

earnest phoenix
crystal furnace
boreal iron
#

So once it's DM you can skip the entire check

lament rock
#

Will this code work?
> Proceeds to dump the entire source code base for Discord

#

Short answer would be no

#

Would be funny if people sent whole ass zips of their projects just to ask if it would work

hushed robin
lament rock
#

Does Discord work for you?

hushed robin
#

yes

lament rock
#

stop kidding yourself, it's a buggy and broken mess

hushed robin
#

true

#

It’s constantly freezing on mobile

lament rock
#

lmao

#

Whenever I'm in a call on mobile and a timer goes off, my mic breaks and I have to restart

hushed robin
#

like I open the message menu to delete a message

#

and it just freezes

#

😵so nice

crystal furnace
earnest phoenix
rustic nova
#

npm-c:

quartz kindle
#

invalid PRs are funny af

earnest phoenix
#

I don't remember something like that happening on the node repo but yeah, the invalid PRs are hilarious

#

I sometimes read through them

foggy violet
#

Anyone having problems with when your bot synces app comnands it kicks him offline?

quartz kindle
#

do you have any error?

foggy violet
#

And this happens when i sync tree on on_ready event

quartz kindle
foggy violet
#

It was crashing due to one api being offline and task crashed the whole bot

quartz kindle
#

👍

rotund river
#

hi I have a problem with my bot

#

i want to create a private voice chat when a user enter in a vocal chat

#

this is my code:

client.on("voiceStateUpdate", (oldMember, newMember) => {
    if (newMember.channelId === "1081190849255321680") {




    const member = newMember.id

    const CChannel = client.guild.channels.create({
        name: `🔊 ${member.user.username}'s private'`,
        type: ChannelType.GuildVoice,
        parent: client.config.privateCategory,
        
    });



    member.voice.setChannel(CChannel.id)
    client.member.voice.setChannel(CChannel.id)
    setInterval(() => {

        client.on("voiceStateUpdate", (oldMember, newMember) => {
            try {
            if(CChannel.members.size === 0){CChannel.delete()};
    } catch (err) {return}
    return;
        
        })
    
    


  }, 2000)
 }
})
#

and this is the error:

Uncaught Exception: TypeError: Cannot read properties of undefined (reading 'channels')

deft wolf
#

Because you don't have guild defined

#

I have no idea how client.guild would work

rotund river
rotund river
#

Uncaught Exception: TypeError: Cannot read properties of undefined (reading 'channels')

lyric mountain
#

how are u defining guild?

rotund river
radiant kraken
#

read the docs™️

rotund river
#

I have another problem, whit member.voice.setChannel(CChannel.id) it don't move me

#

i have this error

#
(Use `node --trace-warnings ...` to show where the warning was created)```
deft wolf
#

Yea, you have too much listeners

#

Aka events

rotund river
lyric mountain
#

no they don't have any connection

#

the error (that isn't an error, but a warning) is just saying ur using way too many listeners (and should be fixed asap)

rotund river
#

ah ok, so why it don't move me? it don't have error

lyric mountain
#

what is CChannel?

rotund river
#
        name: `🔊 ${member.user.username}'s private`,
        type: ChannelType.GuildVoice,
        parent: client.config.privateCategory,
        
    });```
lyric mountain
#

don't u need to await that?

#

anyway, it'd error if u needed

#

are you sure, 100% sure there's no error in the log?

rotund river
deft wolf
#

Oh boi

lyric mountain
lyric mountain
#

like, I know making a bot is cool and all, but you're shooting in the dark if you have no experience with the language you're using

rotund river
#
client.on("voiceStateUpdate", (oldMember, newMember) => {
    if (newMember.channelId === "1081190849255321680") {
    let guild = client.guilds.cache.get(client.config.guildID);



    const id = newMember.id
    const member = guild.members.cache.get(id)
      
    const CChannel = guild.channels.create({
        name: `🔊 ${member.user.username}'s private`,
        type: ChannelType.GuildVoice,
        parent: client.config.privateCategory,
        
    });

      member.voice.setChannel(CChannel.id)




      
    setInterval(() => {

        client.on("voiceStateUpdate", (oldMember, newMember) => {
            try {
            if(CChannel.members.size === 0){CChannel.delete()};
    } catch (err) {return}
    return;
        
        })
    
    


  }, 2000)
 }
})
lyric mountain
#

you shouldn't be creating a channel inside a voiceStateUpdate

#

also, u don't need to get the guild from the cache since any of the params will have the guild as a property, nor member since u already have the member as a param

#

and this alone will destroy your bot in a matter of minutes

rotund river
lyric mountain
#

that line is also the answer to your original question, probably

lyric mountain
#

and no, I won't tell you how, you seriously lack programming knowledge, and I advise you to do a few crashcourses to get yourself familiar with it first

slender wagon
#

@lyric mountain how could i go through the source code of an electron .exe

#

i got a scammers .exe

#

look at the size of this thing

lyric mountain
#

and remember, if ur gonna do it, do in an offline vm

slender wagon
#

oh ok

#

any windows installation and light u suggest for vbox?

lyric mountain
#

any

#

you'll be deleting it afterwards anyway

#

I used windows 10 for mine since it's easy to find

#

just make sure you isolate the vm, so no matter what malwares won't be able to escape

#

tho I doubt it'll have any malware to begin with

#

install 7zip and the plugin I mention there before you lock the vm, else you'll need to reopen connection, which u shouldn't

#

after ur done fiddling with the source files, simply delete the vm

slender wagon
#

damn 7z is better than winrar?

#

i should've known

lyric mountain
#

always was

#

it's faster, smaller, free (and open-source) and has a ton more compatibility than winrar

slender wagon
#

can i make .exe's with it like winrar

#

i make extracting tools

#

i need it for some projects

lyric mountain
#

the only advantage winrar has is that their proprietary format allows fixing corrupted files sometimes

slender wagon
#

like auto extracting

lyric mountain
slender wagon
#

yes winrar does that

#

it compiles certain things for me into a .exe

lyric mountain
slender wagon
#

yep

#

also how do i isolate a vm?

lyric mountain
lyric mountain
slender wagon
#

only for a certain os?

lyric mountain
#

it isn't inside the vm

slender wagon
#

right now i am downloading some sort of windows 10 light since i got little space on my ssd

lyric mountain
#

it's before you open it (in virtualbox vm settings for example)

slender wagon
#

should i do that after i install the required tools?

hidden gorge
lyric mountain
#

instead of creating 3 listeners

wheat mesa
crystal furnace
#
const channel = message.channel;
    const botPermissions = channel.permissionsFor(message.guild.me);

    if (!botPermissions.has(Permissions.FLAGS.SEND_MESSAGES) || !botPermissions.has(Permissions.FLAGS.EMBED_LINKS)) {
      message.author.send({
        embeds: [
          new MessageEmbed()
           ...
        ],
      });
      return;
    }
#

I have test this code, it only work for one time, in the next time of request the log still showing, how do I can solve it

#

I turn off and restart the bot, the same problem still happening

boreal iron
#

You didn't respect my words I mentioned above

#

The DM you wanna send, the method you're using is a promise

#

You need to await and catch it

#

Once somebody doesn't allow DMs, then you can't send him one