Add files via upload

This commit is contained in:
ArkHost
2025-05-31 00:44:18 +02:00
committed by GitHub
commit 0b742d0e39
6 changed files with 494 additions and 0 deletions
@@ -0,0 +1,57 @@
<?php
namespace WHMCS\Module\Notification\Discord;
class Message
{
public $content = "";
public $username = "";
public $avatarUrl = "";
public $embeds = array();
public function content($content)
{
$this->content = trim($content);
return $this;
}
public function username($username)
{
$this->username = trim($username);
return $this;
}
public function avatarUrl($avatarUrl)
{
$this->avatarUrl = trim($avatarUrl);
return $this;
}
public function embed($embed)
{
$this->embeds[] = $embed;
return $this;
}
public function toArray()
{
$message = array();
if (!empty($this->content)) {
$message["content"] = $this->content;
}
if (!empty($this->avatarUrl)) {
$message["avatar_url"] = $this->avatarUrl;
}
if (!empty($this->username)) {
$message["username"] = $this->username;
}
if (!empty($this->embeds)) {
$message["embeds"] = array_map(function($embed) {
return $embed instanceof Embed ? $embed->toArray() : $embed;
}, $this->embeds);
}
return $message;
}
}