javascript - 命令处理程序中的异步
问题描述
异步在我的 discord.js 中的命令处理程序中不起作用,有人知道我的错误在哪里吗?
execute(message, args, Discord, async)
----------In index--------
else if (command === 'embed'){
client.commands.get('embed').execute(message, args, Discord, async)
}
解决方案
您不async
作为参数传递。这不是它的工作原理。async
关键字启用异步的、基于承诺的行为。所以要使函数异步,你需要async
在函数之前使用关键字。在你的情况下,它的async execute(message,args,Discord)
. 您显然需要了解异步函数。
推荐阅读
- google-apps-script - 从邮件附件中的压缩文件中获取电子表格
- reactjs - expo-crypto 哈希与 Crypto JS 在 React Web 应用程序中生成的哈希不匹配
- python - 使用 beautifulsoup 从嵌套的 span 标签中获取文本
- javascript - 如何在 Javascript 中使用 django 变量?
- alexa-skill - 如何使 Coinbase API 以本地货币而不是钱包货币返回钱包余额
- csv - 将管道分隔符转换为逗号分隔符
- python - Python用整数删除输出中的空格
- powershell - 脚本正常运行的问题
- c++ - 在仿函数中包装 const 成员函数的问题
- php - 如何获取 Wordpress 插件的路径?