From 742f17714587f755b530ee93418b90f1dead5982 Mon Sep 17 00:00:00 2001 From: netkas Date: Fri, 4 Oct 2024 13:26:07 -0400 Subject: [PATCH] Added ReactionCount --- src/TgBotLib/Objects/ReactionCount.php | 60 ++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/TgBotLib/Objects/ReactionCount.php diff --git a/src/TgBotLib/Objects/ReactionCount.php b/src/TgBotLib/Objects/ReactionCount.php new file mode 100644 index 0000000..d44c8f3 --- /dev/null +++ b/src/TgBotLib/Objects/ReactionCount.php @@ -0,0 +1,60 @@ +type; + } + + /** + * Number of times the reaction was added + * + * @return int + */ + public function getTotalCount(): int + { + return $this->total_count; + } + + /** + * @inheritDoc + */ + public function toArray(): array + { + return [ + 'type' => $this->type->value, + 'total_count' => $this->total_count + ]; + } + + /** + * @inheritDoc + */ + public static function fromArray(?array $data): ?ObjectTypeInterface + { + if($data === null) + { + return null; + } + + $object = new self(); + $object->type = ReactionTypes::tryFrom($data['type']); + $object->total_count = $data['total_count']; + + return $object; + } + } \ No newline at end of file