i ended up writing my own if you want some hints
$my_post = array(
‘post_title’ => $author . “-” . wp_strip_all_tags($media_title),
‘post_content’ => $author . “-” . substr($media_title . ” ” ,0, 20) . ”
” . $link . ”
” .
$media_description,
‘post_status’ => ‘publish’,
‘post_author’ => 1,
‘post_category’ => array(8, 39),
);
//the content is a filter name used in wordpress to pre porccess video and image embeds and tags etc
// apply_filters( ‘the_content’, $content );
// Insert the post into the database
$mypostid = wp_insert_post($my_post);
$post_link = get_permalink($mypostid);
echo “<br> $post_link and id ” .$post_link.” and ” .$mypostid . “<br>”;
// echo $media_thumbnail . “<br>”;
Generate_Featured_Image($media_thumbnail, $mypostid, $id . “.jpg”);
$sql = “INSERT INTO xxx.youtube (videoid,title,thumbnail,descript,starcount,satisticsviews,link,channelid,author,published,updated,stars)
VALUES (‘$id’, ‘$media_title’, ‘$media_thumbnail’, ‘$media_description’, ‘$count_star_rating’, ‘$media_satistics_views’ , ‘$link’ , ‘$yt_channelid’, ‘$author’, ‘$published’, ‘$updated’,’$count_star_count’)”;
$date = new DateTime();
$mytimestamp = $date->getTimestamp();
//##################discord post
//2021 current working model
$url = “https://discord.com/api/webhooks/xxx”;
// security issue with this being false not tested ?? curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$hookObject = json_encode([
/*
* The general “message” shown above your embeds
*/
“content” => “”,
/*
* The username shown in the message
*/
“username” => “Auditors United”,
/*
* The image location for the senders image
*/
“avatar_url” => “https://media.discordapp.net/attachments/749633007484272701/821860322364489779/batman-icon1.png”,
/*
* Whether or not to read the message in Text-to-speech
*/
“tts” => false,
/*
* File contents to send to upload a file
*/
// “file” => “”,
/*
* An array of Embeds
*/
“embeds” => [
/*
* Our first embed
*/
[
// Set the title for your embed
“title” => “$media_title”,
// The type of your embed, will ALWAYS be “rich”
“type” => “rich”,
// A description for your embed
“description” => “$author”,
// The URL of where your title will be a link to
“url” => “$post_link”,
/* A timestamp to be displayed below the embed, IE for when an an article was posted
* This must be formatted as ISO8601
*/
“timestamp” => “”,
// The integer color to be used on the left side of the embed
“color” => hexdec( “FFFFFF” ),
// Footer object
“footer” => [
“text” => “”,
“icon_url” => “https://pbs.twimg.com/profile_images/972154872261853184/RnOg6UyU_400x400.jpg”
],
// Image object
“image” => [
“url” => “$media_thumbnail”
],
// Thumbnail object
“thumbnail” => [
“url” => “”
],
// Author object
“author” => [
“name” => “”,
“url” => “https://auditorsunited.org/a/”
],
// Field array of objects
]
]
], 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);