开机自检到网络挂钩? [英] POST to a webhook?

查看:46
本文介绍了开机自检到网络挂钩?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为我的频道创建了一个Discord Webhook,现在我正尝试向其发送POST请求,以便我的程序自动将内容保存到该频道.但是,当我发送发布请求时,它不起作用.我添加了一些屏幕截图以进行澄清

I created a Discord webhook for my channel, now I am trying to send a POST request to it so my program automatically saves stuff to the channel. However when I send a post request it doesn't work. I added some screenshots for clarification

推荐答案

错误的请求意味着您的请求无效.

Bad Request means that your Request is invalid.

Discord仅接受JSON请求主体(请参阅 https://discordapp.com/developers/docs/resources/webhook#execute-webhook )

Discord only accepts JSON Request Bodies(See https://discordapp.com/developers/docs/resources/webhook#execute-webhook)

如文档所述,正文应如下所示(已最小化,请参阅文档,将 message 替换为您的消息):

As the docs describe, the body should look like that(it is minimalized, see the documentation, replace message with your message):

{
    "content": "message"
}

您也可以使用此方法发送文件或嵌入.

You can also send a file or an embed using this method.

如果需要,您还可以覆盖Webhook的默认用户名/头像.

You can also overwrite the default username/avatar of the webhook if you want to.

这篇关于开机自检到网络挂钩?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