Skip to content

baseplace

roblox.bases.baseplace

This file contains the BasePlace object, which represents a Roblox place ID.

BasePlace (BaseAsset)

Represents a Roblox place ID. Places are a form of Asset and as such this object derives from BaseAsset.

Attributes:

Name Type Description
id int

The place ID.

Source code in roblox/bases/baseplace.py
class BasePlace(BaseAsset):
    """
    Represents a Roblox place ID.
    Places are a form of Asset and as such this object derives from BaseAsset.

    Attributes:
        id: The place ID.
    """

    def __init__(self, client: Client, place_id: int):
        """
        Arguments:
            client: The Client this object belongs to.
            place_id: The place ID.
        """

        super().__init__(client, place_id)

        self._client: Client = client
        self.id: int = place_id

    async def get_instances(self, start_index: int = 0):
        """
        Returns a list of this place's current active servers, known in the API as "game instances".
        This list always contains 10 items or fewer.
        For more items, add 10 to the start index and repeat until no more items are available.

        Arguments:
            start_index: Where to start in the server index.
        """
        from ..jobs import GameInstances

        instances_response = await self._client.requests.get(
            url=self._client.url_generator.get_url("www", f"games/getgameinstancesjson"),
            params={
                "placeId": self.id,
                "startIndex": start_index
            }
        )
        instances_data = instances_response.json()
        return GameInstances(
            client=self._client,
            data=instances_data
        )

__init__(self, client: Client, place_id: int) special

Parameters:

Name Type Description Default
client Client

The Client this object belongs to.

required
place_id int

The place ID.

required
Source code in roblox/bases/baseplace.py
def __init__(self, client: Client, place_id: int):
    """
    Arguments:
        client: The Client this object belongs to.
        place_id: The place ID.
    """

    super().__init__(client, place_id)

    self._client: Client = client
    self.id: int = place_id

get_instances(self, start_index: int = 0) async

Returns a list of this place's current active servers, known in the API as "game instances". This list always contains 10 items or fewer. For more items, add 10 to the start index and repeat until no more items are available.

Parameters:

Name Type Description Default
start_index int

Where to start in the server index.

0
Source code in roblox/bases/baseplace.py
async def get_instances(self, start_index: int = 0):
    """
    Returns a list of this place's current active servers, known in the API as "game instances".
    This list always contains 10 items or fewer.
    For more items, add 10 to the start index and repeat until no more items are available.

    Arguments:
        start_index: Where to start in the server index.
    """
    from ..jobs import GameInstances

    instances_response = await self._client.requests.get(
        url=self._client.url_generator.get_url("www", f"games/getgameinstancesjson"),
        params={
            "placeId": self.id,
            "startIndex": start_index
        }
    )
    instances_data = instances_response.json()
    return GameInstances(
        client=self._client,
        data=instances_data
    )