【发布时间】:2021-10-07 01:42:41
【问题描述】:
我最近想对webhook-discord 的节点模块进行试验,在该模块中出现UnhandledPromiseRejectionWarning: Error: 400 Bad Request 的错误提示
https://www.npmjs.com/package/webhook-discord
我使用 vs code 的内置终端安装了模块,并复制并粘贴了位于“自定义消息”下的确切代码,并输入了我的 webhook URL。
const webhook = require("webhook-discord");
const Hook = new webhook.Webhook("WEBHOOK URL");
const msg = new webhook.MessageBuilder()
.setName("Username")
.setColor("#aabbcc")
.setText("This is my webhook!");
Hook.send(msg);
当我尝试使用诸如此类的其他示例时,它可以工作:
const webhook = require("webhook-discord");
const Hook = new webhook.Webhook("WEBHOOK URL");
Hook.info("WEBHOOK NAME","Info");
【问题讨论】:
-
如果我的回答解决了您在问题中提出的问题,您应该考虑通过单击复选标记将其标记为已接受。或者至少在提出新问题之前向您之前问题的回答者提供反馈。谢谢。
标签: javascript discord discord.js