Skip to content

universes

This module contains classes intended to parse and deal with data from Roblox universe information endpoints.

Universe

Bases: BaseUniverse

Represents the response data of https://games.roblox.com/v1/games.

Attributes:

Name Type Description
id int

The ID of this specific universe

root_place BasePlace

The thumbnail provider object.

name str

The delivery provider object.

description str

The description of the game.

creator_type Enum

Is the creator a group or a user.

creator Union[PartialUser, UniversePartialGroup]

creator information.

price Optional[int]

how much you need to pay to play the game.

allowed_gear_genres List[str]

Unknown

allowed_gear_categories List[str]

Unknown

is_genre_enforced bool

Unknown

copying_allowed bool

are you allowed to copy the game.

playing int

amount of people currently playing the game.

visits int

amount of visits to the game.

max_players int

the maximum amount of players ber server.

created datetime

when the game was created.

updated datetime

when the game as been updated for the last time.

studio_access_to_apis_allowed bool

does studio have access to the apis.

create_vip_servers_allowed bool

can you create a vip server?

universe_avatar_type UniverseAvatarType

type of avatars in the game.

genre UniverseGenre

what genre the game is.

is_all_genre bool

if it is all genres?

is_favorited_by_user bool

if the authenticated user has it favorited.

favorited_count int

the total amount of people who favorited the game.

Source code in roblox/universes.py
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 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
117
118
119
120
121
122
123
124
125
class Universe(BaseUniverse):
    """
    Represents the response data of https://games.roblox.com/v1/games.

    Attributes:
        id: The ID of this specific universe
        root_place: The thumbnail provider object.
        name: The delivery provider object.
        description: The description of the game.
        creator_type: Is the creator a group or a user.
        creator: creator information.
        price: how much you need to pay to play the game.
        allowed_gear_genres: Unknown
        allowed_gear_categories: Unknown
        is_genre_enforced: Unknown
        copying_allowed: are you allowed to copy the game.
        playing: amount of people currently playing the game.
        visits: amount of visits to the game.
        max_players: the maximum amount of players ber server.
        created: when the game was created.
        updated: when the game as been updated for the last time.
        studio_access_to_apis_allowed: does studio have access to the apis.
        create_vip_servers_allowed: can you create a vip server?
        universe_avatar_type: type of avatars in the game.
        genre: what genre the game is.
        is_all_genre: if it is all genres?
        is_favorited_by_user: if the authenticated user has it favorited.
        favorited_count: the total amount of people who favorited the game.
    """

    def __init__(self, client: Client, data: dict):
        """
        Arguments:
            client: The Client.
            data: The universe data.
        """

        self._client: Client = client

        self.id: int = data["id"]
        super().__init__(client=client, universe_id=self.id)
        self.root_place: BasePlace = BasePlace(client=client, place_id=data["rootPlaceId"])
        self.name: str = data["name"]
        self.description: str = data["description"]
        self.creator_type: Enum = CreatorType(data["creator"]["type"])
        # isRNVAccount is not part of PartialUser, UniversePartialGroup
        self.creator: Union[PartialUser, UniversePartialGroup]
        if self.creator_type == CreatorType.group:
            self.creator = UniversePartialGroup(client, data["creator"])
        elif self.creator_type == CreatorType.user:
            self.creator = PartialUser(client, data["creator"])
        self.price: Optional[int] = data["price"]
        self.allowed_gear_genres: List[str] = data["allowedGearGenres"]
        self.allowed_gear_categories: List[str] = data["allowedGearCategories"]
        self.is_genre_enforced: bool = data["isGenreEnforced"]
        self.copying_allowed: bool = data["copyingAllowed"]
        self.playing: int = data["playing"]
        self.visits: int = data["visits"]
        self.max_players: int = data["maxPlayers"]
        self.created: datetime = parse(data["created"])
        self.updated: datetime = parse(data["updated"])
        self.studio_access_to_apis_allowed: bool = data["studioAccessToApisAllowed"]
        self.create_vip_servers_allowed: bool = data["createVipServersAllowed"]
        self.universe_avatar_type: UniverseAvatarType = UniverseAvatarType(data["universeAvatarType"])
        self.genre: UniverseGenre = UniverseGenre(data["genre"])
        self.is_all_genre: bool = data["isAllGenre"]
        # gameRating seems to be null across all games, so I omitted it from this class.
        self.is_favorited_by_user: bool = data["isFavoritedByUser"]
        self.favorited_count: int = data["favoritedCount"]

__init__(client, data)

Parameters:

Name Type Description Default
client Client

The Client.

required
data dict

The universe data.

required
Source code in roblox/universes.py
 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
117
118
119
120
121
122
123
124
125
def __init__(self, client: Client, data: dict):
    """
    Arguments:
        client: The Client.
        data: The universe data.
    """

    self._client: Client = client

    self.id: int = data["id"]
    super().__init__(client=client, universe_id=self.id)
    self.root_place: BasePlace = BasePlace(client=client, place_id=data["rootPlaceId"])
    self.name: str = data["name"]
    self.description: str = data["description"]
    self.creator_type: Enum = CreatorType(data["creator"]["type"])
    # isRNVAccount is not part of PartialUser, UniversePartialGroup
    self.creator: Union[PartialUser, UniversePartialGroup]
    if self.creator_type == CreatorType.group:
        self.creator = UniversePartialGroup(client, data["creator"])
    elif self.creator_type == CreatorType.user:
        self.creator = PartialUser(client, data["creator"])
    self.price: Optional[int] = data["price"]
    self.allowed_gear_genres: List[str] = data["allowedGearGenres"]
    self.allowed_gear_categories: List[str] = data["allowedGearCategories"]
    self.is_genre_enforced: bool = data["isGenreEnforced"]
    self.copying_allowed: bool = data["copyingAllowed"]
    self.playing: int = data["playing"]
    self.visits: int = data["visits"]
    self.max_players: int = data["maxPlayers"]
    self.created: datetime = parse(data["created"])
    self.updated: datetime = parse(data["updated"])
    self.studio_access_to_apis_allowed: bool = data["studioAccessToApisAllowed"]
    self.create_vip_servers_allowed: bool = data["createVipServersAllowed"]
    self.universe_avatar_type: UniverseAvatarType = UniverseAvatarType(data["universeAvatarType"])
    self.genre: UniverseGenre = UniverseGenre(data["genre"])
    self.is_all_genre: bool = data["isAllGenre"]
    # gameRating seems to be null across all games, so I omitted it from this class.
    self.is_favorited_by_user: bool = data["isFavoritedByUser"]
    self.favorited_count: int = data["favoritedCount"]

UniverseAvatarType

Bases: Enum

The current avatar type of the universe.

Source code in roblox/universes.py
25
26
27
28
29
30
31
32
class UniverseAvatarType(Enum):
    """
    The current avatar type of the universe.
    """

    R6 = "MorphToR6"
    R15 = "MorphToR15"
    player_choice = "PlayerChoice"

UniverseGenre

Bases: Enum

The universe's genre.

Source code in roblox/universes.py
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
class UniverseGenre(Enum):
    """
    The universe's genre.
    """

    all = "All"
    building = "Building"
    horror = "Horror"
    town_and_city = "Town and City"
    military = "Military"
    comedy = "Comedy"
    medieval = "Medieval"
    adventure = "Adventure"
    sci_fi = "Sci-Fi"
    naval = "Naval"
    fps = "FPS"
    rpg = "RPG"
    sports = "Sports"
    fighting = "Fighting"
    western = "Western"