#development

1 messages Β· Page 72 of 1

lament rock
#

My deal is that I also need to pass localized slash command strings whenever I post them

lyric mountain
#

ah, I forgot slashes

neon leaf
#

does this look fine?

lyric mountain
#

top left logo is way too dark

#

chrome has a contrast checkerr if u press f12

civic scroll
civic scroll
# neon leaf does this look fine?

imo given those things
you can have the profile img name, and "manage server" on the left of the box and the stats aligned on the right of it, both vertically stacked
that removes the "welcome" and "stats" though you can keep the "stats" if you'd like
also there are alot of unused space, i hope you will populate em with something

quartz kindle
#

the css criminal has spoken

#

sayuri escobar

sharp geyser
neon leaf
slender wagon
#
error: syntax error at or near ","
 pg.query(`INSERT INTO premium(id, username, discrim) VALUES(${id}, ${name}, ${discriminator})`, (err, res) => {
                        console.log(err, res);
});
#

using postgress

neon leaf
#
await pg.query(`INSERT INTO premium(id, username, discrim) VALUES($1, $2, $3)`, [id, name, discriminator])
slender wagon
#

ohhh bruh

neon leaf
sharp geyser
#

Imagine still using axios

earnest phoenix
#

Use Undici instead

sharp geyser
#

Just use native fetch if anything

spark flint
#

Imagine not using @ aero/http

sharp geyser
#

imagine plugging some random lib

neon leaf
#

how can I shorten total = total + 10?

spark flint
#

total += 10

neon leaf
#

thanks

quartz kindle
#

raw http > undici > *

#

jk, undici can be better than raw http

#

when it works

#

:^)

neon leaf
#

readable code

slender wagon
#
error: value "435546546546" is out of range for type integer

i am literally passing it as a integer

neon leaf
#

did you read the error

slender wagon
#

oh just googled it

#

so i have to edit it on the table

neon leaf
#

if its a user or guild id, prob better to store as varchar(255)

boreal iron
#

Wtf

#

You better delete that message

neon leaf
#

I will keep it there

boreal iron
#

Before somebody bonks your head

slender wagon
#

it's indeed a user id

quartz kindle
#

storing ids as strings :X

slender wagon
#

i am not

#

oh

boreal iron
#

Don't follow that recommendation

quartz kindle
#

good boi

boreal iron
#

Or we have to sort u out of this channel

quartz kindle
#

but

#

what db are you using?

#

depending on the lib, it might not support js bigints

neon leaf
#

hes using postgres

quartz kindle
#

so you might have to transmit as string

#

and have the db cast it to long int

boreal iron
#

long long

spark flint
quartz kindle
#

why do you need an undici wrapper

spark flint
#

πŸ€·β€β™€οΈ

quartz kindle
#

Β―_(ツ)_/Β―

sharp geyser
#

Why the fuck is it using port 3001 when I have it set to use 3000, port 3000 is what is open on my nginx shit

#

πŸ˜”

#

Actually pressed

boreal iron
#

Try 2999 freerealestate

sharp geyser
#

fake for some reason it will just increment the port

#

πŸ˜”

quartz kindle
#

bench pressed

boreal iron
#

Probably hard coded then

sharp geyser
#

It is hardcoded as 3000 but somewhere in vite it probably incremens when it notices something is already using the port

#

which is fucking nginx

slender wagon
#

bigint worked very well

sharp geyser
#

πŸ˜”

#

Do I even need nginx?

#

I mean if I wanna host multiple sites for sure

neon leaf
#

why is nginx using 3000

boreal iron
#

Apache exists as well

sharp geyser
boreal iron
#

And more modern weird alternatives

neon leaf
#

why dont you just change its port then?

sharp geyser
#

Cause vite auto increments the port

#

the ports need to match

#

πŸ’€

neon leaf
#

I mean the nginx port

sharp geyser
#

Cause you dummy

boreal iron
sharp geyser
#

if I change the nginx port I have to make the web server listen on the fucking same port

#

but UH OH

#

GUESS WHAT

#

same issue

boreal iron
#

You have two processes listening to the same port?

#

This will be difficult okeh

sharp geyser
#

DUMBEST FUCKING SHIT ON THE PLANET

sharp geyser
#

πŸ˜”

#

Wait I might acutally be dumb

neon leaf
#

proxy the site through nginx

sharp geyser
#

That's what I am doing

#

but its not working

boreal iron
#

Proxy pass or what do you wanna do exactly?

sharp geyser
#

I was proxy passing

neon leaf
#

why do you need nginx to be on 3000 then?

boreal iron
#

The internal proxy port can be whatever u like to

#

Passing the external port or default port (80) to another one

sharp geyser
#

Wdym

#

I followed some shit indian tutorial on setting up nginx so I am a little confused on how this work

boreal iron
#

lmao

#

Indian tech videos, best tutorials ever

sharp geyser
#

This is what I have rn

neon leaf
#

idk what exactly your setup is and if you know this but you can have multiple nginx configs listen on the same port if you have server_name set

sharp geyser
#

thatt is what the dude told me

neon leaf
boreal iron
#

Don't u wanna pass your server name (domain) to another direction?

sharp geyser
#

IDFK fake

boreal iron
#

You're doing the other way around

sharp geyser
#

This is all greek to me

slender wagon
#

i am using this property for usernames (discord usernames) is it bad

sharp geyser
#

but if you are using a varchar just why?

sharp geyser
neon leaf
#
server {
  listen 80;
  server_name aarondye.dev;

  location / {
    proxy_pass http://127.0.0.1:3000;
  }
}```
boreal iron
#

Tf Misty ... drunk boy

sharp geyser
#

I got permission denied lovely

#

forgor to fucking sudo it

#

πŸ˜”

boreal iron
#

Nub

#

Imagine running this a super user

neon leaf
#

and I hope you dont wanna use this setup for production

#

since running a dev server isnt a good idea

#

you should build and serve the files via nginx, I can tell you how if you want

boreal iron
#

Do you assume it's a development server because of the tld?

neon leaf
#

because he wants to proxy vite

boreal iron
#

That's the result when watching youtube videos

sharp geyser
#

get fucked

boreal iron
#

Ads

#

Ban

sharp geyser
#

Idc

sharp geyser
sharp geyser
#

I have no idea what I am doing when it comes to nginx

neon leaf
#

id assume you know how to build the site though ,right?

sharp geyser
#

vite build

#

if thats what you mean

boreal iron
sharp geyser
#

not much

neon leaf
#

    listen 80;
    listen [::]:80; # REMOVE THIS IF YOU DONT HAVE IPv6
    server_name aarondye.dev;

    root ////PATH TO DIST FOLDER////;
    index index.html;

    client_max_body_size 100m;
    client_body_timeout 120s;

    location / {
        try_files $uri /index.html;
    }

}```
sharp geyser
#

I have IPv6 but just don't configure it yet

