Skip to content

jobs

roblox.jobs

This module contains classes intended to parse and deal with data from Roblox server instance (or "job") endpoints.

GameInstance (BaseJob)

Represents a game (or place) instance, or "job".

Attributes:

Name Type Description
id str

The instance's job ID.

capacity int

The server's capacity.

ping int

The server's ping.

fps float

The server's FPS.

show_slow_game_message bool

Whether to show the "slow game" message.

place BasePlace

The server's place.

current_players List[GameInstancePlayer]

A list of the players in this server.

can_join bool

Whether the authenticated user can join this server.

show_shutdown_button bool

Whether to show the shutdown button on this server.

friends_description str

What text should be shown if this server is a "friends are in" server.

friends_mouseover

What text should be shown on mouseover if this server is a "friends are in" server.

capacity_message str

The server's capacity as a parsed message.

join_script str

JavaScript code that, when evaluated on a /games page on the Roblox website, launches this game.

app_join_script str

JavaScript code that, when evaluated on a /games page on the Roblox website, launches this game through the Roblox mobile app.

Source code in roblox/jobs.py
class GameInstance(BaseJob):
    """
    Represents a game (or place) instance, or "job".

    Attributes:
        id: The instance's job ID.
        capacity: The server's capacity.
        ping: The server's ping.
        fps: The server's FPS.
        show_slow_game_message: Whether to show the "slow game" message.
        place: The server's place.
        current_players: A list of the players in this server.
        can_join: Whether the authenticated user can join this server.
        show_shutdown_button: Whether to show the shutdown button on this server.
        friends_description: What text should be shown if this server is a "friends are in" server.
        friends_mouseover: What text should be shown on mouseover if this server is a "friends are in" server.
        capacity_message: The server's capacity as a parsed message.
        join_script: JavaScript code that, when evaluated on a /games page on the Roblox website, launches this game.
        app_join_script: JavaScript code that, when evaluated on a /games page on the Roblox website, launches this game
                         through the Roblox mobile app.
    """

    def __init__(self, client: Client, data: dict):
        self._client: Client = client
        self.id: str = data["Guid"]

        super().__init__(client=self._client, job_id=self.id)

        self.capacity: int = data["Capacity"]
        self.ping: int = data["Ping"]
        self.fps: float = data["Fps"]
        self.show_slow_game_message: bool = data["ShowSlowGameMessage"]
        self.place: BasePlace = BasePlace(client=self._client, place_id=data["PlaceId"])

        self.current_players: List[GameInstancePlayer] = [
            GameInstancePlayer(
                client=self._client,
                data=player_data
            ) for player_data in data["CurrentPlayers"]
        ]

        self.can_join: bool = data["UserCanJoin"]
        self.show_shutdown_button: bool = data["ShowShutdownButton"]
        self.friends_description: str = data["FriendsDescription"]
        self.friends_mouseover = data["FriendsMouseover"]
        self.capacity_message: str = data["PlayersCapacity"]  # TODO: reconsider

        self.join_script: str = data["JoinScript"]
        self.app_join_script: str = data["RobloxAppJoinScript"]

    def __repr__(self):
        return f"<{self.__class__.__name__} id={self.id!r} capacity{self.capacity}>"

__init__(self, client: Client, data: dict) special

Source code in roblox/jobs.py
def __init__(self, client: Client, data: dict):
    self._client: Client = client
    self.id: str = data["Guid"]

    super().__init__(client=self._client, job_id=self.id)

    self.capacity: int = data["Capacity"]
    self.ping: int = data["Ping"]
    self.fps: float = data["Fps"]
    self.show_slow_game_message: bool = data["ShowSlowGameMessage"]
    self.place: BasePlace = BasePlace(client=self._client, place_id=data["PlaceId"])

    self.current_players: List[GameInstancePlayer] = [
        GameInstancePlayer(
            client=self._client,
            data=player_data
        ) for player_data in data["CurrentPlayers"]
    ]

    self.can_join: bool = data["UserCanJoin"]
    self.show_shutdown_button: bool = data["ShowShutdownButton"]
    self.friends_description: str = data["FriendsDescription"]
    self.friends_mouseover = data["FriendsMouseover"]
    self.capacity_message: str = data["PlayersCapacity"]  # TODO: reconsider

    self.join_script: str = data["JoinScript"]
    self.app_join_script: str = data["RobloxAppJoinScript"]

__repr__(self) special

Source code in roblox/jobs.py
def __repr__(self):
    return f"<{self.__class__.__name__} id={self.id!r} capacity{self.capacity}>"

GameInstancePlayer (BaseUser)

Represents a single player in a game instance. Data, like user ID and username, may be filled with placeholder data. Do not rely on this object containing proper data. If the id attribute is 0, this object should not be used.

Attributes:

Name Type Description
id int

