mirror of
https://github.com/BushlanovDev/max-bot-api-client-php.git
synced 2026-08-24 10:36:49 +00:00
Added MessageLink & OpenAppButton
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
) {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user