命令处理程序中的异步

时间:2021-03-09 16:49:22

标签: javascript discord.js

异步在我的 discord.js 中的命令处理程序中不起作用,有谁知道我的错误在哪里?

 execute(message, args, Discord, async)
 ----------In index--------
 else if (command === 'embed'){
      client.commands.get('embed').execute(message, args, Discord, async)
    }

1 个答案:

答案 0 :(得分:1)

您没有将 async 作为参数传递。这不是它的工作原理。 async 关键字启用异步的、基于承诺的行为。因此,要使函数异步,需要在函数前使用关键字 async。在您的情况下,它的 async execute(message,args,Discord)。您显然需要了解asynchronous function