#development

1 messages Ā· Page 47 of 1

boreal iron
#

well looks like it's running

#

the error regarding the clipboard can basically be ignored

#

you can copy the address yourself

eternal osprey
#

if you have any code ready, send it to me and i'll test it out and send the results

queen needle
#

Couldn't you just use a spiral like solution?

quasi depot
#

and there is no errors.

eternal osprey
#

any help is appreciated tho so i am willing to try anything at this point, It should be handed in in exactly 2 hours

#

😭

queen needle
#

go straight until wall, placing a ball everytime, when you hit a wall turn and repeat, but also check if you are hitting a ball or a wall if so turn, then it'll create a spiral leading you to the middle

#

Unless I'm forgetting something wouldn't that work?

eternal osprey
#

this might work. If it is, i will kiss you on your cheeks pancake

#

nah but fr i ma paypal you then

boreal iron
#

@eternal ospreytry that to fill up X please

#

the last result should be the ball turning down, walking downwards

#

keep in mind idk cpp

#
void turn_ball()
{
    turn_right();
    
    if(north())
    {
        turn_left();
        turn_left();
        turn_left();
    }
    else
    {
        turn_right();
    }
}

void check_wall()
{
    while(!on_ball())
    {
        if(!in_front_of_wall())
        {
            step();
        }
        else
        {
            put_ball();
        }
    }
}

void check_ball()
{
    while(on_ball())
    {
        turn_ball();
        
        step();
        
        if(!on_ball())
        {
            put_ball();
            step();
            
            if(on_ball())
            {
                turn_ball();
                step();
                turn_right();
                step();
            }
        }
    }
}

void find_center_agent()
{
    while(true)
    {
        check_wall();
        check_ball();
    }
}
#

make a video

#

im trying to reproduce the steps on my paper but it's pain

#

unexpected behavior can be expected

quartz kindle
#

expecto the unexpectum

quasi depot
#

you should host this web for me

boreal iron
#

this doesn't stop the ball YET when being in the middle

#

just to say

#

it will continue to run endlessly

eternal osprey
#

I am so fucking close

#

i just need to know a method to stop

quartz kindle
#

you're circling all around?

eternal osprey
boreal iron
#

try mines please

quartz kindle
#

there shouldnt be a need to circle all around

eternal osprey
#

Oki let me try!

boreal iron
#

I have a way to stop the ball

#

that's why the function turn ball exists

#

soon when being on a ball a facing north the cursor will go back and end the code

#

but I need to make sure if the rest works

#

it should fill the x axis, end in the middle, go down, fill y axis, end in the middle, to should go to the right doing the same

#

which I need to get rid of

#

(the last part)

eternal osprey
#

Owh damn wtf it almost worked yeah!

boreal iron
#

ik I JUST NEED A VIDEO

eternal osprey
#

alr

#

one sec

boreal iron
#

fine, exactly how I mentioned

#

great

cinder patio
#

in all directions

boreal iron
#

ok i will finish it real quick

eternal osprey
boreal iron
#

can you actually return a function?

#

without value?

#

@eternal osprey

#

nvm i found the issue

#

and probably the solution

eternal osprey
#

owh i see

eternal osprey
#

i hope that next fucking lessons we will be diving into real c++ instead of this fucking dumb goofy ass project

lament rock
#

I think the takeaway is that some projects have special restrictions even in the real world and you have to work around those restrictions to problem solve in a possibly more efficient way than previously thought

#

having no return kinda sucks but like

boreal iron
#

ok the endless loop was the issue

#

since we can't break it

boreal iron
# eternal osprey owh i see
void turn_ball()
{
    turn_right();
    
    if(north())
    {
        turn_left();
        turn_left();
        turn_left();
    }
    else
    {
        turn_right();
    }
}

void check_wall()
{
    while(!on_ball())
    {
        if(!in_front_of_wall())
        {
            step();
        }
        else
        {
            put_ball();
            check_ball();
        }
    }
}

void check_ball()
{
    while(on_ball())
    {
        turn_ball();
        
        step();
        
        if(!on_ball())
        {
            put_ball();
            step();
            
            if(!on_ball())
            {
                check_wall();
            }
            else
            {
                if(north())
                {
                    turn_ball();
                    step();
                    turn_ball();
                    get_ball();
                }
                else
                {
                    turn_ball();
                    step();
                    turn_right();
                    step();
                }
            }
        }
    }
}

void find_center_agent()
{
    check_wall();
    
    if(!on_ball())
    {
        check_wall();
    }
}
#

now check this please

#

video

#

it should end up in the middle facing the north, removing the center ball

#

to break the loop

#

@eternal osprey

#

expecto the unexpectum

eternal osprey
#

yes daddy

#

i mean

#

fake

boreal iron
#

it works?

#

oh may i forgot somethhing

#

updated the code block @eternal osprey

#

test it now!

eternal osprey
#

it works mate

#

danggg

#

thank you very fucking much

#

let me paypal you for your effort lmao

boreal iron
#

wait it can't work

eternal osprey
#

it does

cinder patio
#

ur teacher should get fired

#

this teaches absolutely nothing

boreal iron
#

the updated one or pre-updated one?

eternal osprey
#

the pre updated one

boreal iron
#

i dont think we need the turn ball function as I did before

#
void turn_ball()
{
    turn_right();
    turn_right();
}

void check_ball()
{
    while(on_ball())
    {
        turn_ball();
        
        step();
        
        if(!on_ball())
        {
            put_ball();
            step();
            
            if(!on_ball())
            {
                check_wall();
            }
            else
            {
                if(north())
                {
                    turn_ball();
                    step();
                    turn_ball();
                    get_ball();
                }
                else
                {
                    turn_ball();
                    step();
                    turn_right();
                    step();
                    check_wall();
                }
            }
        }
    }
}

void check_wall()
{
    while(!on_ball())
    {
        if(!in_front_of_wall())
        {
            step();
            check_ball();
        }
        else
        {
            put_ball();
            check_ball();
        }
    }
}

void find_center_agent()
{
    check_wall();
}
#

test that, please... be so kind

quartz kindle
#

spoonfeed šŸ„„ 🄣 mmLol

boreal iron
#

well that triggered me

boreal iron
quartz kindle
#

the classic hire then ghost strategy

#

make my website for me, i promise i wont ghost you :^)

boreal iron
#

my skills making a website are... well, lets say im not the best designer

quartz kindle
#

ghosted

boreal iron
#

I mean I'm not the worse as well but still

boreal iron
#

how about light mode

quasi depot
boreal iron
#

including the legendary feature discord added recently, others including me already have for like 10y now

quasi depot
#

I am here having trouble hosting a open source website and your here coding it

boreal iron
#

wut

eternal osprey
#

i didn't fucking host anyone

#

I was packing up my things for tomorrow morning

boreal iron
#

try the last code block I mentioned, please

eternal osprey
#

okay i will!

#

One sec

wheat mesa
#

not the place to ask to hire devs/hosts

boreal iron
#

with a record pls

#

wanna see something

quasi depot
boreal iron
rocky dagger
#

is there a way to get the message id of the original message by pressing the "leave giveaway" button?

boreal iron
#

the message property of the button interaction should contain the original id property

eternal osprey
boreal iron
#

no I'm wrong

#

you actually need to fetch the message

rocky dagger
#

that doesnt work if its ephemeral tho does it?

boreal iron
#

the first one isn't an ephermal one, right?

rocky dagger
#

but how do i know thats the message it replied to

#

could be more messages

boreal iron
#

you set a custom ID of the button

rocky dagger
#

yes

boreal iron
#

so fetching the original should be: let original_message = await interaction.webhook.fetchMessage("@original");

#

when pressing your red button

#

and receiving the button interaction

eternal osprey
#

@boreal iron it returned me too many errors

boreal iron
#

you then know which giveaway it was attached to

#

HUH WHAT

eternal osprey
#

so the function check_wall used function check ball

#

while check ball used check_wall

#

so i must place one function on top of the other, but as they both require each other i cannot

#

else it gives an undefined error

#

the function cannot be called before it's defined

boreal iron
#

ahh ohh

#

stupid c++

rocky dagger
boreal iron
#

that's the result when pressing the red button?

#

you're sure the interaction is the button interaction and nothing else?

boreal iron
boreal iron
#

it should now be defined before getting called

#

if not moving all functions into find_center_agent() and call check_wall() after should work then

quartz kindle
boreal iron
#

idk cpp

boreal iron
quartz kindle
rocky dagger
# boreal iron please provide the code for me
const Giveaway = require('../../schemas/giveaway');

module.exports = {
    data: {
        name: 'leave',
    },
    async execute(interaction, client, colors) {
        let original_message = await interaction.webhook.fetchMessage("@original");
        console.log(original_message)
        const giveawayProfile = await client.createGiveaway({
            giveawayID: interaction.message.interaction.id,
        });

        try {
            await Giveaway.updateOne(
                { giveawayID: interaction.message.interaction.id },
                { $pull: { entrances: interaction.user.id } }
            );

            interaction.edit({
                embeds: {
                    description: 'You successfully left the giveaway',
                },
                ephemeral: true,
            });
        } catch (error) {
            console.log(error);
        }
    },
};
rocky dagger
quartz kindle
#

it should, since its the button interaction that counts

#

and the ephemeral is a follow up, isnt it?

boreal iron
#

yes

quartz kindle
#

the original reply is the giveaway message

#

or not?

boreal iron
#

huh tf

#
  fetchReply() {
    return this.webhook.fetchMessage('@original');
  }
quartz kindle
#

lmao

boreal iron
#

interaction.webhook.fetchMessage("@original");

#

why should that return an error then

quartz kindle
#

then the ephemeral is not a followup

boreal iron
#

according his screenshot it should be

quartz kindle
#

looking at it again, it doesnt look like it is

#

the user presses the enter button

#

the ephemeral is a direct response to the enter button

rocky dagger
quartz kindle
#

so then you have to use a customID in the leave button

boreal iron
#

it's a follow up message as response to his slash command interaction

quartz kindle
#

that links with the correct giveaway in your database

boreal iron
#

wait I see what u mean

#

it's not a follow up message

#

the giveaway embed is normal message and no interaction response

#

im no confused it says "click to see command"

#

do you send the ephermal message when pressing the enter button or after executing a command?

rocky dagger
rocky dagger
boreal iron
#

You’re screenshot is confusing

#

It should say you entered the giveaway or you’re already in in an embed and show the button after

#

But according to the discord ui it looks like a slash command interaction response

rocky dagger
#

i realized i had writen embed instead of embeds so here is what it should look like

boreal iron
#

Wtf

#

Click to see command

#

The ui is confusing as fuck

rocky dagger
#

whats confusing about it?

boreal iron
#

Because you didn’t execute any command

#

You clicked the enter button

#

And replied with an ephemeral message

rocky dagger
#

the first embed is executed by a command and the second is sent by a button

lyric mountain
#

regarding that, how will the user leave the giveaway after they close the client?

boreal iron
#

When I press a button my discord ui shows

#

That’s what makes it confusing for me

boreal iron
#

Man I’m close to freak out

lyric mountain
boreal iron
#

Does your giveaway command response show that it’s an interaction response?

rocky dagger
boreal iron
#

Like this?

rocky dagger
boreal iron
#

AHHH

#

Why did you cut that off before

#

My gosh

rocky dagger
#

idk

onyx axle
#

Hi, could someone help me solve a problem with my bot?

#

It is giving error 50001 missing access

boreal iron
#

I wonder

boreal iron
#

So when awaiting your promises and catching errors you will know where the error is coming from exactly

rocky dagger
onyx axle
quartz kindle
onyx axle
quartz kindle
#

for example custom_id: 'leave-${giveaway_ID_from_your_database}'

boreal iron
#

No

#

It has the reference of the original giveaway message

#

It’s the ID he stores on the database

quartz kindle
#

yeah but you dont really need that message

boreal iron
#

