function sendDiscordMessage($channelID, $token){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://discordapp.com/api/channels/".$channelID."/messages");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
$data =
"{
\"embeds\": [{
\"title\": \"[EMBED TITLE]\",
\"description\":\"[EMBED CONTENT].\",
\"color\": \" [DECIMAL COLOR]\",
\"author\": {
\"name\": \"[USERNAME]\",
\"icon_url\": \"[LOGO URL]\"
}
}],
\"components\": [{
\"type\": 1,
\"components\": [{
\"type\": 2,
\"label\": \"[LABEL]\",
\"style\": 1,
\"custom_id\": \"[CUSTOM ID]\"
}]
}]
}";
$payload = $data;
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
$headers = array();
$headers[] = "Authorization: Bot ".$token;
$headers[] = "Content-Type: application/json";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_exec($ch);
curl_close ($ch);
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
return false;
} else {
return true;
}
}