mirror of
https://github.com/BushlanovDev/max-bot-api-client-php.git
synced 2026-08-24 19:26:53 +00:00
Added MessageButton & ChatAdminPermission::EditLink & alias in ChatAdmin & participants in Chat & first_name in BotPatch
This commit is contained in:
@@ -15,4 +15,5 @@ enum ChatAdminPermission: string
|
||||
case ChangeChatInfo = 'change_chat_info';
|
||||
case PinMessage = 'pin_message';
|
||||
case Write = 'write';
|
||||
case EditLink = 'edit_link';
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ use BushlanovDev\MaxMessengerBot\Models\Attachments\Buttons\Inline\AbstractInlin
|
||||
use BushlanovDev\MaxMessengerBot\Models\Attachments\Buttons\Inline\CallbackButton;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Attachments\Buttons\Inline\ChatButton;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Attachments\Buttons\Inline\LinkButton;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Attachments\Buttons\Inline\MessageButton;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Attachments\Buttons\Inline\OpenAppButton;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Attachments\Buttons\Inline\RequestContactButton;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Attachments\Buttons\Inline\RequestGeoLocationButton;
|
||||
@@ -311,6 +312,7 @@ readonly class ModelFactory
|
||||
InlineButtonType::RequestGeoLocation => RequestGeoLocationButton::fromArray($data),
|
||||
InlineButtonType::Chat => ChatButton::fromArray($data),
|
||||
InlineButtonType::OpenApp => OpenAppButton::fromArray($data),
|
||||
InlineButtonType::Message => MessageButton::fromArray($data),
|
||||
default => throw new LogicException(
|
||||
'Unknown or unsupported inline button type: ' . ($data['type'] ?? 'none')
|
||||
),
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace BushlanovDev\MaxMessengerBot\Models\Attachments\Buttons\Inline;
|
||||
|
||||
use BushlanovDev\MaxMessengerBot\Enums\InlineButtonType;
|
||||
|
||||
/**
|
||||
* Button send text in chat from user.
|
||||
*/
|
||||
final readonly class MessageButton extends AbstractInlineButton
|
||||
{
|
||||
/**
|
||||
* @param string $text Text sending in chat from user.
|
||||
*/
|
||||
public function __construct(string $text)
|
||||
{
|
||||
parent::__construct(InlineButtonType::Message, $text);
|
||||
}
|
||||
}
|
||||
@@ -9,12 +9,14 @@ use BushlanovDev\MaxMessengerBot\Models\Attachments\Payloads\PhotoAttachmentRequ
|
||||
/**
|
||||
* Represents the data to patch for a bot. Instantiate with named arguments.
|
||||
*
|
||||
* Example: new BotPatch(name: 'New Bot Name', description: null);
|
||||
* Example: new BotPatch(first_name: 'New Bot Name', description: null);
|
||||
*
|
||||
* @property-read string|null $name
|
||||
* @property-read string|null $first_name
|
||||
* @property-read string|null $last_name
|
||||
* @property-read string|null $description
|
||||
* @property-read BotCommand[]|null $commands
|
||||
* @property-read PhotoAttachmentRequestPayload|null $photo
|
||||
* @property-read string|null $name @deprecated Use first_name
|
||||
*/
|
||||
final readonly class BotPatch extends AbstractPatchModel
|
||||
{
|
||||
|
||||
@@ -28,6 +28,7 @@ final readonly class Chat extends AbstractModel
|
||||
* @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.
|
||||
* @param array<string, int>|null $participants List of participants in chat. Returned only when single chat is requested.
|
||||
*/
|
||||
public function __construct(
|
||||
public int $chatId,
|
||||
@@ -45,6 +46,7 @@ final readonly class Chat extends AbstractModel
|
||||
public ?int $messagesCount,
|
||||
public ?string $chatMessageId,
|
||||
public ?Message $pinnedMessage,
|
||||
public ?array $participants,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,11 +15,13 @@ final readonly class ChatAdmin extends AbstractModel
|
||||
/**
|
||||
* @param int $userId The identifier of the user to be made an admin.
|
||||
* @param ChatAdminPermission[] $permissions The list of permissions to grant to the user.
|
||||
* @param string|null $alias Alias of the user.
|
||||
*/
|
||||
public function __construct(
|
||||
public int $userId,
|
||||
#[ArrayOf(ChatAdminPermission::class)]
|
||||
public array $permissions,
|
||||
public ?string $alias = null,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ final readonly class ChatMember extends AbstractModel
|
||||
* @param bool $isAdmin True if this member is an administrator of the chat.
|
||||
* @param int $joinTime The time the user joined the chat.
|
||||
* @param ChatAdminPermission[]|null $permissions A list of permissions if the member is an admin, otherwise null.
|
||||
* @param string|null $alias Alias of the user.
|
||||
*/
|
||||
public function __construct(
|
||||
public int $userId,
|
||||
@@ -44,6 +45,7 @@ final readonly class ChatMember extends AbstractModel
|
||||
public int $joinTime,
|
||||
#[ArrayOf(ChatAdminPermission::class)]
|
||||
public ?array $permissions,
|
||||
public ?string $alias,
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user