首页 > 解决方案 > 命令处理程序中的异步

问题描述

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

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

标签: javascriptdiscord.js

解决方案


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


推荐阅读