#await is only valid in async functions and the top level bodies of modules
35 messages · Page 1 of 1 (latest)
ok
still not working
async exec(`Copy-Item -P~
like this?
or
async exec(client, message, cmd, args, Discord) {
?
What line is that error coming from
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
Oh then just do a async func
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.
uhh
it makes
error
as you can see. that exec is not discord.js
node.js's childprocess
oh then just do a async function
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
Tag suggestion for @whole root:
Resources to understand Promise:
• MDN: learn more
• Guide: learn more
• JavaScript info: learn more
🤔
one thing that’ll defo help:
learn js