The player's user ID.

name str

The player's username.

thumbnail GameInstancePlayerThumbnail

The player's thumbnail.

Source code in roblox/jobs.py
class GameInstancePlayer(BaseUser):
    """
    Represents a single player in a game instance.
    Data, like user ID and username, may be filled with placeholder data.
    Do not rely on this object containing proper data. If the id attribute is 0, this object should not be used.

    Attributes:
        id: The player's user ID.
        name: The player's username.
        thumbnail: The player's thumbnail.
    """

    def __init__(self, client: Client, data: dict):
        self._client: Client = client
        self.id: int = data["Id"]
        super().__init__(client=self._client, user_id=self.id)

        self.name: str = data["Username"]
        self.thumbnail: GameInstancePlayerThumbnail = GameInstancePlayerThumbnail(
            client=self._client,
            data=data["Thumbnail"]
        )

    def __repr__(self):
        return f"<{self.__class__.__name__} id={self.id} name={self.name!r}>"

__init__(self, client: Client, data: dict) special

Source code in roblox/jobs.py
def __init__(self, client: Client, data: dict):
    self._client: Client = client
    self.id: int = data["Id"]
    super().__init__(client=self._client, user_id=self.id)

    self.name: str = data["Username"]
    self.thumbnail: GameInstancePlayerThumbnail = GameInstancePlayerThumbnail(
        client=self._client,
        data=data["Thumbnail"]
    )

__repr__(self) special

Source code in roblox/jobs.py
def __repr__(self):
    return f"<{self.__class__.__name__} id={self.id} name={self.name!r}>"

GameInstancePlayerThumbnail

Represent a player in a game instance's thumbnail. As the asset part of these thumbnails is no longer in use, this endpoint does not attempt to implement asset information.

Attributes:

Name Type Description
url str

The thumbnail's URL.

final bool

Whether the thumbnail is finalized or not.

Source code in roblox/jobs.py
class GameInstancePlayerThumbnail:
    """
    Represent a player in a game instance's thumbnail.
    As the asset part of these thumbnails is no longer in use, this endpoint does not attempt to implement asset
    information.

    Attributes:
        url: The thumbnail's URL.
        final: Whether the thumbnail is finalized or not.
    """

    def __init__(self, client: Client, data: dict):
        self._client: Client = client

        self.url: str = data["Url"]
        self.final: bool = data["IsFinal"]

    def __repr__(self):
        return f"<{self.__class__.__name__} url={self.url!r} final={self.final}"

__init__(self, client: Client, data: dict) special

Source code in roblox/jobs.py
def __init__(self, client: Client, data: dict):
    self._client: Client = client

    self.url: str = data["Url"]
    self.final: bool = data["IsFinal"]

__repr__(self) special

Source code in roblox/jobs.py
def __repr__(self):
    return f"<{self.__class__.__name__} url={self.url!r} final={self.final}"

GameInstances

Represents a game/place's active server instances.

Attributes:

Name Type Description
place BasePlace

The place.

show_shutdown_all_button bool

Whether to show the "Shutdown All" button on the server list.

is_game_instance_list_unavailable bool

Whether the list is unavailable.

collection List[GameInstance]

A list of the game instances.

total_collection_size int

How many active servers there are.

Source code in roblox/jobs.py
class GameInstances:
    """
    Represents a game/place's active server instances.

    Attributes:
        place: The place.
        show_shutdown_all_button: Whether to show the "Shutdown All" button on the server list.
        is_game_instance_list_unavailable: Whether the list is unavailable.
        collection: A list of the game instances.
        total_collection_size: How many active servers there are.
    """

    def __init__(self, client: Client, data: dict):
        self._client: Client = client

        self.place: BasePlace = BasePlace(client=self._client, place_id=data["PlaceId"])
        self.show_shutdown_all_button: bool = data["ShowShutdownAllButton"]
        self.is_game_instance_list_unavailable: bool = data["IsGameInstanceListUnavailable"]
        self.collection: List[GameInstance] = [
            GameInstance(
                client=self._client,
                data=instance_data
            ) for instance_data in data["Collection"]
        ]
        self.total_collection_size: int = data["TotalCollectionSize"]

__init__(self, client: Client, data: dict) special

Source code in roblox/jobs.py
def __init__(self, client: Client, data: dict):
    self._client: Client = client

    self.place: BasePlace = BasePlace(client=self._client, place_id=data["PlaceId"])
    self.show_shutdown_all_button: bool = data["ShowShutdownAllButton"]
    self.is_game_instance_list_unavailable: bool = data["IsGameInstanceListUnavailable"]
    self.collection: List[GameInstance] = [
        GameInstance(
            client=self._client,
            data=instance_data
        ) for instance_data in data["Collection"]
    ]
    self.total_collection_size: int = data["TotalCollectionSize"]