Skip to content

jobs

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

GameInstance

Bases: 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
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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"]

GameInstancePlayer

Bases: 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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"]
        )

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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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}"

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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
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"]

PrivateServer

Bases: Server

Represents a private server.

Attributes:

Name Type Description
id

The private server's job id.

vip_server_id int

The private server's vipServerId.

max_players int

The maximum number of players that can be in the server at once.

playing int

The amount of players in the server.

player_tokens int

A list of thumbnail tokens for all the players in the server.

players int

A list of ServerPlayer objects representing the players in the server. Only friends of the authenticated user will show up here.

fps int

The server's fps.

ping int

The server's ping.

name str

The private server's name.

access_code str

The private server's access code.

owner PartialUser

A PartialUser object representing the owner of the private server.

Source code in roblox/jobs.py
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
class PrivateServer(Server):
    """
    Represents a private server.

    Attributes:
        id: The private server's job id.
        vip_server_id: The private server's vipServerId.
        max_players: The maximum number of players that can be in the server at once.
        playing: The amount of players in the server.
        player_tokens: A list of thumbnail tokens for all the players in the server.
        players: A list of ServerPlayer objects representing the players in the server. Only friends of the authenticated user will show up here.
        fps: The server's fps.
        ping: The server's ping.
        name: The private server's name.
        access_code: The private server's access code.
        owner: A PartialUser object representing the owner of the private server.
    """

    def __init__(self, client: Client, data: dict):
        """
        Arguments:
            client: The Client this object belongs to.
            data: A PrivateServerResponse object.
        """

        super().__init__(client=client, data=data)

        self.name: str = data["name"]
        self.vip_server_id: int = data["vipServerId"]
        self.access_code: str = data["accessCode"]
        self.owner: PartialUser = PartialUser(client=self._client, data=data["owner"])

__init__(client, data)

Parameters:

Name Type Description Default
client Client

The Client this object belongs to.

required
data dict

A PrivateServerResponse object.

required
Source code in roblox/jobs.py
234
235
236
237
238
239
240
241
242
243
244
245
246
def __init__(self, client: Client, data: dict):
    """
    Arguments:
        client: The Client this object belongs to.
        data: A PrivateServerResponse object.
    """

    super().__init__(client=client, data=data)

    self.name: str = data["name"]
    self.vip_server_id: int = data["vipServerId"]
    self.access_code: str = data["accessCode"]
    self.owner: PartialUser = PartialUser(client=self._client, data=data["owner"])

Server

Bases: BaseItem

Represents a public server.

Attributes:

Name Type Description
id Optional[str]

The server's job id.

max_players int

The maximum number of players that can be in the server at once.

playing int

The amount of players in the server.

player_tokens List[str]

A list of thumbnail tokens for all the players in the server.

players List[ServerPlayer]

A list of ServerPlayer objects representing the players in the server. Only friends of the authenticated user will show up here.

fps float

The server's fps.

ping Optional[int]

The server's ping.

Source code in roblox/jobs.py
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
class Server(BaseItem):
    """
    Represents a public server.

    Attributes:
        id: The server's job id.
        max_players: The maximum number of players that can be in the server at once.
        playing: The amount of players in the server.
        player_tokens: A list of thumbnail tokens for all the players in the server.
        players: A list of ServerPlayer objects representing the players in the server. Only friends of the authenticated user will show up here.
        fps: The server's fps.
        ping: The server's ping.
    """

    def __init__(self, client: Client, data: dict):
        """
        Arguments:
            client: The Client this object belongs to.
            data: A GameServerResponse object.
        """

        self._client: Client = client

        self.id: Optional[str] = data.get("id")
        self.max_players: int = data["maxPlayers"]
        self.playing: int = data.get("playing", 0)
        self.player_tokens: List[str] = data["playerTokens"]
        self.players: List[ServerPlayer] = [
            ServerPlayer(client=self._client, data=player_data) 
            for player_data in data["players"]
        ]

        self.fps: float = data.get("fps")
        self.ping: Optional[int] = data.get("ping")

__init__(client, data)

Parameters:

Name Type Description Default
client Client

The Client this object belongs to.

required
data dict

A GameServerResponse object.

required
Source code in roblox/jobs.py
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
def __init__(self, client: Client, data: dict):
    """
    Arguments:
        client: The Client this object belongs to.
        data: A GameServerResponse object.
    """

    self._client: Client = client

    self.id: Optional[str] = data.get("id")
    self.max_players: int = data["maxPlayers"]
    self.playing: int = data.get("playing", 0)
    self.player_tokens: List[str] = data["playerTokens"]
    self.players: List[ServerPlayer] = [
        ServerPlayer(client=self._client, data=player_data) 
        for player_data in data["players"]
    ]

    self.fps: float = data.get("fps")
    self.ping: Optional[int] = data.get("ping")

ServerPlayer

Bases: BaseUser

Represents a player in a server.

Attributes:

Name Type Description
id

The player's user id.

name str

The player's username.

display_name str

The player's display name.

player_token str

The player's token.

Source code in roblox/jobs.py
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
class ServerPlayer(BaseUser):
    """
    Represents a player in a server.

    Attributes:
        id: The player's user id.
        name: The player's username.
        display_name: The player's display name.
        player_token: The player's token.
    """

    def __init__(self, client: Client, data: dict):
        """
        Arguments:
            client: The Client this object belongs to.
            data: A GameServerPlayerResponse object.
        """

        super().__init__(client=client, user_id=data["id"])

        self.player_token: str = data["playerToken"]
        self.name: str = data["name"]
        self.display_name: str = data["displayName"]

__init__(client, data)

Parameters:

Name Type Description Default
client Client

The Client this object belongs to.

required
data dict

A GameServerPlayerResponse object.

required
Source code in roblox/jobs.py
166
167
168
169
170
171
172
173
174
175
176
177
def __init__(self, client: Client, data: dict):
    """
    Arguments:
        client: The Client this object belongs to.
        data: A GameServerPlayerResponse object.
    """

    super().__init__(client=client, user_id=data["id"])

    self.player_token: str = data["playerToken"]
    self.name: str = data["name"]
    self.display_name: str = data["displayName"]

ServerType

Bases: Enum

Represents the type of server.

Source code in roblox/jobs.py
146
147
148
149
150
151
152
class ServerType(Enum):
    """
    Represents the type of server.
    """

    public = "Public"
    friend = "Friend"