instances
roblox.instances
¶
This module contains classes intended to parse and deal with data from Roblox item instance information endpoints.
instance_classes
¶
AssetInstance (ItemInstance)
¶
Represents an instance of a Roblox asset.
Source code in roblox/instances.py
class AssetInstance(ItemInstance):
"""
Represents an instance of a Roblox asset.
"""
def __init__(self, shared: ClientSharedObject, data: dict):
self._shared: ClientSharedObject = shared
super().__init__(shared=self._shared, data=data)
self.asset: BaseAsset = BaseAsset(shared=self._shared, asset_id=data["id"])
def __repr__(self):
return f"<{self.__class__.__name__} id={self.id} name={self.name!r} type={self.type} asset={self.asset}>"
__init__(self, shared: ClientSharedObject, data: dict)
special
¶
Source code in roblox/instances.py
def __init__(self, shared: ClientSharedObject, data: dict):
self._shared: ClientSharedObject = shared
super().__init__(shared=self._shared, data=data)
self.asset: BaseAsset = BaseAsset(shared=self._shared, asset_id=data["id"])
__repr__(self)
special
¶
Source code in roblox/instances.py
def __repr__(self):
return f"<{self.__class__.__name__} id={self.id} name={self.name!r} type={self.type} asset={self.asset}>"
BadgeInstance (ItemInstance)
¶
Represents an instance of a Roblox badge.
Source code in roblox/instances.py
class BadgeInstance(ItemInstance):
"""
Represents an instance of a Roblox badge.
"""
def __init__(self, shared: ClientSharedObject, data: dict):
self._shared: ClientSharedObject = shared
super().__init__(shared=self._shared, data=data)
self.badge: BaseBadge = BaseBadge(shared=self._shared, badge_id=data["id"])
def __repr__(self):
return f"<{self.__class__.__name__} id={self.id} name={self.name!r} type={self.type} badge={self.badge}>"
__init__(self, shared: ClientSharedObject, data: dict)
special
¶
Source code in roblox/instances.py
def __init__(self, shared: ClientSharedObject, data: dict):
self._shared: ClientSharedObject = shared
super().__init__(shared=self._shared, data=data)
self.badge: BaseBadge = BaseBadge(shared=self._shared, badge_id=data["id"])
__repr__(self)
special
¶
Source code in roblox/instances.py
def __repr__(self):
return f"<{self.__class__.__name__} id={self.id} name={self.name!r} type={self.type} badge={self.badge}>"
GamePassInstance (ItemInstance)
¶
Represents an instance of a Roblox gamepass.
Source code in roblox/instances.py
class GamePassInstance(ItemInstance):
"""
Represents an instance of a Roblox gamepass.
"""
def __init__(self, shared: ClientSharedObject, data: dict):
self._shared: ClientSharedObject = shared
super().__init__(shared=self._shared, data=data)
self.gamepass: BaseGamePass = BaseGamePass(shared=self._shared, gamepass_id=data["id"])
def __repr__(self):
return f"<{self.__class__.__name__} id={self.id} name={self.name!r} type={self.type} gamepass={self.gamepass}>"
__init__(self, shared: ClientSharedObject, data: dict)
special
¶
Source code in roblox/instances.py
def __init__(self, shared: ClientSharedObject, data: dict):
self._shared: ClientSharedObject = shared
super().__init__(shared=self._shared, data=data)
self.gamepass: BaseGamePass = BaseGamePass(shared=self._shared, gamepass_id=data["id"])
__repr__(self)
special
¶
Source code in roblox/instances.py
def __repr__(self):
return f"<{self.__class__.__name__} id={self.id} name={self.name!r} type={self.type} gamepass={self.gamepass}>"
InstanceType (Enum)
¶
ItemInstance (BaseInstance)
¶
Represents an instance of a Roblox item of some kind.
Attributes:
Name | Type | Description |
---|---|---|
_shared |
ClientSharedObject |
The shared object, which is passed to all objects this client generates. |
Source code in roblox/instances.py
class ItemInstance(BaseInstance):
"""
Represents an instance of a Roblox item of some kind.
Attributes:
_shared: The shared object, which is passed to all objects this client generates.
"""
def __init__(self, shared: ClientSharedObject, data: dict):
"""
Arguments:
shared: The ClientSharedObject.
data: The data from the endpoint.
"""
self._shared: ClientSharedObject = shared
self.name: str = data["name"]
self.type: str = data["type"] # fixme
super().__init__(shared=self._shared, instance_id=data["instanceId"])
def __repr__(self):
return f"<{self.__class__.__name__} id={self.id} name={self.name!r} type={self.type}>"
__init__(self, shared: ClientSharedObject, data: dict)
special
¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
shared |
ClientSharedObject |
The ClientSharedObject. |
required |
data |
dict |
The data from the endpoint. |
required |
Source code in roblox/instances.py
def __init__(self, shared: ClientSharedObject, data: dict):
"""
Arguments:
shared: The ClientSharedObject.
data: The data from the endpoint.
"""
self._shared: ClientSharedObject = shared
self.name: str = data["name"]
self.type: str = data["type"] # fixme
super().__init__(shared=self._shared, instance_id=data["instanceId"])
__repr__(self)
special
¶
Source code in roblox/instances.py
def __repr__(self):
return f"<{self.__class__.__name__} id={self.id} name={self.name!r} type={self.type}>"