From b144627a70ac67f34f38d9891d8b05e05a2b9042 Mon Sep 17 00:00:00 2001 From: netkas Date: Tue, 1 Oct 2024 12:43:44 -0400 Subject: [PATCH] Added InaccessibleMessage --- .../Objects/Telegram/InaccessibleMessage.php | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/TgBotLib/Objects/Telegram/InaccessibleMessage.php diff --git a/src/TgBotLib/Objects/Telegram/InaccessibleMessage.php b/src/TgBotLib/Objects/Telegram/InaccessibleMessage.php new file mode 100644 index 0000000..2830a53 --- /dev/null +++ b/src/TgBotLib/Objects/Telegram/InaccessibleMessage.php @@ -0,0 +1,57 @@ +chat; + } + + /** + * Unique message identifier inside the chat + * + * @return int + */ + public function getMessageId(): int + { + return $this->message_id; + } + + /** + * @inheritDoc + */ + public function toArray(): array + { + return [ + 'chat' => $this->chat->toArray(), + 'message_id' => $this->message_id, + 'date' => $this->date + ]; + } + + /** + * @inheritDoc + */ + public static function fromArray(array $data): InaccessibleMessage + { + $object = new self(); + + $object->chat = isset($data['chat']) ? Chat::fromArray($data['chat']) : null; + $object->message_id = $data['message_id']; + $object->date = $data['data']; + + return $object; + } +} \ No newline at end of file