这是我第一次使用Discord嵌入,更不用说制作网络挂钩了。尝试找出我在做什么错时遇到了一些麻烦。希望有人可以帮忙!
当我尝试发送带有以下代码的嵌入消息时:
{
"username": "Official Discord Servers",
"avatar_url": "https://imgur.com/a/Cl3zspb",
"embeds": [{
"description": "Here is a list of official Discord servers maintained by our State. Note that most of these servers may restrict full access to those who are members of their respective departments:",
"color": 16007990,
"fields": [
{
"name": "State of Atoll",
"value": "[Discord Server](https://discord.gg/5KKgb2z)"
},
{
"name": "Atoll Law Enforcement Training Academy",
"value": "[Discord Server](https://discord.gg/GJnbavz)"
},
{
"name": "Atoll Department of Homeland Security",
"value": "[Discord Server](https://discord.gg/acnPFa7)"
},
{
"name": "Palm County Sheriff's Office",
"value": "[Discord Server](https://discord.gg/uYFANDs)"
},
{
"name": "Atoll State Police",
"value": "[Discord Server](https://discord.gg/WNHKtra)"
},
{
"name": "Atoll Department of Corrections",
"value": "[Discord Server](https://discord.gg/VbFew9s)"
},
{
"name": "Atoll National Guard",
"value": "[Discord Server](https://discord.gg/6zE9HyW)"
}]
}
我收到此错误:
{ “代码”:50006, “ message”:“无法发送空消息” }
答案 0 :(得分:3)
需要标头 $cddatacom = $xmlDoc->createCDATASection($arraydata['comprobante']);
$root = $xmlDoc->appendChild($xmlDoc->createElement("autorizacion"));
$root->appendChild($xmlDoc->createElement("estado",$arraydata['estado']));
$root->appendChild($xmlDoc->createElement("numeroAutorizacion",$arraydata['numeroAutorizacion']));
$root->appendChild($xmlDoc->createElement("fechaAutorizacion",$arraydata['fechaAutorizacion']));
$root->appendChild($xmlDoc->createElement("ambiente",$arraydata['ambiente']));
$root->appendChild($xmlDoc->createElement("comprobante",$arraydata['comprobante']));
$root->appendChild($xmlDoc->createElement("compro",$cddatacom));
$xmlDoc->formatOutput = true;
,其值为Object of class DOMCdataSection could not be converted to string
。另外,请尝试设置Content-Type
字段。
您的问题是无效的JSON,因此请尝试使用JSON validator
答案 1 :(得分:0)
问题中引用的JSON无法解析,格式不正确,缺少右括号。请在下面的答案中找到最后一组}]
括号,尝试一下,
{
"username": "Official Discord Servers",
"avatar_url": "https://imgur.com/a/Cl3zspb",
"embeds": [{
"description": "Here is a list of official Discord servers maintained by our State. Note that most of these servers may restrict full access to those who are members of their respective departments:",
"color": 16007990,
"fields": [
{
"name": "State of Atoll",
"value": "[Discord Server](https://discord.gg/5KKgb2z)"
},
{
"name": "Atoll Law Enforcement Training Academy",
"value": "[Discord Server](https://discord.gg/GJnbavz)"
},
{
"name": "Atoll Department of Homeland Security",
"value": "[Discord Server](https://discord.gg/acnPFa7)"
},
{
"name": "Palm County Sheriff's Office",
"value": "[Discord Server](https://discord.gg/uYFANDs)"
},
{
"name": "Atoll State Police",
"value": "[Discord Server](https://discord.gg/WNHKtra)"
},
{
"name": "Atoll Department of Corrections",
"value": "[Discord Server](https://discord.gg/VbFew9s)"
},
{
"name": "Atoll National Guard",
"value": "[Discord Server](https://discord.gg/6zE9HyW)"
}]
}]
}
答案 2 :(得分:-1)
您需要发送“内容”作为包含正在发送的消息内容的键值对。
"content": "Just testing webhooks"