Guest User

Untitled

a guest
Oct 1st, 2021
23
66 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // this code goes at the end of report
  2. if ($config['discord']){
  3.  
  4.         if(!function_exists('discord')){
  5.         function discord($message, $webhook)
  6.         {
  7.  
  8.         $data = "payload_json=" . json_encode(array(
  9.         "username" => "Reports-BOT",
  10.         "avatar_url" => "avatar url goes here", //TODO to set in inc/config.php
  11.         "content" => urlencode($message)
  12.         ));
  13.  
  14.             $ch = curl_init($webhook);
  15.         //  $ch = curl_init($config['discord_webhook']); // doesnt work for some reason
  16.             curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
  17.                 curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  18.                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  19.                 $result = curl_exec($ch);
  20.             //echo $result; // for debugging
  21.                 curl_close($ch);
  22.                 return $result;
  23.     }
  24. }
  25.  
  26.     // lel
  27.     $webhook = $config['discord_webhook'];
  28.  
  29.         //$content = mb_substr($post['body_nomarkup'], 0, 120) . '...  _*(POST CORTADO)*_';
  30.         $discordmessage = '<' .$config['domain'] . "/mod.php?/" . $board['dir'] . $config['dir']['res'] . link_for($post) . ($post['thread'] ? '#' . $id : '') . '> \n ' . '***Motivo:*** ' . $reason . '\n ';
  31.  
  32.         $discordresult = discord($discordmessage, $webhook);
  33.     }
  34. } // this close reports
RAW Paste Data