๐Ÿ˜๏ธ Get_rooms

๐Ÿ˜๏ธ Get_rooms

Added on version 23.1.0b14
get_rooms(self, starts_after: str = "", ends_before: str = "", sort_order: SORT_OPTION = "desc", limit: int = 20, room_name: str = "", owner_id: str = "",) -> GetPublicRoomsResponse:
Fetch a list of users, can be filtered, ordered, and paginated.
Parameters:
  • owner_id: The ID of the user who owns the rooms you want to retrieve.
  • sort_order: Determines the order in which results are returned. Can be eitherย ascย for ascending order orย descย for descending order.
  • starts_after: The ID of the room from which to start the query. This is useful for paginating results.
  • ends_before: The ID of the room to end the query before. This is also useful for paginating results.
  • limit: The maximum number of rooms to retrieve per request.
Returns:
  • GetPublicRoomsResponse: A list of public data of rooms.

โš™๏ธ Use cases

Hereโ€™s a simple example to retrieve the person whoโ€™s sending the message rooms in the terminal:
async def on_chat(self, user: User, message: str) -> None: if message.lower().startswith("/getrooms"): owner_id = user.id rooms = await self.webapi.get_rooms(owner_id=owner_id) print (rooms)
notion image
Response:
GetPublicRoomsResponse( rooms=[ RoomBasic( room_id='644092e5340c8893f900cb6c', disp_name='Cassino', description='None', category='mafia', owner_id='6111e1fb22dcb50edf32e4a8', created_at='2023-04-20T01:18:29.381000+00:00', access_policy='everyone', locale=['en'], is_home_room=False, designer_ids=['605aba51da5a6c3e712f5808'], moderator_ids=['605aba51da5a6c3e712f5808']), RoomBasic( room_id='61186670bd5272731251a06f', disp_name="Vini's Bedroom", description='None', category='hangout', owner_id='6111e1fb22dcb50edf32e4a8', created_at='2021-08-15T00:57:20.245000+00:00', access_policy='everyone', locale=['pt'], is_home_room=True, designer_ids=['605aba51da5a6c3e712f5808'], moderator_ids=['605aba51da5a6c3e712f5808'])], total=40952940, first_id='644092e5340c8893f900cb6c', last_id='61186670bd5272731251a06f')
ย 
Built with Potion.so