#cant run an async loop in an async loop

1 messages · Page 1 of 1 (latest)

boreal hazel
#

next steps:: how can I await for the response object to finish creating before returning it?

modern olive
nocturne void
#

did you actually restart the bot

#

or save the file

boreal hazel
#

yeah

nocturne void
#

also show your code

boreal hazel
nocturne void
#

why would it

#

do you even know how asyncio works

boreal hazel
#
response = await asyncio.create_task(ai_chat.chat(prompt))
    await ctx.respond(response)
#

both are await

nocturne void
#

this was a rethorical question

#

I recommend you give this a read

boreal hazel
#

i know how it works I just can't figure this shit out

nocturne void
#

also awaiting a task immediately after creating it is utterly pointless

#

because at that point you could just await the original coro

nocturne void
#

create_async is an async function

#

go figure

boreal hazel
nocturne void
#

that's not what I said

boreal hazel
#

🗿

nocturne void
#

I'm not sure why you're trying to create a task in the first place

modern olive
nocturne void
#

but it is my firm impression that you have absolutely 0 clue how async works

#

therefore I recommend you give the guide I sent a read

#

and try to understand it

#

it is vital if you're trying to actually write async code

#

it's a complicated topic with a lot of nuance, so I really do recommend you do some research first

#

there's also an excellent guide on fastapi's site

#

if you prefer a more example-oriented guide

boreal hazel
#

response = await ai_chat.chat(prompt) i get this

#

yeah i read the guide

#

still dont get it

nocturne void
#

you didn't read a 1 hour long guide in 10 minutes

#

not if you actually tried to understand any of it

#

stop lying to us & to yourself

boreal hazel
#

no i read the tldr

nocturne void
#

yeah honestly I can't help people who are not willing to help themselves

#

I'm not going to spoonfeed you the correct code, because you'll learn nothing from that

#

but you don't want to learn, so...

#

yeah I'm out

boreal hazel
#

why so harsh bruh

#

im gonna go watch a tutorial or something

#

ive been up all night until 7 am

fading meadow
#

Maybe get some sleep first

nocturne void
#

then you should probably sleep

boreal hazel
#

i did sleep

#

4 hours

fading meadow
#

Sleep a proper amount

#

4 hours isn't nearly enough for someone to function properly

#

Especially a tutorial. Most of it will just go over your head and u wont learn from it

#

Get decent sleep

boreal hazel
#

i have very bad insomnia and i get sleep paralysis a few times a night

#

i need meds but ran out 2 days ago

nocturne void
#

well in that case I implore you to address your health issues first

#

you shouldn't die trying to bruteforce python

boreal hazel
#

i got core health issues from age 14

nocturne void
#

it's counterproductive

boreal hazel
#

borderline

#

i can barely have any motivation to do anything

#

so instead i try to do something instead of trying to kill myself for the 10th time

nocturne void
#

all I told you is to do some research

#

that's all I want you to do

#

I want you to be healthy, I want you to make this bot, I'm not against you

#

as surprising as that may sound

boreal hazel
#

i made some progress

#

this itself works if i run it portably

modern olive