[英]Small problem with hamburger, but I don't see it. Help me to find error please
[英]I've an error but I don't find the problem
我想执行此命令,但是当我执行此命令时,出现此错误消息:错误代码:
(node:8616) UnhandledPromiseRejectionWarning: Error: 400 Bad Request
at C:\Users\Eleve\Desktop\FA Bot\node_modules\snekfetch\src\index.js:195:23
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:8616) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:8616) [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.
这是代码:
const Discord = require("discord.js")
const botconfig = require("../botconfig.json");
const colours = require("../colours.json");
const prefix = botconfig.prefix
const webhook = require("webhook-discord")
module.exports.run = async (bot, message, args) => {
const Hook = new webhook.Webhook("https://discordapp.com/api/webhooks/689803124957118476/xiz3sE3dhQhjW7CoJrTIVB60LCckSHYm_0X9OwlGEQwDnmKYHzFuvekImwxjSaOuhoN-")
const msg = new webhook.MessageBuilder()
.setName(message.author.username)
.setColor("RANDOM")
.setText("Test")
.setTime();
Hook.send(msg)
}
module.exports.config = {
name: "webhook",
aliases: ["wh"],
usage: "!usage",
description: "",
accessableby: "Membres"
}
你能帮我吗 ?
错误本身已经告诉你了。 出现错误的原因是由于未处理的承诺拒绝。
原因:
1. This error originated either by throwing inside of an async function without a catch block, or
2. by rejecting a promise which was not handled with .catch().
这意味着您可以通过以下方式处理问题:
1. You can move you async function into a try and catch block in order to catch the error when the function has failed
2. You can add a .catch() chain function as node suggested.
错误消息通常得到答案,学习如何阅读它们非常重要。 我仍在学习如何阅读它。 希望能帮助到你。
材料:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.