Unable to run Discord slash command using Php

Viewed 37

I am working with php and "Discord", Whenever i type manual command("/imagine prompt ANYTEXT") in discord then i am getting image, i want exactly same process with php but whenever i try do this then i am not getting any iamge,Only exact command displaying in chatbot instead of displaying image,Here is my current code

$url = "https://discord.com/api/webhooks/MYWEBHOOK";
$hookObject = json_encode([

    "embeds" => [
        [
            "title" => "/imagine prompt nature",
        ]
    ]
], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE );
$headers = [ 'Content-Type: application/json; charset=utf-8' ];
$POST = [ 'username' => 'Testing BOT', 'content' => 'Testing message' ];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $hookObject);
$response   = curl_exec($ch);

enter image description here

0 Answers
Related