Added MessageLink & OpenAppButton

This commit is contained in:
Alex
2025-07-18 08:39:17 +03:00
parent 028d2591f8
commit b9c04bed33
7 changed files with 133 additions and 1 deletions
@@ -0,0 +1,29 @@
<?php
declare(strict_types=1);
namespace BushlanovDev\MaxMessengerBot\Models\Attachments\Buttons;
use BushlanovDev\MaxMessengerBot\Enums\ButtonType;
/**
* Opens the bot's mini-application.
*/
final readonly class OpenAppButton extends AbstractButton
{
public ?string $webApp;
public ?int $contactId;
/**
* @param string $text Visible button text (1 to 128 characters).
* @param string|null $webApp The public name (username) of the bot or a link to it, whose mini-application should be launched.
* @param int|null $contactId The ID of the bot whose mini-app should be launched.
*/
public function __construct(string $text, ?string $webApp = null, ?int $contactId = null)
{
parent::__construct(ButtonType::OpenApp, $text);
$this->webApp = $webApp;
$this->contactId = $contactId;
}
}
+23
View File
@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace BushlanovDev\MaxMessengerBot\Models;
use BushlanovDev\MaxMessengerBot\Enums\MessageLinkType;
/**
* Message link.
*/
final readonly class MessageLink extends AbstractModel
{
/**
* @param MessageLinkType $type Type of message link.
* @param string $mid Message identifier of original message.
*/
public function __construct(
public MessageLinkType $type,
public string $mid,
) {
}
}