boreal iron
#

_what can go wrong _ freerealestate

#

Firewalls and proper network knowledge is overrated

sharp geyser
#

Indeed

#

I will learn that later

#

rn I have site to run

#

Oh yea btw how the fuck do I reference my user dir properly KEKW

#

I forget basic linux stuff

neon leaf
#

whats your username?

sharp geyser
#

misty

neon leaf
#

/home/misty

sharp geyser
#

seriously ?

#

damn

boreal iron
sharp geyser
#

Damn my configuration failed oh no

neon leaf
#

show it

sharp geyser
#

fixed

#

Now time to make website to take over the world

lament rock
sharp geyser
#

πŸ‘€

#

Can I buy a .gov domain?

lament rock
#

no

neon leaf
sharp geyser
#

πŸ˜”

#

Fuck my dreams are ruined

#

unless...

#

I topple the government

lament rock
#

make your own namespace somehow in dns resolvers and create your own tld

sharp geyser
#

Fuck that

#

I will just pay the government 200k bobux

boreal iron
#

There's nothing you can't buy tbh

neon leaf
#

burh, google is still using my old domain, and im third 😐

sharp geyser
#

oh ur german

neon leaf
#

yes

sharp geyser
#

nice

#

Also should I setup fail2ban or trust my vps host

boreal iron
#

Not really a surprise using such a weird name

sharp geyser
#

:^)

boreal iron
sharp geyser
#

oh yea for sure

#

not my friend's vps being attacked on the daily

#

:^)

boreal iron
#

_what can go wrong _ freerealestate

sharp geyser
#

nothing

#

absolutely nothing

boreal iron
#

True

sharp geyser
#

https://www.youtube.com/watch?v=kgdoVeyoO2E linode is trustworthy people

Fail2Ban helps to protect servers against unauthorized access attempts and brute-force attacks. This tutorial shows you how to install and configure Fail2ban to secure your server.

Chapters:
0:00 - Intro
0:40 - Fail2ban Overview
2:20 - Install and fail2ban.conf
4:15 - Configuring jail.conf
8:17 - Working with Jails
10:51 - Wrapup

New to Linode...

β–Ά Play video
#

I will watc h this later

boreal iron
#

Without proper network knowledge and a well configured dedicated firewall it won't solve all ur issues

sharp geyser
#

Guess what fake

#

you are right

#

but

#

IDC

boreal iron
sharp geyser
#

I have no idea where to start with learning this stuff

#

so I am just watching yt videos

boreal iron
#

As long as you're not in my network I'm okay with that freerealestate

sharp geyser
#

cause yt has everything

boreal iron
#

Indians creating the best tutorials

#

truly tech experts

neon leaf
#

yes

#

Im concerned because I actually never watched a indian tech tutorial

#

I just google shit

boreal iron
#

Maybe just one of an Indian with a different dialect

neon leaf
#

I never watched tech tut videos πŸ—Ώ

boreal iron
#

Liar

neon leaf
#

no

boreal iron
#

Im mostly hanging around in development

#

People in general are all weird

neon leaf
#

true

earnest phoenix
boreal iron
#

@ Mac we need somebody getting banned here

earnest phoenix
#

We need to stop all of these FakE news!

boreal iron
#

Quiet terrorist

earnest phoenix
#

Funny argument, look at the engine of your car, something surprising is in there

boreal iron
#

You're right

#

a V8

earnest phoenix
#

You've been using the V8 JavaScript engine the whole time! FakE true JavaScript fan

boreal iron
#

Eww

earnest phoenix
#

We know it!

boreal iron
#

Maybe if JS would be embedded in php

neon leaf
#

what

quartz kindle
#

port v8 to php

neon leaf
#

no

#

do the opposite

#

port php to v8

quartz kindle
#

php engine written in js

boreal iron
wooden ember
#

is there a way to make dms in discord work like they used to? so i dont have to "accept" them first to reply

#

is it a setting some where or is it just hard coded like that now

quartz kindle
#

there is this setting

radiant kraken
quartz kindle
#

ourcord

cursive musk
#

Another thing -

I saw on Google that this is the way to make invites.

.create("1006248339110637670", { maxUses: 1 })
      .catch((e) => e);

What does 1006248339110637670 represent, the Guild ID?

craggy pine
#

That would make sense.

cursive musk
#

Alrighty

sick agate
cursive musk
#
    const testingServer = client.guilds.cache.get(global.config.guilds.testing);

    const invitecode = await testingServer.invites
      .create("1043571235898019890", { maxUses: 1 })
      .catch((e) => e);

Can someone help me figure out what's going wrong πŸ˜‚

#

This is the result I'm getting for invitecode.url

quartz kindle
#

its the channel id, not guild id

#

invites are based on channels

#

(no idea why tbh)

lament rock
#

iirc

#

also voice channel invites

earnest phoenix
#

can some one help me with one event

neon leaf
#

seems like top.gg api supports ipv6

#

so yeah

fervent moss
sharp geyser
#

cause

#

you can't find it

neon leaf
#

are the permissions correct?

fervent moss
#

Yup

neon leaf
#

try ./temps/ly248zki.png

fervent moss
#

Same error

rigid maple
#

I remove all listeners after the user starts talking, likewise, I remove them after they are finished, and I remove them when the createListeningStream function runs.
but it still creates 2 stream (i running the createListeningStream function several times)

#

i want it to create stream only once. when i use createListeningStream function a second time, it will remove old one and add new listener.

quartz kindle
#

log receiver.speaking._events

#

to see if thats actually where the listener is added

nocturne fiber
#

@muted junco

rigid maple
#

i did it thanks

hallow compass
#

how to cut equal pieces in cake using python

digital swan
#

You probably wanna use a knife for that

hallow compass
earnest phoenix
radiant kraken
#

ussr anthem plays

earnest phoenix
#

Also Discord has apparently added unordered list markdown

#

But for some reason it only works in forums

#

Gotta love Discord ✨ inconsistencies ✨

boreal iron
#

Tables when..?

earnest phoenix
boreal iron
#

True... there are far more important emoji projects and ways to pay for nitro at first

earnest phoenix
#

And more important badges to pump out

boreal iron
#

Uhh yeah of course.. how could I forget about that

neon leaf
#

how can I get the command authors status in discord.js?

earnest phoenix
neon leaf
#

thanks!

neon leaf
#

