小编Jam*_*ith的帖子

如何使用PHP发送嵌入式Webhook [Discord]

当用户在我的网站上填写表单时,我试图将Webhook发送到Discord频道,我确实希望将其嵌入,但是这样做很麻烦。我已经成功地使用“ content”发布了Webhhook,但是我无法将其嵌入。

$Embed = {
  "username": "Kick Report",
  "embeds": [{
    "fields": [
      {
        "name": "Victim",   
        "value": "Change Victim Later",
        "inline": true
      },
      {
        "name": "Reason",
        "value": "Change Reason Later!",
        "inline": true
      },
      {
        "name": "Caller",
        "value": "Change Caller Later"
      },
      {
        "name": "Date",
        "value": "Change Date Later"
      }
    ]
  }]
};


$data = array("content" => $Embed, "Kick Report" => "Webhooks");
$curl = curl_init("https://discordapp.com/api/webhooks/xxxxxxxxxxxxxxxxxxxxxxxx");
 curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
 curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
 curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
 return curl_exec($curl);
Run Code Online (Sandbox Code Playgroud)

php json webhooks discord

3
推荐指数
1
解决办法
7334
查看次数

标签 统计

discord ×1

json ×1

php ×1

webhooks ×1