Make main region caps less annoying to work with

This commit is contained in:
Salad Dais
2023-12-14 02:19:11 +00:00
parent 92c9c82e73
commit 0456b4b62d
2 changed files with 11 additions and 0 deletions

View File

@@ -32,6 +32,11 @@ async def amain():
print("I'm here")
await client.send_chat("Hello World!", chat_type=ChatType.SHOUT)
client.session.message_handler.subscribe("ChatFromSimulator", _respond_to_chat)
# Example of how to work with caps
async with client.main_region.caps_client.get("SimulatorFeatures") as features_resp:
print("Features:", await features_resp.read_llsd())
while True:
try:
await asyncio.sleep(0.001)

View File

@@ -376,6 +376,12 @@ class HippoClient(BaseClientSessionManager):
self.settings = ClientSettings()
self._resend_task: Optional[asyncio.Task] = None
@property
def main_region(self) -> Optional[HippoClientRegion]:
if not self.session:
return None
return self.session.main_region
async def aclose(self):
try:
if self.session: