modify filters

This commit is contained in:
Mateusz Pieła 2021-05-15 11:26:20 +02:00
parent 096f91cd74
commit e4c80782f8
4 changed files with 114 additions and 12 deletions

View file

@ -0,0 +1,37 @@
<?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;
}
if(!empty($this->json->embeds->title))
{
$this->readable .= $this->json->embeds->title . PHP_EOL;
}
if(!empty($this->json->embeds->description))
{
$this->readable .= preg_replace("/(?:__|[*#])|\[(.*?)\]\(.*?\)/"," ",$this->json->embeds->description) . PHP_EOL;
$this->readable .= $this->json->embeds->url;
}
return $this->readable;
}
}