mirror of
https://github.com/BushlanovDev/max-bot-api-client-php.git
synced 2026-08-24 14:26:51 +00:00
Added BotRemovedFromChatUpdate & ChatTitleChangedUpdate & MessageChatCreatedUpdate & UserAddedToChatUpdate & UserRemovedFromChatUpdate
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace BushlanovDev\MaxMessengerBot\Models\Updates;
|
||||
|
||||
use BushlanovDev\MaxMessengerBot\Enums\UpdateType;
|
||||
use BushlanovDev\MaxMessengerBot\Models\User;
|
||||
|
||||
/**
|
||||
* You will receive this update when the bot has been removed from a chat.
|
||||
*/
|
||||
final readonly class BotRemovedFromChatUpdate extends AbstractUpdate
|
||||
{
|
||||
/**
|
||||
* @param int $timestamp Unix-time when the event has occurred.
|
||||
* @param int $chatId Chat identifier the bot was removed from.
|
||||
* @param User $user User who removed the bot from the chat.
|
||||
* @param bool $isChannel Indicates whether the bot has been removed from a channel or not.
|
||||
*/
|
||||
public function __construct(
|
||||
int $timestamp,
|
||||
public int $chatId,
|
||||
public User $user,
|
||||
public bool $isChannel,
|
||||
) {
|
||||
parent::__construct(UpdateType::BotRemoved, $timestamp);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace BushlanovDev\MaxMessengerBot\Models\Updates;
|
||||
|
||||
use BushlanovDev\MaxMessengerBot\Enums\UpdateType;
|
||||
use BushlanovDev\MaxMessengerBot\Models\User;
|
||||
|
||||
/**
|
||||
* Bot gets this type of update as soon as the title has been changed in a chat.
|
||||
*/
|
||||
final readonly class ChatTitleChangedUpdate extends AbstractUpdate
|
||||
{
|
||||
/**
|
||||
* @param int $timestamp Unix-time when the event has occurred.
|
||||
* @param int $chatId Chat identifier where the event has occurred.
|
||||
* @param User $user User who changed the title.
|
||||
* @param string $title The new title.
|
||||
*/
|
||||
public function __construct(
|
||||
int $timestamp,
|
||||
public int $chatId,
|
||||
public User $user,
|
||||
public string $title,
|
||||
) {
|
||||
parent::__construct(UpdateType::ChatTitleChanged, $timestamp);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace BushlanovDev\MaxMessengerBot\Models\Updates;
|
||||
|
||||
use BushlanovDev\MaxMessengerBot\Enums\UpdateType;
|
||||
use BushlanovDev\MaxMessengerBot\Models\Chat;
|
||||
|
||||
/**
|
||||
* Bot will get this update when a chat has been created as soon as
|
||||
* the first user clicked a `chat` button.
|
||||
*/
|
||||
final readonly class MessageChatCreatedUpdate extends AbstractUpdate
|
||||
{
|
||||
/**
|
||||
* @param int $timestamp Unix-time when the event has occurred.
|
||||
* @param Chat $chat The created chat.
|
||||
* @param string $messageId Message identifier where the button has been clicked.
|
||||
* @param string|null $startPayload Payload from the chat button.
|
||||
*/
|
||||
public function __construct(
|
||||
int $timestamp,
|
||||
public Chat $chat,
|
||||
public string $messageId,
|
||||
public ?string $startPayload,
|
||||
) {
|
||||
parent::__construct(UpdateType::MessageChatCreated, $timestamp);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace BushlanovDev\MaxMessengerBot\Models\Updates;
|
||||
|
||||
use BushlanovDev\MaxMessengerBot\Enums\UpdateType;
|
||||
use BushlanovDev\MaxMessengerBot\Models\User;
|
||||
|
||||
/**
|
||||
* You will receive this update when a user has been added to a chat where the bot is an administrator.
|
||||
*/
|
||||
final readonly class UserAddedToChatUpdate extends AbstractUpdate
|
||||
{
|
||||
/**
|
||||
* @param int $timestamp Unix-time when the event has occurred.
|
||||
* @param int $chatId Chat identifier where the event has occurred.
|
||||
* @param User $user User who was added to the chat.
|
||||
* @param int|null $inviterId User who added the new user to the chat.
|
||||
* Can be `null` if the user joined via a link.
|
||||
* @param bool $isChannel Indicates whether the user has been added to a channel or not.
|
||||
*/
|
||||
public function __construct(
|
||||
int $timestamp,
|
||||
public int $chatId,
|
||||
public User $user,
|
||||
public ?int $inviterId,
|
||||
public bool $isChannel,
|
||||
) {
|
||||
parent::__construct(UpdateType::UserAdded, $timestamp);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace BushlanovDev\MaxMessengerBot\Models\Updates;
|
||||
|
||||
use BushlanovDev\MaxMessengerBot\Enums\UpdateType;
|
||||
use BushlanovDev\MaxMessengerBot\Models\User;
|
||||
|
||||
/**
|
||||
* You will receive this update when a user has been removed from a chat where the bot is an administrator.
|
||||
*/
|
||||
final readonly class UserRemovedFromChatUpdate extends AbstractUpdate
|
||||
{
|
||||
/**
|
||||
* @param int $timestamp Unix-time when the event has occurred.
|
||||
* @param int $chatId Chat identifier where the event has occurred.
|
||||
* @param User $user User who was removed from the chat.
|
||||
* @param int|null $adminId Administrator who removed the user from the chat.
|
||||
* Can be `null` if the user left the chat themselves.
|
||||
* @param bool $isChannel Indicates whether the user has been removed from a channel or not.
|
||||
*/
|
||||
public function __construct(
|
||||
int $timestamp,
|
||||
public int $chatId,
|
||||
public User $user,
|
||||
public ?int $adminId,
|
||||
public bool $isChannel,
|
||||
) {
|
||||
parent::__construct(UpdateType::UserRemoved, $timestamp);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user