so Ive finally found the issue causing this:

            triggerUncaughtException(err, true /* fromPromise */);
            ^

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "#<Response>".] {
  code: 'ERR_UNHANDLED_REJECTION'
}```

which is because the shard manager is sometimes getting ratelimited and now I have this but it still fails after it waits
hybrid cargo
#

error that could be thrown by the manager.spawn() inside the catch block is not handled

neon leaf
#

I know

hybrid cargo
#

the error is from that unhandled function call, there is no other information in your error message

neon leaf
#

yeah, the problem is still ratelimit, its like a 50% chance if the code will work

#

and I want to fix that by waiting until the limit is over

hybrid cargo
#

well increase the wait time? There is no information about what the actual error is, So maybe try to log the error and see how for how long you are getting ratelimited and just increase the waiting time. If you are already waiting for the ratelimit and it still ratelimits you then obviously you arent waiting long enough

neon leaf
#

the wait time is 3 times what Im told from the headers I need to wait

quartz kindle
#

what rate limit are you seeing? like wat is the content of that res variable?

#

the only rate limit that is applicable here should be get /gateway/bot

hybrid cargo
#

master tim to the aid

quartz kindle
#

are you running manager.spawn() multiple times for some reason?

neon leaf
#

the screenshot shows all my manager.spawns

#

I dont have any others

quartz kindle
#

do you have automatic shard count, or a fixed number?

neon leaf
#

this is all my shard code

manager.on('shardCreate', async(shard) => console.log('[0xBOT] [i] [' + new Date().toLocaleTimeString('en-US', { hour12: false }) + '] [END] $$$$$ LAUNCHED SHARD #' + shard.id))
manager.spawn().catch(async(res) => {
    console.log(res)
    await wait(parseInt(res.headers.get('retry-after')) * 5000)
    manager.spawn()
})```
quartz kindle
#

are you starting and restarting your bot too fast?

neon leaf
#

sometimes, thats where the 50% error rate comes from, I want to fix that by waiting

quartz kindle
#

im guessing the error is coming from fetchRecommendedShardCount() which is called by spawn() when the shard count is auto

#

afaik the rate limit for that end point is 1 per 5 seconds

#

so should be fine if you wait for 5 seconds

#

no need to wait longer than that

neon leaf
#

doesnt seem to work at 5500ms

#

7500ms neither

#

8500ms seems to work

quartz kindle
#

weird

neon leaf
#

is that limit bot based or ip based?

quartz kindle
#

should be based on your bot token

earnest phoenix
#

https://sourceb.in/b3VIqWgSYa

This is my steal emoji command code. I wanna make the bot reply if the server has reached its emoji limit but instead of replying, my bot crashes. The try-catch and catch(err) also won't work, plz help me!

quartz kindle
#

where is the try catch?

#

show what you tried

raw nest
#

Is there any way I can create a select with attribute multiple but let user also select something that's not as an option? Then it just adds like the others?

lyric mountain
#

ah, u mean the dropdown component

#

don't think so

raw nest
#

yes dropdown select but you can't just select options. Also create if it's not available

boreal iron
#

wut... a select menu with options to select?

raw nest
boreal iron
#

W H A T

#

guess we need a translator here

hexed hound
#

i think he means let users dynamically add options to the select menu

#

so instead of selecting whats already in the dropdown, users can input their own "text" as selection

#

either way @raw nest no its not possible

boreal iron
#

Of course it is

#

You can edit the select menu (and add/remove options) at any time

hexed hound
#

i think he means an input box in the dropdown menu

#

or something

#

ofcourse you can listen to a message and edit the embed

boreal iron
#

There's no embed and you don't need the message (event) for that

#

modal is pretty much the way to go here

#

For example as button (component) together with your select menu (component)

#

I just don't know about the sense to let users add options to the select menu, they can select later on

quartz kindle
#

there is no html for that, but you can create such functionality with js

boreal iron
#

tf

#

we're talking about html

#

lol

quartz kindle
#

he wants this

#

multi-select with autocomplete but also allows custom values

boreal iron
#

ah.. easy

#

yeah just a little bit of JS

quartz kindle
#

the html <select> element is pretty much useless these days

#

it doesnt even support proper css styling

boreal iron
#

i wanna say even 5 years ago already

#

lemme find something...

quartz kindle
#

almost everyone uses a js-based select menu

boreal iron
#

there we go

quartz kindle
#

an avi file wtf

boreal iron
#

IT WAS YEARS AGO

#

wait

#

I will

#

just for u

quartz kindle
#

dont bother

#

already downloaded it

#

lmao

#

pretty nice

#

thats basically what they want

#

with the option to add a custom value

boreal iron
#

it can yes

neon leaf
#

how can I export each of my tables into seperate sql files as normal postgres user? (using node pg)

neon leaf
#

can I use dump with node pg?

boreal iron
#

you can actually use any app to export your stuff

#

as long as the database user has the permissions to

neon leaf
#

so,
const file = await db.query('pg_dump ...')?

boreal iron
#

it's not just a query

#

but you can export them like that, too

neon leaf
#

ah, k
so for exporting a single table it would be
const file = await db.query('pg_dump oxbot -t usermoney')?

boreal iron
#

once again pg_dump is an executable

#

has nothing to do with a query

neon leaf
#

I mean is the general syntax of the dump correct?

#

not the whole thing

boreal iron
#

dunno, i'm not dealing with postgres tho, that's why I sent you the docs

neon leaf
#

ended up with this because I couldnt get dump to work, tbh best code ive written in a while

#

it just doesnt work correctly

#

actually it does, nvm

#

improved:

quartz kindle
#

this doesnt need to be a promise

#

just remove the promise and the async await

#

and forEach is better

#

or even better

#

