From db8f0045a1fcf37b838be9e0abe77ec2418476af Mon Sep 17 00:00:00 2001 From: Nadyita Date: Tue, 5 Mar 2024 15:18:06 +0100 Subject: [PATCH] Allow access to all groups --- src/Client/Basic.php | 9 +++++++++ src/Client/Multi.php | 9 +++++++++ src/Group.php | 6 +++--- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/Client/Basic.php b/src/Client/Basic.php index e7490c3..ea7064e 100644 --- a/src/Client/Basic.php +++ b/src/Client/Basic.php @@ -92,6 +92,15 @@ public function onReady(Closure $callback): void { $this->readyListeners []= $callback; } + /** + * Get a list of all public group we're in + * + * @return array The groups indexed by their name + */ + public function getGroups(): array { + return $this->publicGroups; + } + /** * Get infomation about a public group we're in * diff --git a/src/Client/Multi.php b/src/Client/Multi.php index d9d708d..3d6601a 100644 --- a/src/Client/Multi.php +++ b/src/Client/Multi.php @@ -64,6 +64,15 @@ public function __construct( } } + /** + * Get a list of all public group we're in + * + * @return array The groups indexed by their name + */ + public function getGroups(): array { + return $this->getBestWorker()?->getGroups(); + } + /** * Get infomation about a public group we're in * diff --git a/src/Group.php b/src/Group.php index 3fbeb55..ce0bb9a 100644 --- a/src/Group.php +++ b/src/Group.php @@ -9,9 +9,9 @@ class Group { public const LOG = 0x02020000; final public function __construct( - public Group\Id $id, - public string $name, - public int $flags, + public readonly Group\Id $id, + public readonly string $name, + public readonly int $flags, ) { }