Added Chat

This commit is contained in:
Alex
2025-07-20 14:17:19 +03:00
parent 4661edffdf
commit 07c6bb35b4
7 changed files with 192 additions and 3 deletions
+50
View File
@@ -0,0 +1,50 @@
<?php
declare(strict_types=1);
namespace BushlanovDev\MaxMessengerBot\Models;
use BushlanovDev\MaxMessengerBot\Enums\ChatStatus;
use BushlanovDev\MaxMessengerBot\Enums\ChatType;
/**
* Information about the chat.
*/
final readonly class Chat extends AbstractModel
{
/**
* @param int $chatId Chats identifier.
* @param ChatType $type Type of chat. One of: `dialog`, `chat`, `channel`.
* @param ChatStatus $status Chat status.
* @param int $lastEventTime Time of last event occurred in chat.
* @param int $participantsCount Number of people in chat. Always 2 for `dialog` chat type.
* @param bool $isPublic Is current chat publicly available. Always false for dialogs.
* @param string|null $title Visible title of chat. Can be null for dialogs.
* @param Image|null $icon Icon of chat.
* @param int|null $ownerId Identifier of chat owner. Visible only for chat admins
* @param string|null $link Link on chat.
* @param string|null $description Chat description.
* @param User|null $dialogWithUser Another user in conversation. For `dialog` type chats only.
* @param int|null $messagesCount Messages count in chat. Only for group chats and channels. Not available for dialogs.
* @param string|null $chatMessageId Identifier of message that contains `chat` button initialized chat.
* @param Message|null $pinnedMessage Pinned message in chat or channel. Returned only when single chat is requested.
*/
public function __construct(
public int $chatId,
public ChatType $type,
public ChatStatus $status,
public int $lastEventTime,
public int $participantsCount,
public bool $isPublic,
public ?string $title,
public ?Image $icon,
public ?int $ownerId,
public ?string $link,
public ?string $description,
public ?User $dialogWithUser,
public ?int $messagesCount,
public ?string $chatMessageId,
public ?Message $pinnedMessage,
) {
}
}
+16
View File
@@ -0,0 +1,16 @@
<?php
declare(strict_types=1);
namespace BushlanovDev\MaxMessengerBot\Models;
final readonly class Image extends AbstractModel
{
/**
* @param string $url URL of image.
*/
public function __construct(
public string $url,
) {
}
}
+32
View File
@@ -0,0 +1,32 @@
<?php
declare(strict_types=1);
namespace BushlanovDev\MaxMessengerBot\Models;
final readonly class User extends AbstractModel
{
/**
* @param int $userId Users identifier.
* @param string $firstName Users first name.
* @param string|null $lastName Users last name.
* @param string|null $username Unique public user name. Can be `null` if user is not accessible or it is not set.
* @param bool $isBot `true` if user is bot.
* @param int $lastActivityTime Time of last user activity in Max (Unix timestamp in milliseconds).
* @param string|null $description User description. Can be `null` if user did not fill it out.
* @param string|null $avatarUrl URL of avatar.
* @param string|null $fullAvatarUrl URL of avatar of a bigger size.
*/
public function __construct(
public int $userId,
public string $firstName,
public ?string $lastName,
public ?string $username,
public bool $isBot,
public int $lastActivityTime,
public ?string $description,
public ?string $avatarUrl,
public ?string $fullAvatarUrl,
) {
}
}