just do ```js
output[table] = rows;

#

lol

neon leaf
#

bruh

#

I could do that but I want to translate that json to sql statements in that same loop so that wont quite work

neon leaf
round cove
#

I've seen people mentioning slash commands, what's the format to do that?

round cove
#

ty qt

boreal iron
#

</NAME:COMMAND_ID>

round cove
#

So really I can jus tuse a single slash command Id and name it a million times how I want.

#

</hello-world-xdxxdxxdx:1046494652683010078>

#

Nice.

#

Can look good with message formatting at least.

boreal iron
#

will only work with an ID matching the right format

#

</test:10> will not work

round cove
#

I just used an idea and gave it a random name, so?

boreal iron
#

</test:1028020100504231998> will work

round cove
#

Oh are you saying for the command to actually WORK?

boreal iron
#

No what I mean is, mentioning will work but isn't "clickable"

#

OH

#

funny tho Discord seems to have fixed it

round cove
#

Nice lol

boreal iron
#

you can't click commands anymore which are not registered in your server

#

it seems like

round cove
#

I can't seem to click the command only in my server even with the same name and ID matching.

boreal iron
#

</info:1016674038711603231>

round cove
#

Might be because most of my commands take options.

boreal iron
#

HEE WTF

#

can you click that?

round cove
#

nope

boreal iron
#

AHAHAHA#

round cove
#

?

boreal iron
#

the client caches the app commands

#

now I can click this info thing

round cove
#

not surprised

boreal iron
#

but it shows the UI in a server the bot and command doesn't even work or is connected to

#

LOL

round cove
#

I can't even get my own bots command to work in the server it's made for lol.

boreal iron
#

man discord is so funny

round cove
#

I wonder if that's due to sub command or options or

boreal iron
#

wdym

round cove
#

Clicking the mention does nothing

boreal iron
#

you put the right ID in there?

round cove
#

Yes.

boreal iron
#

where did u get the ID from

round cove
#

console logging the interaction OMEGALUL

boreal iron
#

ok that's actually NOT the right ID then

round cove
#

I guess the itneraction Id is not the COMMAND Id

boreal iron
#

no it's not

round cove
#

yeah that makes sense lmao

boreal iron
#

it will only be visible when fetching the commands

#

but there's an easier way

round cove
#

Oh?

gilded hinge
#

πŸ‘€πŸ‘€

boreal iron
#

head to your server > edit settings > integrations > your integration >

round cove
#

pog

neon leaf
round cove
#

If I keep posting commands does it technically update the command ID?

#

Or does the command ID stay the same as long as the name is the same?

boreal iron
#

as long as you don't register the command AGAIN (for no reason) the ID will always be the same

#

even on a command update

round cove
#

So registering will always update it?

boreal iron
#

no registering it, will register it (and replace the previous one)

round cove
#

Even if nothing changed? Lol

boreal iron
#

since registration is a one time process

#

yes

#

that's the issue most people still running into

round cove
#

I wonder if there's a smart way to only ever post one new one then, I made a very crude system to just take all commands build the json and post Xd

boreal iron
#

yeah there is

#

fetch the app commands on a startup and add/edit/remove the ones which are not in sync with your locally loaded ones

#

pretty easy tbh

#

lemme give you an idea how I do it

round cove
#

I probably should.

boreal iron
#

looks like this

#

ignore the fact it's been built to update global and guild commands

round cove
#

lmao

boreal iron
#

follows exactly the API specifications without using djs stupid enums

#

it simply fetches all app commands from the API

#

then flat and format the response

#

then flat and format my cached command files

#

then compare both to each other

#

when a registered command was found but not a locally loaded one with the same "name" it will delete the registered one

#

and vise versa

#

when a command has a different description OR different command options it will update the registered command

round cove
#

hmmm

boreal iron
#

the easiest way of doing that is to transform the entire command object into a valid JSON format (which removes all undefined key/values etc.) and compare them

round cove
#

you have no idea how many times I've just re-registered my commands lmao

boreal iron
#

yeah most people seem to that as they don't really understand the registration is a one-time process

#

and this will fuck servers and people continuesly

#

and sometimes the discord client shows the commands 2 or 3 times due to caching issues

round cove
#

Yeah

boreal iron
#

as well as executing a command the has been re-registered will also fail etc.

#

so you simply only register em once, then update or remove them

round cove
#

If you have multiple shards how do you handle generating?

#

I did some goofy ass solution awhile back, so it fucking registered for each shard

boreal iron
#

tbh I haven't worked with sharding yet

round cove
#

Due to how the shard manager for d.js wraps the bot client and my bot client was handling command generation.

boreal iron
#

I don't even know if the registration is required for any shard or not

round cove
#

It was more my bot client does a thing and now X number of bot clients are being spawned thus doing it X times.

boreal iron
#

sounds interesting

round cove
#

😭

quartz kindle
#

forEach is a sync operation, it will still be sync even if you put it inside an async function

#

an async function only lets other code run when it hits an actual async operation inside it

lament rock
#

/info

sharp geyser
#

So I am having the issue of the bounds of the Logo is conflicting with the bounds of the "Hello World" so it is pushing the other below it

#
            <header class={styles.header}>
                <div class={styles.container}>
                    <img class={styles.logo} src="../../logo.svg" alt="Logo" />
                    <div class={styles.links}>
                        <p>Hello World</p>
                    </div>
                </div>
            </header>
#
.header {
    box-shadow: 0px 8px 6px -6px black;
    height: 50px;
}

.container {
    height: 100%;
}

.links {
    display: flex;
    justify-content: flex-end;
    padding-right: 10px;
    align-items: center;
    margin: auto;
    height: 100%;
}

.logo {
    display: flex;
    justify-content: flex-start;
    padding-right: 10px;
    align-items: center;
    margin: auto;
    height: 100%;
    
}
lament rock
#

position: absolute;
and put both words nested in the same container

sharp geyser
#

they are nested in the same container no?

lament rock
#

No. Hello World is in a child element to the element the logo is in

sharp geyser
#

I see

#

I don't get it huh

#

Put them in the same container?

lament rock
#

<div …stuff>
<img …/>
<div …>
// child element. Not the same as the img. Would be put under
<p>Hello World</p>

#

I'm referring to elements as containers

#

you should put stuff that should be in the same level under the same element

#

otherwise you have to mess with z indexing

#

I think

#

I may be dumb

sharp geyser
#

Yea but I don't see how I can achieve the effect I want with them being in the same container like that

lament rock
#

You want them side by side right?

sharp geyser
#

No

#

not at all

#

I want the logo towards the start, and the links at the end

#

which is why I was using flex-start and flex-end

lament rock
#

???

#

Can you draw a mock

sharp geyser
#

How are you confused at all with what I said

#

πŸ’€

lament rock
#

The start of where and the end of where

#

you're providing no context

sharp geyser
#

Notice how the "logo" is towards the beginning of the screen and "Hello, World" is at the end

#

Issue here is, the logo is pushing the hello world under it

lament rock
#

So you want them on the same level

sharp geyser
#

Yes

lament rock
#

That's literally what I said

#

Put them in the same container and use position: absolute; and then use stuff like right: 100%; for the links

sharp geyser
#

Wtf is going on with the container πŸ’€

#

Its taking up 100% of the screen instead of 100% of the parent

solemn latch
sharp geyser
#

parent's height is 50px

#

I am asking the child to take 100% of that

quartz kindle
#

is it specified as 50px in its css?

#

or does it end up as 50px but its declared as something else?

sharp geyser
#

I declare it as 50px

bitter bronze
#

a little curious if anyone has had false positives where google safe browsing incorrectly marks their site as a phishing site

#

I'm creating a site for my bot

#

and google thinks it's used for phishing despite there not even being a login prompt on the site at the moment

cursive musk
#

I'm so confused, why am I getting these errors?

#

Where do I need to place a : and ,

hybrid cargo
#

you probably have a syntax error in some other part of the code that is affecting this line

lyric mountain
#

99.9% of all sites that contain discord are scams, I'd not be surprised if google has that name in a blacklist (except for discord.com)

bitter bronze
#

guess i'll migrate to a new domain

#

thx

lyric mountain
#

That might be the best solution πŸ˜…

bitter bronze
#

or does adding bot cause an issue

lyric mountain
#

What's ur bot's name? Ageify?

bitter bronze
#

but I'm happy to change it

#

if it makes google less sus

#

still awaiting approval

lyric mountain
#

Like, you can use a domain that has the same name as ur bot

#

It'll help relate one to the other

bitter bronze
#

renaming it on discord might not be a bad idea then

lyric mountain
#

Btw, depending on what kind of "verification" you do, you'll have a hard time explaining discord how you handle data

radiant kraken
hybrid cargo
radiant kraken
#

which causes a syntax error

hybrid cargo
#

wha πŸ‘€ I never faced issues like that ever tho

#

I mean thats just me

radiant kraken
#

@earnest phoenix

hybrid cargo
#

Summon the chad

#

yes

radiant kraken
hybrid cargo
boreal iron
#

Just ban those weird people who belong to the Rust sect

earnest phoenix
# radiant kraken <@456226577798135808>

The interpreter will read it all the way through as long as there is no statement/expression terminator, newlines aren't such terminators unless you're using Python

boreal iron
#

terminating Voltrex soon...

earnest phoenix
#

Terminating your internet access and PHP love soon...

boreal iron
#

My love to php is unbreakable Sir

earnest phoenix
#

We'll see mmLol

radiant kraken
boreal iron
#

To increase your enthusiasm

earnest phoenix
radiant kraken
#

var moment

radiant kraken
rose warren
#

Somebody say PHP? πŸ‘€

sick agate
#

XHP

lament rock
#

did someone say scratch? Did you hear about how easy it is to "code" with scratch! Even a kid can get accepted to harvard with how smart scratch can make them

earnest phoenix
#

Q: if a user opts into dm vote reminders, is that still against tos?

hybrid cargo
fervent moss
#

Does someone know how to convert gif to apng? To upload it to server via discord.js not manually converting it some api... None of npm works

earnest phoenix
#

Does anyone know a bot that automatically deletes cmds from users instant and also bot messages after a certain time?

#

i dont searching auto purge for all bot messages at a timed time

#

just that every single bot message get deleted after like 5min

crystal wigeon
#

Hey um, while running a nodejs script via cron i keep running into "npx command not found" but if i run the script manually it works fine

#

am i doing anything wrong

crystal wigeon
#

*/4 * * * * export NODE_PATH=src/ && cd /home/izzi-ts && ./cronjob.sh -job 4minute >> /home/izzi-ts/cronjob.log 2>&1

This is pretty much all im doing, in the log it says npx command not found

#

but if i run the same thing directly as ./cronjob.sh -job 4minute it works

crystal wigeon
#

i found it has something to do with bash not being able to find it

outer crater
neon leaf
#

?

outer crater
#

Why it's not working

earnest phoenix
outer crater
#

Yes it says open in desktop

#

But I want it here

#

In New tab

earnest phoenix
#

Debug mode isn't available on VSCode web, so you can't do that

craggy pine
#

@real rose ^

real rose
#

elite ping

lone wing
#

I have a feeling I messed up translation in my bot

small tangle
#

nah music is the universal language 🎢 peepoHappy

lone wing
#

there just seems to be something ever so slightly off

#

i fixed it a while ago it's just funny

earnest phoenix
lone wing
earnest phoenix
lone wing
#

i used kotlin for some reason

earnest phoenix
#

Bruh what?
Idk then
I just tried to help

lone wing
earnest phoenix
#

Lmao didn't see that

lone wing
#

np

sharp geyser
#

@round cove you remember that i18n library I was making? Should I update it at all? I was thinking of making an adjustment so that it looks for json files that are like en-US.translate.json so it doesn't try to pick up random json files

#

it'd be a small matter to code but I think it'd be nice to add

round cove
#

Sure update it. Might as well if you noticed potential issue.

lyric mountain
#

json πŸ˜”

sharp geyser
#

I was thinking of supporting multiple formats

lyric mountain
#

both have the advantages of not needing to be parsed to be read from

sharp geyser
#

yaml parser would be fun to make

sharp geyser
lyric mountain
#

not really, you can navigate without parsing the whole thing

#
toplevel:
  key1: avalue
  foo: bar
  morelevel:
    hello: world
  ghi: example
  alevel: null
#

a more palpable example: ```yaml
commands:
ping: Ping
say: Say
8ball: 8 Ball
errors:
no_perm: I don't have enough permissions
blacklisted: You are blacklisted