Idk if that’s new to djs

#

But message.reference is your message id

quartz kindle
#

you would only fetch it to identify the giveaway anyway

rocky dagger
quartz kindle
#

you dont need to

boreal iron
quartz kindle
#

the original message that has the enter and rewards buttons does not need to be edited

boreal iron
#

Dunno since when reference exists

#

Never saw it before

quartz kindle
#

so if you have the giveaway id in the leave button, you can use it to access your database directly, bypassing the need to fetch the original message

boreal iron
#

He doesn’t need to fetch any message

#

He has the message id and reference message id (original giveaway message id) when pressing the button

#

That seems to be the ID he stored in his database

#

As reference to the giveaway

rocky dagger
#

tysm

boreal iron
#

Tbh never seen the reference property before

boreal iron
#

Incl a message he has already entered the giveaway

#

I mean he could add leave to the giveaway as button

#

Which would make his life easier

lyric mountain
boreal iron
#

Since enter also checks if he’s already in, leave could be added to performing the same check

boreal iron
#

Im filtering them by their command name or custom id, too to execute the appropriate (cached) code

#

I mean I could also extend the handler by filtering the custom id splitting it by a - or _ for example

#

But yeah static names make more sense

#

Discord actually gives you the reference of the message when presssing the butting anyways

ancient nova
#

I just googled gta 6 leak and got gore 😐

lyric mountain
#

well what did u expect lmao

boreal iron
#

gore?

lyric mountain
#

it's either that or Sernando

boreal iron
#

tf

#

Stop using your slang words nobody knows

lyric mountain
#

sernando is the guy who "got" gta 6...4 years ago

#

5 actually

ancient nova
#

nah I acc got some weird gore video

#

idk if I can send a pic

#

😐

#

on youtube

boreal iron
#

I read something about a leak in another discord server and was confused

lyric mountain
#

nah better not

boreal iron
#

Thought it’s already out for years

ancient nova
boreal iron
#

Isn’t 5 already 10y or older

ancient nova
#

but gta 6 actually was leaked today

#

that's y I was looking

boreal iron
#

No a video looked like a dev build with unfinished chars and graphics robbing a Burger King

ancient nova
#

source code and gameplay videos

boreal iron
#

Or something like that

ancient nova
#

and a couple missions

lyric mountain
#

gta 6 will probably not be released within the next 5 years

ancient nova
#

as wells as 2 protags

lyric mountain
#

gta 5 gives rockstar way too much money

#

they'll milk it until dead

boreal iron
#

Which can also be one of the 5 dev videos tbh

ancient nova
boreal iron
#

*5th

ancient nova
#

youtube is fucked up

ancient nova
quaint rampart
#

so

#

is there any way around it?

#

get a 403

#

from cloudflare

ancient nova
#

use a proxy

quaint rampart
#

tried cors-anywhere

#

same thing

#

even just a normal vpn on my local machine blocks it

lyric mountain
#

u cant access that endpoint

quaint rampart
#

yeah ik thats why im confused why its a 403

#

but

#

i only get it on my vps?

#

not on my pc

#

doesnt make sense

#

thats the only thing that makes sense

#

riot prolly fucked up the codes

lyric mountain
#

probably wrong scope or token

quaint rampart
#

nope

#

same exact code

#

sme exact every sngle thing

lyric mountain
#

then there's that:

quaint rampart
#

checked it 40 times

lyric mountain
#

is the redirect uri acessible anywhere?

#

and is it the same as the one defined in ur developer panel?

quaint rampart
#

thgis is public api request

#

no panel

#

needed

#

or

#

key

#

or antyhing

lyric mountain
#

riot is shit at balancing and making clients, but I don't think the api is broken

quaint rampart
#

that code

#

is supposed to have a cookie along with it

#

that cookie

#

is needed

#

to save

#

user profile

lyric mountain
#

why do you

#

type

#

like

#

this

quaint rampart
#

idk

#

LOL

wheat mesa
#

linebreak issues

quaint rampart
#

but yheah i need to make that request so people can log on the bot

#

they provide their cookie and its supposed to get some info off of it

#

works completely fine on local machine

#

ctrl c ctrl v on vps

#

and boom

#

403

lyric mountain
#

is the url right? copypaste is notable to cause issues with that

quaint rampart
#

yes

#

it is right

hidden gorge
#

does python support JSON?

quaint rampart
hidden gorge
#

I forgot and i have to anwser something

lyric mountain
#

it supports PSON

quaint rampart
#

"What's Causing the 'Error 1020: Access Denied' Error 1020 Access Denied is caused when a firewall rule has been violated on a site protected by Cloudflare. It can be triggered if a site visitor tries to directly access an endpoint that is protected."

#

thats the error in the body

#

BUT IT DOESNT MAKJE SENSE THAT MY LOCAL MACHINE

#

WORKS

#

BUT

#

VPS ODESNT

#

BRUHHH

wheat mesa
boreal iron
boreal iron
#

I don’t see a 403

#

How do you do the request in your code

quaint rampart
#

BRUHH HWTFFF

#
var response = await request('https://auth.riotgames.com/login#client_id=play-valorant-web-prod&nonce=1&redirect_uri=https%3A%2F%2Fplayvalorant.com%2Fopt_in&response_type=token%20id_token&scope=account%20openid', {
                headers: {
                    cookie: cookie
                }
            });
boreal iron
#

Try another user agent

quaint rampart
#

what should it be

lyric mountain
#

Mozilla/2.0 or smth

boreal iron
#

Try the user agent you see in curl

#

Or use some generic

#

