mirror of
https://github.com/BushlanovDev/max-bot-api-client-php.git
synced 2026-08-28 02:57:27 +00:00
Added attachment RequestContactButton & RequestGeoLocationButton
This commit is contained in:
@@ -7,6 +7,9 @@ namespace BushlanovDev\MaxMessengerBot\Models\Attachments\Buttons;
|
||||
use BushlanovDev\MaxMessengerBot\Enums\ButtonType;
|
||||
use BushlanovDev\MaxMessengerBot\Enums\Intent;
|
||||
|
||||
/**
|
||||
* Sends a notification with payload to a bot (via WebHook or long polling).
|
||||
*/
|
||||
final readonly class CallbackButton extends AbstractButton
|
||||
{
|
||||
public string $payload;
|
||||
|
||||
@@ -6,6 +6,9 @@ namespace BushlanovDev\MaxMessengerBot\Models\Attachments\Buttons;
|
||||
|
||||
use BushlanovDev\MaxMessengerBot\Enums\ButtonType;
|
||||
|
||||
/**
|
||||
* Makes a user to follow a link.
|
||||
*/
|
||||
final readonly class LinkButton extends AbstractButton
|
||||
{
|
||||
public string $url;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace BushlanovDev\MaxMessengerBot\Models\Attachments\Buttons;
|
||||
|
||||
use BushlanovDev\MaxMessengerBot\Enums\ButtonType;
|
||||
|
||||
/**
|
||||
* Requests the user permission to access contact information (phone number, short link, email).
|
||||
*/
|
||||
final readonly class RequestContactButton extends AbstractButton
|
||||
{
|
||||
/**
|
||||
* @param string $text Visible button text (1 to 128 characters).
|
||||
*/
|
||||
public function __construct(string $text)
|
||||
{
|
||||
parent::__construct(ButtonType::RequestContact, $text);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace BushlanovDev\MaxMessengerBot\Models\Attachments\Buttons;
|
||||
|
||||
use BushlanovDev\MaxMessengerBot\Enums\ButtonType;
|
||||
|
||||
/**
|
||||
* After pressing this type of button client sends new message with attachment of current user geo location.
|
||||
*/
|
||||
final readonly class RequestGeoLocationButton extends AbstractButton
|
||||
{
|
||||
public bool $quick;
|
||||
|
||||
/**
|
||||
* @param string $text Visible button text (1 to 128 characters).
|
||||
* @param bool $quick If true, sends location without asking user's confirmation.
|
||||
*/
|
||||
public function __construct(string $text, bool $quick = false)
|
||||
{
|
||||
parent::__construct(ButtonType::RequestGeoLocation, $text);
|
||||
|
||||
$this->quick = $quick;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user