【发布时间】:2018-07-28 22:32:10
【问题描述】:
在过去的 2-3 天里,我尝试解决这个问题。当我输入 chat !help 时,该命令不起作用,我在控制台中收到了这个:
(node:13264) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.fields[0].name: This field is required
at item.request.gen.end (C:\Users\alexx\Dropbox\Bot Try\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:71:65)
at then (C:\Users\alexx\Dropbox\Bot Try\node_modules\snekfetch\src\index.js:215:21)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:160:7)
(node:13264) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:13264) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
运行帮助时运行的文件:https://pastebin.com/jMRjy7Dw
app.js:https://pastebin.com/PmVBKszM
【问题讨论】:
-
在第 25 行上方添加
console.log(commands[cmd].name);并检查您是否收到任何内容。我认为这可能是空白,因此错误“embed.fields[0].name: This field is required” -
不起作用。我得到同样的错误。
-
这不是一个修复...它是检查
commands[cmd].name是否为空白,当您登录时,您是否在控制台中得到任何东西? -
@newbie 它给出了完全相同的错误。绝对没有任何改变。
-
请看我的回答。
标签: node.js bots discord.js