#

then just iterate over top-level keys, when you find the category you're looking for simply go "inside" it

#

ofc you'll want a cache layer so you dont have to stream the file everytime

sharp geyser
#

Also aren't yaml parsers essentially just reading the file and parsing it into json?

earnest phoenix
#

yaml slow πŸ‘Ž

lyric mountain
#

the trick is that you're not parsing the whole file into memory, but reading the lines directly

#

u cant do the same with json

neon leaf
#

whats the best way to mass insert data / update it if it exists in postgres?
I have this json:

  Hello: 99,
  Hi: 22,
  Bye: 77
}```
In my case they are over 10000 keys long though so I cant insert for every one at a time
This is my table:
`word - occurences`
so whats the best way? (node pg)
lyric mountain
#
INSERT INTO tbl (a, b, c, d) VALUES
(1, 'A', true, 0.5),
(1, 'A', true, 0.5),
(1, 'A', true, 0.5),
(1, 'A', true, 0.5),
(1, 'A', true, 0.5),
(1, 'A', true, 0.5),
(1, 'A', true, 0.5),
...
neon leaf
#

I actually already do that but I dont know how to make it sql injection safe

lyric mountain
#

well, then u have to insert one by one

#

since you cant use params with batch insert

neon leaf
#

would that be a big performance hit? the database is on the same server, aka ~0.005ms ping

lyric mountain
#

databases doesn't care about measly 10k inserts

#

just use a transaction so you don't happen to interfere with ongoing requests

earnest phoenix
#

BULK INSERT krShrug

lyric mountain
#

they need params

#

also is BULK even a valid keyword?

earnest phoenix
#

Forgot pg sucks even more than mysql

#

COPY seems to be the naming they use for it

lyric mountain
#

nah not really, postgres does have COPY for bulk inserting data, but they specifically asked for "sql injection safe"

lyric mountain
#

but with bulk ops u cant use params, so it's better to simply write individual parameterized inserts

earnest phoenix
#

Unsure why someone would want to bulk insert sqli safe

#

Doesn't really make sense to bulk insert that much things at once, unless that data is given by the user

#

In that case a dos would be much more of a complication than your sqli

earnest phoenix
#

Yeah then a dos is possible on your dbms krShrug

#

Which is not ideal

#

Someone could give your application millions of values to insert

neon leaf
#

its regulated

#

no more than 10k words will be processed every 10min

lyric mountain
earnest phoenix
#

Process 10k, then it's down for 10 minutes

neon leaf
#

it does wait, why would I process everything at once in 10min

earnest phoenix
#

Repeat that indefinitely and you know

lyric mountain
#

give an user a single checkbox and they'll manage to crash the whole server cluster

#

never trust users, never trust what they input

earnest phoenix
#

Nonetheless if you want sqli safe, you'd need to insert them one by one

neon leaf
earnest phoenix
#

So people can give as many input they want and it will be saved and inserted every 10 minutes

neon leaf
#

no

#

it isnt an input field or sum

earnest phoenix
#

But...?

neon leaf
#

old data I have lying around that I want to analyze

#

aka what words are used the most in letters

lyric mountain
#

so it's just data migration?

#

nvm

earnest phoenix
#

Yeah then why not just insert everything directly?

neon leaf
#

wdym? like insert every request directly, not on a crontab?

earnest phoenix
#

Like insert your entire data you already have

neon leaf
#

cuz its way too much

earnest phoenix
#

So?

lyric mountain
#

define "too much"

earnest phoenix
#

Yeah that's the thing

lyric mountain
#

unless u have more than 200m, don't worry about it

earnest phoenix
#

Databases are made to process lots of data

earnest phoenix
lyric mountain
#

also first time I'm seeing a database that's made specifically for timelines

earnest phoenix
#

Not like some softwares take an entire night or more to build

lyric mountain
#

timescaledb

lyric mountain
earnest phoenix
boreal iron
#

Just took a week to be generated with ~96GB RAM allocated

wheat mesa
#

What should I work on, I lowkey want to learn a new topic/language

#

machine learning is cool but seems like a lot of setup work

#

I've been looking into embedded dev but I don't really have any supplies for that atm

languid raft
#

how would I go around this in javascript

high bronze
#

no arabic bot ?

slim heart
#

either host the image urself, create a chain request "proxy", or if u control that domain add whatever domain ur on to that list

lament rock
languid raft
earnest phoenix
#

If you own the domain/server where the code is hosted, add the domain you've hidden to the list in the Content-Security-Policy to allow it just, like *.cloudfront.net *.google-analytics.com *.kaptcha.com ... but with *.domain.xyz

#

If you simply use the website and try to embed/display a picture on that website; you cannot do anything about it. You have no control over the header. Contact the support of the concerned website to get more information how you could embed/display your picture on their site.

green kestrel
#

new gpu came!

#

so yeah uh this will.... help me make bots better? kekeke

lyric mountain
#

plot twist: the fan has no leds

green kestrel
#

yeah lol just spinning so fast its white hot?

wheat mesa
solemn latch
viral badge
#

mod alert

boreal iron
lament rock
#

nothing hits harder than realizing light sources in games are using real power to emit light

green kestrel
#

but we will see after I game with it for a few hours!

#

the case is mesh on 3 sides, really good airflow and doesn't heat up much

sharp geyser
#

@radiant kraken solid pretty solid

#

I love how they handle control flows

#

for loop to do stuff with an array of items is literally just

<For each={someArray}>
 {(item) => <div>{item}</div>}
</For>

and in case it doesn't loop through it all immediately you can add a fallback

#

this lowkey kinda cool as well

radiant kraken
earnest phoenix
#

my bot keeps going off ☠️

#

but i have something hosting

#

it keeps going off ever 5 minutes or sum

#

my bots never did that before

sharp geyser
#

More so I can practice web dev tbh but also cause I’m just that bored

radiant kraken
#

but its not written in solid

#

:)

sharp geyser
lament rock
sharp geyser
dry imp
#

good one

crystal wigeon
#

hey has anyone used stripe?

#

does the card payments decline if no shipping address is provided?

crystal wigeon
#

do_not_honor this is the error im getting mmmm

#

ig nothing much i can do from my end on stripe??

#

is it possible the website is being flagged by the bank?? how would i verify such things

civic scroll
quartz kindle
#

i cant get used to react-like syntaxes, it just looks so weird

#

solid looks good af on paper but i really dislike its syntax

#

svelte feels so much better to use

lyric mountain
#

is it possible to exclude an specific character from a regex group?

#

for example, I want the calc group to not include $ in it

#

but $ is important to identify where type is

#

ik I can simply replace that after matching, but was wondering if there's a regex way of not including it

latent anvil
#

Hello

#

@harsh nova

harsh nova
#

Sup

latent anvil
#

Can you please tell how to become bot developer and what is needed?

quartz kindle
#

make a bot

earnest phoenix
#

and have it approved

crystal wigeon
#

has anyone never used stripe??

earnest phoenix
#

yep, not yet but soonℒ️

latent anvil
lyric mountain
#

that'll not make a capture group, but it'll still include in the enclosing group

lament rock
#

Put it before the capture group or make the main group non capturing and do not capture $

#

something like (?:$([^somecharsnottocapture]))

lyric mountain
#

I solved this already by simply replacing the character, I don't think there's a way to solve that with regex without resorting to huge reg string

crystal wigeon
# latent anvil i

do you know how i can pass billing_details to payment intent? while creating payment intent

slender wagon
#
pg.query("SELECT $1 FROM premium", [intgId], (err, res) => {

so when i do this the result is way too big
loging the result

#

is there a way more forward to this

lyric mountain
#

I mean, it is valid, but it isn't returning what u expect

#

SELECT 1 FROM anything will always return 1

#

SELECT 'Goat' FROM cars will always return Goat

#

whatever u put after SELECT will be what columns you want to retrieve, not the condition

slender wagon
#

basically all i am trying to do is to see if the intgId exists or not

lyric mountain
#

SELECT 1 FROM premium WHERE id = $1

#

then just check the amount of rows returned

slender wagon
#

ohh let me see

#
null Result {
  command: 'SELECT',
  rowAsArray: false
}
``` log when it doesn't exist
#
null Result {
  command: 'SELECT',
  rowCount: 1,
  oid: null,
  rows: [ { '?column?': 1 } ],
  fields: [
    Field {
      name: '?column?',
      tableID: 0,
      columnID: 0,
      dataTypeID: 23,
      dataTypeSize: 4,
      dataTypeModifier: -1,
      format: 'text'
    }
  ],
``` log when it exists
lament rock
#

just check rowCount

slender wagon
#

yeah but

#

isn't there a better way

lament rock
#

to see if a row exists?

slender wagon
#

to see if this item actually exists

#

this id

lament rock
#

That is the way

#

booleans don't really exist in pg so not like you can get a boolean promise or anything unless the wrapper abstracts stuff for you

slender wagon
#

fine then i'll just go with it

#

res.rowCount it is

quartz kindle
lyric mountain
#

πŸ˜”

slender wagon
#

uhhh i found out something about the discriminator

#

if u got a 0 before the other numbers it wont count it

lament rock
#

they're strings for a reason

slender wagon
#

oh lol

lyric mountain
#

what is a good formula for biasing a random generator towards one of the sides?

#

I currently use rng ^ bias, where the lower the bias is, the closer to 1 it rolls

#

but idk if this is a good formula for that

slender wagon
#

what's the best way to store an email on postgres

earnest phoenix
#

okay i have a problem, Replit...It keeps saying its booting and i wait for minutes...Then my bot goes offline for a while after i hosted it on uptimer Joe_Sad

#

then it keeps doing this

slender wagon
#

replit is not made for bot hosting

earnest phoenix
#

what can i host with?

#

im on a chromebook rn

slender wagon
#

if you gonna buy a vps it doesn't matter what u are using rn

earnest phoenix
#

vps?

slender wagon
#

Virtual Private Server

solemn latch
#

I think replit has a lot of issues these days

earnest phoenix
#

damn

solemn latch
#

I just was playing around with it and with zero instances running my cpu usage would max out

earnest phoenix
#

and hey woo

slender wagon
earnest phoenix
#

its me upcoming/rug

#

🀝

solemn latch
#

doggowave Hi ^_^

earnest phoenix
#

hru?

solemn latch
#

You know, living life. hbu?

earnest phoenix
#

same thing man. its nice seeing you again

lyric mountain
dim vault
#

could someone help me through this why it doesnt delete the temp channel when all the members leave?

#

even when i am using oldstate

earnest phoenix
dim vault
#

the latest

#

v14 and nodejs v16 with npm v8

#

i have gone through documentation. stackoverflow already answered questions and still nothing works

earnest phoenix
#

Have you tried logging the value of state.channel.members.size and see if it's the expected value?

dim vault
#

yes , on both state and oldstate it logs out either 0 or null, there is a inconsistency

earnest phoenix
#

Please log all 3 of state.channelId, wfschannel.id, and state.channel.members.size all at once and show us the values

dim vault
#

just did

opaque acorn
#

ytdl-core stopped working?

#

none of my bots work

#

pulls me an error

earnest phoenix
earnest phoenix
opaque acorn
#
evalmachine.<anonymous>:1
;var Xua=function(a){a=a.split("");MC["if"](a,71);MC.pn(a,3);MC.QO(a,27);MC.pn(a,2);MC["if"](a,36);MC.QO(a,14);MC.pn(a,3);MC.QO(a,68);MC.pn(a,3);return a.join("")};Xua(sig);
                                   ^

ReferenceError: MC is not defined
dim vault
opaque acorn
#

from ytdl dependency

earnest phoenix
opaque acorn
#

yesterday it was still working good

earnest phoenix
dim vault
#

yes but when i change it to oldstate.channel.members.size it throws me the following error:

node:events:491
      throw er; // Unhandled 'error' event
      ^

TypeError: Cannot read properties of null (reading 'members')
    at WFSevent.run (C:\Users\devel\Documents\GitHub\DevLight\events\waitingfor\wfs.js:33:42)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Emitted 'error' event on Client instance at:
    at emitUnhandledRejectionOrErr (node:events:394:10)
    at processTicksAndRejections (node:internal/process/task_queues:85:21)
[nodemon] app crashed - waiting for file changes before starting...
opaque acorn
#

its ytdl-core

#

i show you full error

#
evalmachine.<anonymous>:1
;var Xua=function(a){a=a.split("");MC["if"](a,71);MC.pn(a,3);MC.QO(a,27);MC.pn(a,2);MC["if"](a,36);MC.QO(a,14);MC.pn(a,3);MC.QO(a,68);MC.pn(a,3);return a.join("")};Xua(sig);
                                   ^

ReferenceError: MC is not defined
    at Xua (evalmachine.<anonymous>:1:36)
    at evalmachine.<anonymous>:1:165
    at Script.runInContext (node:vm:139:12)
    at Script.runInNewContext (node:vm:144:17)
    at decipher (/home/runner/evobot/node_modules/ytdl-core/lib/sig.js:88:22)
    at Object.exports.setDownloadURL (/home/runner/evobot/node_modules/ytdl-core/lib/sig.js:100:31)
    at /home/runner/evobot/node_modules/ytdl-core/lib/sig.js:118:13
    at Array.forEach (<anonymous>)
    at Object.exports.decipherFormats (/home/runner/evobot/node_modules/ytdl-core/lib/sig.js:117:11)
    at runMicrotasks (<anonymous>)
earnest phoenix
# opaque acorn its ytdl-core

The evalmachine in the error stacktrace indicates that you're evaluating code by calling the global eval() function, or running code with the node:vm built-in module, what code are you running?

surreal sage
#

I'm using the NodeJS "events" module
And it's returning {} as error, nothing more nothing less

earnest phoenix
surreal sage
#

req.body is a string

dim vault
#

i have built the same thing over the past 3 versions of discord.js and none of them behaved like that

surreal sage
#

possibly?

#

(client event)

earnest phoenix
#

By checking the amount of members in the new voice state, if the bot is the only one in the voice channel then delete it

surreal sage
dim vault
earnest phoenix
#

Or if the bot isn't in the voice channel and nobody is in there, then also delete it, the members property is a collection that includes all of the guild members in the said voice channel, which you can check

earnest phoenix
surreal sage
#

As in?

dim vault
earnest phoenix
# surreal sage As in?

You said the event that is being emitted is the correct one and is being actively listened to, in order to listen to the event you'd have an event listener, and that is?

solemn latch
#

if theres the bot in the channel theres not less than 1 member.

dim vault
surreal sage
#

As in, the event emitter is undefined

#

forgot to update a require()

solemn latch
dim vault
earnest phoenix
#

That's correct...?

solemn latch
#

yeah that sounds right to me

#

1 person in the channel

dim vault
#

yes i know, but the thing is i need to check the channel after the user/users disconnected from it

solemn latch
#

Dont worry about what it logs when you join, only when you leave.

dim vault
#

when i leave it logs nothing

solemn latch
#

is the log in the if statement?

dim vault
#

no

#

outside

solemn latch
#

move it to the top of the event

earnest phoenix
#

Can you show us the entire code maybe?

solemn latch
#

yeah that might help

dim vault
#
let guild = await WFS.findOne({ guildid: state.guild.id })
        if (guild) {
            let channel = await oldstate.guild.channels.fetch(guild.channelid)
            const { member } = oldstate
            if(!(state.channelId == channel)) return
            let wfschannel = await state.guild.channels.create({
                name: `Join to create - ${state.member.user.tag}`,
                type: ChannelType.GuildVoice,
                parent: channel.parentId,
                permissionOverwrites: [
                    {
                        id: state.member.id,
                        allow: [PermissionFlagsBits.ViewChannel]
                    },
                    {
                        id: guild.adminrole,
                        allow: [PermissionFlagsBits.ViewChannel, PermissionFlagsBits.MuteMembers, PermissionFlagsBits.MoveMembers]
                    }
                ]
            })
            member.voice.setChannel(wfschannel.id)
            console.log(state.members.size)
            if(state.channelId === wfschannel.id && state.members.size < 1){
                wfschannel.delete()
            }
        }```
#

thats the code

#

for the time being, i am stuck on that specific thing

earnest phoenix
#

So that's the code inside the voiceStateUpdate event you're listening to?

dim vault
#

yes

#
module.exports = class WFSevent extends BaseEvent {
    constructor() {
        super("voiceStateUpdate")
    }

    async run(client, oldstate, state) {

        let guild = await WFS.findOne({ guildid: state.guild.id })
        if (guild) {
            let channel = await oldstate.guild.channels.fetch(guild.channelid)
            const { member } = oldstate
            if(!(state.channelId == channel)) return
            let wfschannel = await state.guild.channels.create({
                name: `Join to create - ${state.member.user.tag}`,
                type: ChannelType.GuildVoice,
                parent: channel.parentId,
                permissionOverwrites: [
                    {
                        id: state.member.id,
                        allow: [PermissionFlagsBits.ViewChannel]
                    },
                    {
                        id: guild.adminrole,
                        allow: [PermissionFlagsBits.ViewChannel, PermissionFlagsBits.MuteMembers, PermissionFlagsBits.MoveMembers]
                    }
                ]
            })
            member.voice.setChannel(wfschannel.id)
            console.log(state.channel.members.size)
            if(state.channelId === wfschannel.id && state.channel.members.size < 1){
                wfschannel.delete()
            }
        }

    }
}
#

the full event

solemn latch
#

state.members isnt a thing is it?

earnest phoenix
#

It isn't

solemn latch
dim vault
#

yes i was changing some things and i wrote it wrong rn

#

it was state.channel.members.size

#

corrected it on the snipset

earnest phoenix
#

Oh I see what's wrong here

#
let channel = await oldstate.guild.channels.fetch(guild.channelid)
            const { member } = oldstate
            if(!(state.channelId == channel)) return

You're comparing a string to an object, which'll never be true

dim vault
#

but it doesnt throw error there and it passes on?

earnest phoenix
#

It won't throw an error, you're simply just returning

dim vault
#

still same behavior

#

and if i remove this statement then it will just create channels for ever

#

it indicates if the channel (Join to create) is the one to join and create a private channel, otherwise just dont run the rest of the code

earnest phoenix
#

Oh wait I overlooked and didn't realize that you were using the non-strict equality operator, which will call the toString() method of the channel instance when compared with a string

#

That part isn't the issue as it seems, but you still shouldn't compare them like that

dim vault
#

yea but it is and was working but still is bad practice, thanks

#

so what is the problem that doesnt delete the channel?

earnest phoenix
#

Before continuing, please resolve your promises first

dim vault
#

the toString() you mean?

#

already changed it

earnest phoenix
#

Both of the member.voice.setChannel() and wfschannel.delete() methods return a promise, resolve them

#

You should use the await keyword in this case

dim vault
#

i logged them too and still nothing changed, the member.voicel.setChannel() it returns the member,the user and the voice options

earnest phoenix
#

I didn't tell you to log them, also the logic in your code doesn't even make sense because you're moving the member to the channel, and checking if the said channel contains 0 members which'll never be the case because you literally just moved the member to that channel

solemn latch
#

πŸ‘€ wait, that logs, but state.channel.members.size doesnt?

#

(on leave)

dim vault
#

I am moving the member to the channel and I want to check when the user disconnects to delete the channel automatically

earnest phoenix
#

You're supposed to check that before moving the member to the channel

dim vault
#

It is logging only when the member joins/moves to the channel , not when leaving and that's what i am trying to fix, i used a Interval and it worked for just a time and then just tries to delete a already deleted channel

earnest phoenix
#

Because when the user leaves the channel your code won't get to the part you're trying to check, you're supposed to check this right at the start of the event listener

dim vault
#

I will try that and will update you on that in a bit

dim vault
solemn latch
#

πŸ€” so this returns
if(!(state.channelId == channel.id)) return
if the channel in the new state isnt the channel the guild has configured right?

Therefore all code below will not run if its not that one channel correct?

dim vault
#

yes, when i join in another channel other than the configured one in mongodb it does nothing

#

it just stops there

solemn latch
#

So, the channel you just created, anyone joining or leaving it will also return and stop running the code right?

#

anything below line 12 will never run if someone leaves a channel you just created.

#

because its not that channel configured in your database.

dim vault
#

maybe that's the problem? But the thing is , if i am not checking for this channel it won't create the new channel and will do nothing but maybe this will be the reason that doesn't run the rest of the code the moment i am getting moved, but, when I set an Interval every 3 seconds after I am getting moved the channel would be deleted when I leave from it but it will be delete for ever resulting in a discord api error "Cannot delete unknown channel"

solemn latch
#

You shouldnt be using an interval here at all

dim vault
#

I know but i wanted to see the behavior that it would have

solemn latch
#

I think you're missing some fundamental parts to make something like this work without using timers.
Which I assume is what Voltrex is typing now.

dim vault
#

it was just for testing if anything would change the interval

earnest phoenix
# dim vault Moved it right after the channel creation and before the member moving and still...

That's not what I meant, you're supposed to do it right at the start and you'll have access to the channel the member is in:

// Get guild data from database.
const guild = await WFS.findOne({
  guildid: state.guild.id
});

// If the guild isn't found, return.
if (guild === null) return;

// Fetch the configured channel in guild.
const channel = await state.guild.channels
  .fetch(guild.channelid)
  .catch(() => null);

// If it doesn't exist, return.
if (channel === null) return;

if (
  // If the ID of the member's voice channel doesn't equal to the main voice channel
  state.channelId !== channel.id &&
  // And the amount of members in the voice channel is 0
  state.channel.members.size === 0
)
  // Then delete the voice channel.
  await state.channel.delete();
#

Basic logic

#

Since all the voice channels you create are the ones separate from the main voice channel, you can assume that it's a channel created by the bot and can be deleted

#

Or if you want to be more careful, you can use a regex to check the names of the voice channels, and if it matches the name pattern the bot uses to create the channels, you can delete it

solemn latch
#

I would recommend using names, but you can also store channels created for this purpose in a map, and check that map before deleting.

Just another option

dim vault
#

right when i leave i get this error

earnest phoenix
#

Show the new code

#

Or have you not changed anything?

dim vault
earnest phoenix
#

What's at line 17?

dim vault
#

i am just getting the member object from the voiceState so i can move the user there

#

after formatting the code the error is on line 16

solemn latch
dim vault
earnest phoenix
#

It seems like state.channel is null

spark pilot
#

distube is broken for me anyone else have an issue

#

or know how to fix it

dim vault
earnest phoenix
dim vault
#

those

quartz kindle
#

is state a voice state?

dim vault
quartz kindle
#

state.channel only exists if the bot is connected, it doesnt exist if the bot is disconnected or leaves

dim vault
#

the bot doesnt connect at all

#

is a join to create channel

earnest phoenix
#

If state.channel is null that means the member is no longer in the voice channel

dim vault
#

so we must check when it turns null in order to delete the channel

quartz kindle
#

but you also have to check for the existance of a channel