39 lines
No EOL
812 B
PHP
39 lines
No EOL
812 B
PHP
<?php
|
|
|
|
|
|
namespace classes\webhook_comp;
|
|
|
|
|
|
class discord
|
|
{
|
|
private $json;
|
|
private $readable = "";
|
|
|
|
public function __construct($json)
|
|
{
|
|
$this->json = $json;
|
|
}
|
|
|
|
public function readableMessage()
|
|
{
|
|
if(!empty($this->json->content))
|
|
{
|
|
return $this->json->content;
|
|
}
|
|
|
|
$this->readable .= PHP_EOL;
|
|
|
|
if(!empty($this->json->embeds[0]->title))
|
|
{
|
|
$this->readable .= $this->json->embeds[0]->title . PHP_EOL;
|
|
}
|
|
|
|
if(!empty($this->json->embeds[0]->description))
|
|
{
|
|
$this->readable .= preg_replace("/(?:__|[*#])|\[(.*?)\]\(.*?\)/"," ",$this->json->embeds[0]->description) . PHP_EOL;
|
|
$this->readable .= $this->json->embeds[0]->url;
|
|
}
|
|
|
|
return $this->readable;
|
|
}
|
|
} |