Mozilla/5.0 (iPhone; CPU iPhone OS 15_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6.1 Mobile/15E148 Safari/604.1

quaint rampart
#

same thing

quaint rampart
#

same thing

boreal iron
#

Show the code please

quaint rampart
#
var response = await request('https://auth.riotgames.com/authorize?redirect_uri=https%3A%2F%2Fplayvalorant.com%2Fopt_in&client_id=play-valorant-web-prod&response_type=token%20id_token&scope=account%20openid&nonce=1', {
    headers: {
        cookie: cookie,
        "user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 15_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6.1 Mobile/15E148 Safari/604.1"
    },
});
lyric mountain
#

check the docs, see if they require an additional header

quaint rampart
#

i think why it worked on curl is because i didnt provide a header

#

should i try providng a cookie

#

?

#

with curl

boreal iron
#

You didn’t provide a cookie

quaint rampart
#

on curl ye

boreal iron
#

Curl automatically adds an user agent like request does as well

#

Could be possible the cookie is associated with others

quaint rampart
#

look at this

#

i provided the cookie

#

with curl

#

and

#

it did an error

lyric mountain
#

docs, please

boreal iron
#

Or if the geo location is different and the user provided a cookie the access gets blocked for security reasons

quaint rampart
#

im p sure

boreal iron
#

Just copying cookies nowadays to steal access won’t work anymore if certain information changes
For example cookie IDs are stored in a database with a reference to your geo location and browser

quartz kindle
#

are you trying to automate something that is not supposed to be automated?

quaint rampart
#

im just trying to login with a cookie basically

#

to allow users

#

to check their valorant item shop

boreal iron
#

When using that cookie in another browser, localization etc it could return the 403

quaint rampart
#

it works on local machine not on vps

boreal iron
#

Since it could be stolen

lyric mountain
boreal iron
#

At least that’s how I enforce security

lyric mountain
#

the scope is different than the one ur trying

quaint rampart
#

oh

#

so

#

then its prolly undocumented

lyric mountain
#

like, scopes matter A LOT when making oauth2 transactions

#

you might not be able to use that specific scope legally

quaint rampart
#

yeah maybe

#

well

#

i asked in the

#

riot dev discord

#

so

#

time to wait for an answer

boreal iron
quaint rampart
#

everyone logs in with their cookie

#

because each person has a different item shop

boreal iron
#

I doubt that works

quartz kindle
#

but if you have to use cookies, you're doing something wrong or unsupported

#

oauth2 doesnt use cookies, it makes the user "login with riot", then redirects them to your website with an access key, which you use to access their data

boreal iron
#

I wonder how he wants to get the cookie anyways

quaint rampart
#

u provide the cookie

#

in the command

#

that end point let’s u login with the cookie

#

to get some other info needed to get your store

boreal iron
#

Can’t you get access to the account details using the OAUTH flow

#

If it even is an OAUTH flow

quaint rampart
#

so then how does it work on my local machine?

boreal iron
#

Read this

#

Is the server in a different country than yours?

quaint rampart
#

no

#

in california

#

so am i

#

and i tried on my local machine

#

with my friends cookie

#

he lives in new york

#

still worked

boreal iron
#

But still the same country

#

Hmm

#

Not sure then

#

But tbh using people’s cookies ain’t a good idea

quaint rampart
#

yeah

#

just sucks cuz

#

i spent

#

3 1/2 hours

#

making this whole thing

#

so

#

kinda bummed out

quartz kindle
#

spent leukemia lmao

quaint rampart
#

but

#

it is what it is

quaint rampart
quartz kindle
#

tbh 3 hours is not much

#

i've wasted much more than that on things that didnt work

boreal iron
#

I tell you how I would do it

#

User enters the command in discord, you respond with ephemeral message incl the oauth link which includes a redirect url to your endpoint which has a token as get parameter to identify the request, once the redirection happens you have access to the user data, push it to your bot and a non-ephemeral follow up message

#

Use the token you got as get parameter as reference

#

To send the follow up to the right webhook (message)

#

The token could be the webhook id for example

#

Actually top level shit idea to add that flow to my bot

#

Utilizing the Steam login to get the user data

#

Why haven’t I thought of that earlier lol

lyric mountain
#

sir...this is Wendy's

quaint rampart
#

getting a riot dev api key

#

is not as easy as u think

#

at all.

boreal iron
#

Ah ok

#

I see but still collecting cookies of people is like the worst idea tbh

boreal iron
#

Speak a human understandable language ffs

wheat mesa
#

sir... this is a Wendy's

boreal iron
wheat mesa
boreal iron
#

Man… kids can be annoying

lament rock
#

arent you younger than 21

wheat mesa
#

lol he's definitely older than 21 (no offense fake)

lament rock
#

ah

#

idk. I know some goater 15-17 year olds

wheat mesa
#

berry be like

boreal iron
lament rock
#

I can imagine

#

Wish I could go back as well

boreal iron
#

When people say I would do things differently who knows if you actually really would freerealestate

lament rock
#

I think things happen for a reason, so I'd just do everything over again the same way. I'm not disappointed with how my life is unfolding at the moment

boreal iron
#

Yeah differently doesn’t automatically mean better anyways

#

What looks nice in the beginning could end like shit later on

lament rock
#

how many lives would you theoretically have to live to make yours a "perfect" run?

sudden geyser
#

"damn I got dumped, I wish I could go back in time"
becomes serial killer
"damn could I get a refund?"

boreal iron
#

I like my current life too but who knows what the future brings but I still feel like I should have done some things differently which would may open a few more doors for a different future

boreal iron
#

Ain’t possible

#

But yeah your decisions are part of a big chain and who knows what would be missing, differently or worse when you’ve made other decisions

#

End of the philosophy lesson

sudden geyser
#

That's just a question of free will

boreal iron
#

Yes and no

#

You can’t be open or ready for anything you gotta choose sometimes and even if you might switch at some point, thing is you don’t get younger and life is really short

#

I mean I’m not an old fart yet but trust me being 10-15y older changes your point of view

#

It feels like the time is running faster every year

ancient nova
#

youtube has the weirdest ads ever

#

I just watched an add of a girl farting on a dude the dude turned into a zombie she killed the zombie then turned his house into fortress and somehow got 300 guns

#

😐

lament rock
#

mobile game ads are getting out of control

sharp geyser
lament rock
rocky hearth
#

whats the difference bw ytdl-core and node-ytdl-core?

pale vessel
#

??

#

they're the same

#

the repo is called node-ytdl-core and the package is called ytdl-core

rocky hearth
#

oohh, yeah. got confused there

#

Also which is better discord-ytdl-core or ytdl-core-discord?

quartz kindle
#

lmao

edgy rover
#

How can I make a <t:x:d> of a specific time? without date

boreal iron
#

If you wanna use the time format then you will have to use a timestamp

#

If you wanna drink some water, you need water in the first place

#

Just to say in cases you don’t know, X is a timestamp not a date

green kestrel
#

i think seeding this backup on my new server may take a while...

jovial nimbus
#

hello

#

When an error occurs in the discord api and the user cannot log in, it says this message in the dashboard, which leads to the project name being shown as you see. Is there another way when I have an error in the discord api it shows a custom error page ? Does this typing error appear?

lyric mountain
#

or simply catch your promises (if passport use promises)

jovial nimbus
worn gust
#

hello, Who use ShewenyClient?

lyric mountain
#

no idea what that is

daring apex
#

Why it's not working?

boreal iron
#

why are bananas crooked?

#

Without further details nobody can help you

lyric mountain
quartz kindle
#

your code is infected by ghosts

daring apex
#

I can't send code for a reason

#

If I send

#

I may get ban

boreal iron
#

What the heck do you expect us to do then if don’t see any code or some more details what’s not working

lyric mountain
#

also yes, we cant help if we dont get any code

sudden geyser
wooden ember
#

how do i catch a require failing?

#

want to make it so that if i reload my commands and one is broken for whatever reason it doent brick the whole bot

boreal iron
#

Why should the file be "broken"?

wooden ember
#

idk

frigid canyon
#

El pepe

boreal iron
#

Check if the file exists before loading it

wooden ember
#

i edited it and fucked somthing up

frigid canyon
wooden ember
#

that sort of thing

boreal iron
#

Require does only import the file, not more or less

wooden ember
#

true

boreal iron
#

If the code inside is broken, an error will occur when using the defined constant

wooden ember
#

?

lyric mountain
wooden ember
#

so i can reqire a bricked js file and it will be fine untill i set it as a command in the command handler

boreal iron
lyric mountain
#

ah, I thought we had a case of krangled json db

wooden ember
#

no

lyric mountain
#

so ok, how tf (and why) is the file broken?

#

cant u just fix it?

wooden ember
#

edited a command file and broke it in the prosses

lyric mountain
#

fix the error

boreal iron
wooden ember
#

well duh

lyric mountain
#

also dont u use git?

wooden ember
#

but i dont want the thing to crash

lyric mountain
#

u can just restore an old version of the file

wooden ember
#

when its loaded

lyric mountain
#

that way you know something is wrong

#

instead of chasing your own tail trying to fix a broken command

wooden ember
#

i want it to try to load the file and then not load it if its got an error in it

#

and then get a console log going "yo the help commands bricked again"

#

thats all i want

lyric mountain
#

cant u .catch() a require?

wooden ember
#

i tryed that and it says .catch is not a function

lyric mountain
#

then use try-catch

wooden ember
#

uuh i tryed that but it didnt work cuz the thing wasnt global but i think i knwo how to get around that

#

one sec

lyric mountain
#

...?

#

like, you'll have the try-catch only around your require

#

there's no "global" at all

wooden ember
#
try {
const cheese require("bruh")
} catch {
console.log("error happend")
}
client.commands.set("cheese")

error cheese isnt there

#

thats paraphrased

#

but what i ment

lyric mountain
#

u didn't return inside the catch

#

so the execution will proceed regardless

wooden ember
#

but thats not the error

#

cheese was there and working

#

but cuz it was in the try block it stayed in the try block

#

but i can just put the whole lot in the try block and it should just work

lyric mountain
#

well yes, that's called scope

wheat mesa
#

Scope is important c:

lyric mountain
#

simply declare the variable outside of it

boreal iron
#

Command set is outside the scope in that case

wooden ember
#

i did that but then there was some other error

boreal iron
#

Commands for example

#

commands.set has to be inside try

wooden ember
#

thats what im doing now

lyric mountain
#
let cheese;
try {
  cheese = require("stuff");
} catch (e) {
  console.log(`Error happened: ${e}`);
  return;
}

client.commands.set("cheese");
boreal iron
#

If command.name wouldn’t exist because the file or structure is broken that would error

lyric mountain
#

you shouldn't even attempt to continue if it errored

boreal iron
#

Of course you should continue

sudden geyser
lyric mountain
#

or yes, use ```js
try {
let cheese = require("stuff");
client.commands.set("cheese");
} catch (e) {
console.log(Error happened: ${e});
}

boreal iron
#

Halting the application when loading a broken command file is stupid as fuck

wooden ember
#

exactly

lyric mountain
#

I'm considering you're specifically reloading that file

boreal iron
lyric mountain
#

if you're loading a specific file, you shouldn't attempt to continue if it errored

#

since everything else will be just invalid

wooden ember
wooden ember
#

i did

#

it works now

#

cheers

boreal iron
lyric mountain
#

btw, u should track which files were changed, so u dont reload unchanged files

lyric mountain
#

emphasis on "specific"

earnest phoenix
#

Can I ask not discord bot code here?

boreal iron
#

Man we’re speaking about commands atm

#

Man translators are shit

lyric mountain
#

I'm talking abt single-file reload, ur the one talking in plurals

#

even for multi-file reload, u shouldn't continue that iteration if it errors

#

since anything else will be invalid because of the error

boreal iron
#

Still depends on the situation

lyric mountain
lyric mountain
boreal iron
#

Loading Commands, events, interactions, localizations

#

Etc

lyric mountain
#

all of those invalidate the entire current iteration when erroring

boreal iron
#

Anything has a proper handler

#

One wrongly loaded file will cause an error not more or less

lyric mountain
#

yes

boreal iron
#

No code inside the loaded file can be existed since it’s broken

lyric mountain
#

that's why u skip that step and go to the next file

boreal iron
#

So why should I shutdown the entire app?

lyric mountain
#

I didn't say that

boreal iron
#

That’s exactly what U said

lyric mountain
#

I said you shouldn't attempt to continue if it errored

earnest phoenix
#

i want to read this datafile.txt and display the content.
datafile.txt (Want get this in console)

MUTHUSAMY GOPAL PENANG    0114352022
PETER BROWN     KEDAH     01111414502
RAMLI AHMAD     PENANG    0131344121
SIM GAH THENG   KEDAH     0153038321
SIM BENG HUAT   SELANGOR  0175300292
SIM BOON TEE    PENANG    0165309293

Code

#include <string>
#include <fstream>

using namespace std;

struct personalDetails
{
    string name[16];
    string country[10];
    int contact[14];
};

const int SIZE = 6;

int main()
{
    struct personalDetails pd;

    ifstream in("datafile.txt");

    if (!in)
    {
        cerr << "File can't be opened! " << endl;
        system("Error");
        exit(1);
    }

    for (int i = 0; i < SIZE; i++)
    {
        cout << pd.name << "  ";
        cout << pd.country << "  ";
        cout << pd.contact << endl;
    }

    return 0;
}```
**Get this console**
```0x61fc64  0x61fde4  0x61fed4
0x61fc64  0x61fde4  0x61fed4
0x61fc64  0x61fde4  0x61fed4
0x61fc64  0x61fde4  0x61fed4
0x61fc64  0x61fde4  0x61fed4
0x61fc64  0x61fde4  0x61fed4
lyric mountain
#

errr...cpp

neon leaf
#

how can I check if a userid is in a serverid?

lyric mountain
neon leaf
#

discord.js

earnest phoenix
#

If I add

for (int i = 0; i < SIZE; i++)
{
      in >> pd.name >> pd.country >> pd.contact;
}

It get huge error

lyric mountain
#

I have absolutely no idea how to answer that

boreal iron
lyric mountain
#

other than "main doen't need a return"

boreal iron
#

Either he exists or not

neon leaf
# lyric mountain fetch

can you tell me the full function name? Cant really do alot with fetch to every answer, ik how to fetch a user to get its username and tag but idk guilds

lyric mountain
#

I think waffle will be ur only help

wheat mesa
earnest phoenix
#

It's okay if can't help

lyric mountain
#

may I ask, why cpp?

#

it's unusual to see cpp devs around here

neon leaf
lyric mountain
#

ig so

earnest phoenix
#

Erm this semester learn thisšŸ˜‚

boreal iron
#

Yes

lyric mountain
wheat mesa
#

Ok so what’s the problem exactly?

lyric mountain
#

btw I once read that using endl is pretty bad on loops

#

since it flushes the buffer everytime

wheat mesa
#

Yeah use \n

#

Ok it’s because you’re doing struct personalDetails pd;

#

Just do personalDetails pd; otherwise you’re declaring an empty struct basically

#

Quite honestly I’m surprised that even compiled

#

The compilers for C++ are pretty lenient though

#

Also using arrays for this is probably not recommended, I’d be using vectors. Though I’m not sure of what your assignment requires

#

I think what it wants you to do is make an array of structs

earnest phoenix
#

šŸ˜®ā€šŸ’Ø šŸ’€

neon leaf
#

yu

boreal iron
#

Dude

#

You need to read what we wrote

wheat mesa
#

You’ll need something more like this @earnest phoenix

boreal iron
wheat mesa
lyric mountain
#

it wont error

earnest phoenix
wheat mesa
#

I can help in about 20 minutes

boreal iron
#

New channel topic: free homework helper

earnest phoenix
#

I really confuse because I learn c++ and xamarin in same day

wheat mesa
frigid canyon
#

I use node

#

My old laptop is for hosting :,)

#

I guess its hosting like 17 bots rn

civic scroll
#

evil

lyric mountain
#

why 17

civic scroll
#

17

#

it better be an old gaming / workstation laptop

vivid fulcrum
#

the amount of gateway events 🫠

civic scroll
#

yes

wooden ember
#

bruh and i thought my 4 bots was alot

#

anyway

#

is there a way to stream the same audio source to multiple chats?

lyric mountain
#

you can open a stream for the audio and send the bytes to each output stream in a loop yes

quartz kindle
#

17 = bolsonaro

lyric mountain
#

if we get lucky our electronics price might go down by like 40% by the next year

solemn latch
#

O pog

lyric mountain
#

well, that's what happens when your president self-shames himself in pretty much all public events

#

my notebook costed around R$2,800 when I bought, now it's more than R$4,300

hidden gorge
#

how long do i need to wait?

wheat mesa
#

Usually 24 hours, or until your next cycle kicks in for login limits

#

If you have somehow managed to hit the 1000 login per day limit then you have a big problem

hidden gorge
#

well our bot goes offline while i code is online for some reason

earnest phoenix
#

I get the feeling that they're using a free host that resets their bot application every time the code is edited

#

And that the host also resets the application on an interval

hidden gorge
#

uptime robot bc my stupid hosting doesn’t work properly

earnest phoenix
#

Glitch and Replit does that

#

Just use a VPS, they aren't even expensive

hidden gorge
#

I have $0

wheat mesa
#

You can quite literally get VPSs for $0

#

They’re not very good, but they exist

#

I personally use Oracle, never been charged a penny for hosting my bot 24/7 for nearly the past year

hidden gorge
#

last time i used a free vps i got in trouble with the police

wheat mesa
#

??

#

The fuck lol

quartz kindle
#

wtf

earnest phoenix
# hidden gorge I have $0

I very much doubt that, if you don't want to be limited by the free hosting service you use and don't want to encounter ratelimiting issues like that, just throw in a few bucks

hidden gorge
wheat mesa
#

Sounds like you chose a shady VPS provider

hidden gorge
#

Yep

#

Kamatera

quartz kindle
#

i had a kamatera before, it was quite good actually

#

never had problems with it

hidden gorge
#

yeah besides the fact that i had my information stolen

wheat mesa
#

If this is from someone that hacked your account that sounds like you had a problem

hidden gorge
#

i’m also ip banned by them

wheat mesa
#

Aka bad password, no 2fa, etc

#

Next time secure your account better

lyric mountain
wheat mesa
#

Especially with accounts linked to your payment information

lyric mountain
#

you definitely don't want to aggravate your case

hidden gorge
#

is IBM good?

earnest phoenix
#

For what?

hidden gorge
#

vps

wheat mesa
#

Building computers in the 70s šŸ˜‰

lyric mountain
#

no, ibm doesn't have a free vps plan

lyric mountain
#

they have a thing that's kinda like azure, but definitely not a vps

#

and yes, as much as I'd piss on oracle's grave, their free vps is pretty decent

#

I give them that

wheat mesa
#

Oracle is a greedy piece of shit company but fight the greed by forcing them to spend resources on you at no cost to you

#

That’s how I see it

lyric mountain
#

I made a proxy server out of their vps

wheat mesa
#

Lmao

earnest phoenix
lyric mountain
#

to prevent my testing bot from locking my main bot

earnest phoenix
wheat mesa
lyric mountain
#

plus java's opensource, java's jvm is what's patented by oracle

earnest phoenix
#

Yeah, but then again they're the main maintainers of the language as well, I would say they've worked pretty hard on it

#

But Oracle being Oracle... Not much you can expect

quartz kindle
quartz kindle
#

rip my minecraft server

earnest phoenix
#

Why did they delete it?

quartz kindle
#

no reason provided

#

they simply disabled my account and deleted everything

lyric mountain
#

they're the main maintainers of the language as well
I'm not sure about that anymore

quartz kindle
lyric mountain
#

they maintain the name java, but openjdk is being maintained mostly by ibm, amazon, apache, etc

lyric mountain
quartz kindle
#

i tried talking to their support, and all they said was "the account was terminated, we dont have any more information"

earnest phoenix
# quartz kindle

Weird, they must've had some obscure reason or just some Oracle-specific bullshit

lyric mountain
#

"yes, we delete rows instead of using status columns, why do you ask?"

earnest phoenix
#

Generally a lot of companies have contributed to almost every major programming language DogKek

lyric mountain
#

they did, but nowadays their contribution is shadowed by those

#

those 3 I listed are among the top contributors

#

notably ibm and its Eclipse foundation

quartz kindle
#

so im trying to buy a pair of tires online

#

at first the shipping was 28 bucks

#

when i tried paying, it errored out

#

went to pay again and the shipping was now 74 bucks

#

went to complain on chat support

#

they offered me a 3% discount

#

went to apply the discount, the shipping changed to "unfortunately we cannot deliver to your address"

#

goan fuck yourself

#

welp, somehow the pair of tires i wanted got bugged out, ended up buying a different brand and it worked lol

boreal iron
#

Rip Minecraft server

#

Rip your player base in total of 0

quartz kindle
#

yup

boreal iron
#

FakE rude ik

#

Looks like nobody getting anything anymore for free

#

Still got around 80GB ram left, unused (yet)

#

You just have to do things for me in return

#

Deal? oldEyes

quartz kindle
#

rich boy braggin

#

:^)

earnest phoenix
#

The first parameter is the old member, the second one is the new member

#

And you can check if the member had a role by the <GuildMember>.roles.cache.has() method

#

Yes

lament rock
#

I really wish worker threads in js shared the same memory space

quartz kindle
#

theres always sharedArrayBuffer :^)

lament rock
#

I do know and was kinda of curious if I should make it so that the main thread shares buffers with threads which represents the stream buffer of audio sources so that handlers dont need to be initialized each thread which possibly incurs api calls

#

kinda defeats the purpose of worker threads though since the main thread would then handle all of the tcp messaging

#

I swear I'm gonna somehow make a system to share module require cache at the very least

quartz kindle
#

xD

digital mulch
#

šŸŽ‰

quartz kindle
#

i have a shelved project which attempts to make a Map-like object based on sharedArrayBuffer

#

but its really hard to accomplish, so i kinda paused it

lament rock
#

I can imagine

quartz kindle
#

need a better serializer

#

but then i also paused my serializer

#

because i need to work on my actual financially viable projects

#

but then i also dont work on them because im a lazy bum

lament rock
#

how much money do you make and how much do you need to stay afloat btw?

#

if you're willing to disclose that is

quartz kindle
#

making about 150 bucks from donations and sponsors

#

which is barely what i need to stay afloat lmao

lament rock
#

damn

quartz kindle
#

im not paying rent right now, but in exchange im helping my mom build her house

#

basically construction work lmao

wheat mesa
#

#SponsorTim

quartz kindle
#

gonna start an onlyfans

#

:^)

solemn latch
#

actually a good idea, instead of typical OF content though just have people submit questions for a price.

quartz kindle
#

hahaha

solemn latch
#

I would pay for that ^_^

spark flint
#

OnlyTims

quartz kindle
#

redirects to this guy

wheat mesa
#

damn, could've been a gold mine

#

tim you should freelance things for people

#

there's a lot of people out there that'll pay ridiculous amounts of money for codebases that you would be able to make in your sleep

solemn latch
#

What about programming bounties?

#

I feel like you could do some pretty high paying bounties within a few weeks.

worn gust
#

how can i optimize my bot, to work with less ping

lyric mountain
#

"how to solve world hunger"

solemn latch
#

Ping generally is a network issue not a code issue.
unless the code is so so slow

worn gust
#

oh

wheat mesa
#

not really within your realm of control, unless you are willing to move your VPS location closer to the discord servers

worn gust
#

i got it

#

i try to do my code the cleanest posible

lyric mountain
#

ping rarely matters for normal bots anyway

#

command processing time is 99% of the time between command and response

worn gust
#

any option on the client, that can help?

solemn latch
#

Id suggest learning about Big O notation, then best practices(books, college, getting more experience).

#

Also, just writing the code in a few ways then benchmarking them.

wheat mesa
#

I still need to learn how to properly benchmark things

worn gust
#

thats very complex

wheat mesa
#

Like microbenchmarks

#

Unit testing is a big thing that helps when writing programs

#

(Just development in general)

solemn latch
#

I've not done proper unit testing in so long. yikes šŸ‘€

wheat mesa
#

I hate unit testing in any language that doesn't have it built in

#

Rust is a blessing in that manner

solemn latch
#

just smash things together and hope it works approach works for me

quartz kindle
wheat mesa
#

it's amazing

worn gust
wheat mesa
#

then just run cargo test

#

boom

worn gust
#

but it has aprox. 150~200 rate of ping

quartz kindle
solemn latch
#

150-200ms isnt bad

#

for a bot

wheat mesa
#

150-200ms is pretty good

worn gust
#

i guees

solemn latch
#

you're not playing cod, its a bot

quartz kindle
#

for rest latency is ok, but its not ok for websocket ping

wheat mesa
#

My rest ping is 200ms, gateway is around 70ms

worn gust
#

can i send ss here?

wheat mesa
#

Sure

worn gust
quartz kindle
#

afaik discord's gateway is in new york

worn gust
#

its not so bad

quartz kindle
#

api latency is good

#

rest latency is normal

lyric mountain
#

ping is mostly noticed on music bots

wheat mesa
solemn latch
#

Even then 200 ping on music isnt that bad

lyric mountain
#

optimizing ur code flow is almost guaranteed to have a huge impact on "perceived latency"

quartz kindle
#

really depends tbh

#

i mean sure

#

but

#

fluctuations of 10-20ms in your code are nothing compared to fluctiations of 100+ms that regularly happen on the internet

#

granted most discord bots should be way faster than that, most commands should take < 1ms to execute, excluding database access

wheat mesa
#

Let me introduce you to djs

#

šŸ˜‰

quartz kindle
#

exdee

#

tbh even in djs the code execution itself should still be very fast

radiant kraken
lyric mountain
#

where neck

carmine summit
#

is there a way to get channel where webhook is made?

lyric mountain
#

it's in the url no?

rustic nova
#

the webhook get request includes a parameter for it too iirc

rustic nova
#

ye it's an id, the GET request to a webhook obtains the channel id

carmine summit
#

does .catch or try{}catch{} stop the function from running?

sudden geyser
#

which function

#

it stops executing later code once an error happens

brittle lantern
#

You guys are so smart and i’m amazed

median hazel
#

Fr

#

Do I report bot problems here or no

sudden geyser
#

This channel is for bot development (i.e. programming bots), so if you need help with that, yes. If you just need help with a certain bot, you may want to check #support or if it has a support server.

lyric mountain
carmine summit
#

how can I stop the function without stopping the enitire process?

lyric mountain
#

Think of it as a sandbox, regardless of what happens inside, the outside will run (unless u explicitly return/break/continue)

lyric mountain
#

return stops the current scope and return a result (void is a result)

break exits the current scope, must be either a loop or a labeled scope

continue stops the current iteration and go to the next one, if any

#

There's also goto, but we don't talk about goto

daring apex
#

Bro I can't tell you

lyric mountain
#

Why did u even bring the topic again then?

timber crest
#

I know nothing about this I just want a PokƩmon server can anyone help?

sharp geyser
#

@ivory siren

ivory siren
#

-b 733313286891896883 posting inapt links, compressed account

gilded plankBOT
#

upvote wenomacha 4#1567 was successfully banned.

ivory siren
#

-ub 733313286891896883 compressed account (soft ban)

sharp geyser
#

lovely pfp though mmLol

gilded plankBOT
#

upvote wenomacha 4#1567 was successfully unbanned

uneven dagger
#

compressed account ah yes , a little bit of compression 🧈

quartz kindle
#

i compress you compress we compress

cinder patio
radiant kraken
#

true

earnest phoenix
#

šŸ‘

wild silo
#

For someone who got his bot verified recently. How much time does it took u to get verified?

lyric mountain
#

topgg varies between 1-2 weeks

#

discord is hard to say, but somewhere around 1 week too if u dont request privileged intents

winged linden
#

can someone help? getting this error for this code

ancient nova
#

maybe don't do them all in one

#

await the fetch also

winged linden
sudden geyser
#

It has to be in scope to be accessed.

#

So you could move it out of the function so it can be accessed in the outer scope

#

You could also restructure your general code

#

Like returning checker from a function and using it like so

neon leaf
#

how can I use the integrated mute function in discord? (discord.js v14)

winged linden
frigid canyon
#

hi

boreal iron
#

You can timeout a guild member

#

Make sure to fetch the guild member before since not all members are cached at any time

neon leaf
#

am i fetching correctly?

lyric mountain
#

no

#

fetch is a promise, you cannot simply call a method on it without awaiting

neon leaf
#

oh, forgor that

lyric mountain
#

also why are u doing user.toString()?

neon leaf
lyric mountain
#

cant u simply do user.id?

boreal iron
#

Once you got the user instance already use user.id

lyric mountain
#

this is also really bad for a command where the user expects a response

neon leaf
#

yes, thats temporary

lyric mountain
#

inb4, don't await the fetch

boreal iron
#

Maybe you should show us how you got the user

lyric mountain
#

use .then() chain

boreal iron
#

I feel like it could be wrongly as well

neon leaf
boreal iron
#

And user is a required option?

neon leaf
#

yu

#

.setRequired(true)

boreal iron
#

Ok then

lyric mountain
#

I reinforce, dont do

const member = await ...fetch(...);
const result = await ...timeout(...);

do instead

const result = await ...fetch().then(m => m.timeout(...));
boreal iron
#

Not needed I think

#

The user option guarantees to return a valid user if I’m not wrong

lyric mountain
#

plus u dont need to repeat .catch() for every step

wheat mesa
#

Async await is good

#

Callback hell is bad

#

Use try catch blocks and await your promises

#

Then you’ll never have problems

lyric mountain
wheat mesa
#

.then is a callback for when the promise resolves

boreal iron
#

Well that’s what you do in your command handler, since the member/user is guaranteed to exist here, you would simply need to catch the timeout promise