#await is only valid in async functions and the top level bodies of modules

35 messages · Page 1 of 1 (latest)

prisma estuary
#

I assume you need async exec()

whole root
#

ok

#

still not working

#

async exec(`Copy-Item -P~

#

like this?

#

or

#

async exec(client, message, cmd, args, Discord) {

#

?

toxic sorrel
#

What line is that error coming from

whole root
#

const EmbedPage = await message.reply({ embeds: [AskEmbed], components: [row] })
^^^^^

SyntaxError: await is only valid in async functions and the top level bodies of modules

#

const EmbedPage = await message.reply({ embeds: [AskEmbed], components: [row] })

#

this line

toxic sorrel
#

Oh then just do a async func

whole root
#

how?

#

@toxic sorrel

toxic sorrel
#

Try what the other guy suggested async exec(...)

#

so on line 31

worldly pawnBOT
#

mdn async function
An async function is a function declared with the async keyword, and the await keyword is permitted within it. The async and await keywords enable asynchronous, promise-based behavior to be written in a cleaner style, avoiding the need to explicitly configure promise chains.

whole root
#

uhh

#

it makes

#

error

#

as you can see. that exec is not discord.js

#

node.js's childprocess

toxic sorrel
#

oh then just do a async function

whole root
#

async execute(client, message, cmd, args, Discord) {

#

already

toxic sorrel
#

but you just created a function with the exec part

#

it wouldnt be async

#

im terrible at explaining but just create a function or a async callback after the exec part and it should be fine

whole root
#

um

#

i'm terrible at understanding

worldly pawnBOT
whole root
#

🤔

twin topaz
#

one thing that’ll defo help:
learn js