From 63949a2f2f921d6c8badb56ad274f17a3195d49e Mon Sep 17 00:00:00 2001 From: netkas Date: Sat, 5 Oct 2024 01:02:54 -0400 Subject: [PATCH] Added BusinessMessagesDeleted --- .../Objects/BusinessMessagesDeleted.php | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 src/TgBotLib/Objects/BusinessMessagesDeleted.php diff --git a/src/TgBotLib/Objects/BusinessMessagesDeleted.php b/src/TgBotLib/Objects/BusinessMessagesDeleted.php new file mode 100644 index 0000000..4a0fbad --- /dev/null +++ b/src/TgBotLib/Objects/BusinessMessagesDeleted.php @@ -0,0 +1,76 @@ +business_connection_id; + } + + /** + * Information about a chat in the business account. + * The bot may not have access to the chat or the corresponding user. + * + * @return Chat + */ + public function getChat(): Chat + { + return $this->chat; + } + + /** + * The list of identifiers of deleted messages in the chat of the business account + * + * @return int[] + */ + public function getMessageIds(): array + { + return $this->message_ids; + } + + /** + * @inheritDoc + */ + public function toArray(): ?array + { + return [ + 'business_connection_id' => $this->business_connection_id, + 'chat' => $this->chat?->toArray(), + 'message_ids' => $this->message_ids + ]; + } + + /** + * @inheritDoc + */ + public static function fromArray(?array $data): ?BusinessMessagesDeleted + { + if($data === null) + { + return null; + } + + $object = new self(); + $object->business_connection_id = $data['business_connection_id'] ?? null; + $object->chat = isset($data['chat']) ? Chat::fromArray($data['chat']) : null; + $object->message_ids = $data['message_ids'] ?? []; + + return $object; + } + } \ No newline at end of file