members
roblox.members
¶
This module contains classes intended to parse and deal with data from Roblox group member endpoints.
Member (MemberRelationship)
¶
Represents a group member.
Attributes:
Name | Type | Description |
---|---|---|
_shared |
ClientSharedObject |
The shared object. |
role |
PartialRole |
The member's role. |
group |
BaseGroup |
The member's group. |
Source code in roblox/members.py
class Member(MemberRelationship):
"""
Represents a group member.
Attributes:
_shared: The shared object.
role: The member's role.
group: The member's group.
"""
def __init__(self, shared: ClientSharedObject, data: dict, group: BaseGroup):
self._shared: ClientSharedObject = shared
self.id: int = data["user"]["userId"]
self.name: str = data["user"]["username"]
self.display_name: str = data["user"]["displayName"]
super().__init__(shared=self._shared, user=self.id, group=group)
self.role: PartialRole = PartialRole(shared=self._shared, data=data["role"])
self.group: BaseGroup = group
def __repr__(self):
return f"<{self.__class__.__name__} id={self.id} name={self.name!r} role={self.role}>"
__init__(self, shared: ClientSharedObject, data: dict, group: BaseGroup)
special
¶
Source code in roblox/members.py
def __init__(self, shared: ClientSharedObject, data: dict, group: BaseGroup):
self._shared: ClientSharedObject = shared
self.id: int = data["user"]["userId"]
self.name: str = data["user"]["username"]
self.display_name: str = data["user"]["displayName"]
super().__init__(shared=self._shared, user=self.id, group=group)
self.role: PartialRole = PartialRole(shared=self._shared, data=data["role"])
self.group: BaseGroup = group
__repr__(self)
special
¶
Source code in roblox/members.py
def __repr__(self):
return f"<{self.__class__.__name__} id={self.id} name={self.name!r} role={self.role}>"
MemberRelationship (BaseUser)
¶
Represents a relationship between a user and a group.
Source code in roblox/members.py
class MemberRelationship(BaseUser):
"""
Represents a relationship between a user and a group.
"""
def __init__(self, shared: ClientSharedObject, user: Union[BaseUser, int], group: Union[BaseGroup, int]):
self._shared: ClientSharedObject = shared
super().__init__(shared=self._shared, user_id=int(user))
self.group: BaseGroup
if isinstance(group, int):
self.group = BaseGroup(shared=self._shared, group_id=group)
else:
self.group = group
async def set_role(self, role: RoleOrRoleId):
"""
Sets this member's role.
Arguments:
role: The new role this member should be assigned.
"""
await self.group.set_role(self, role)
async def set_rank(self, rank: int):
"""
Sets this member's rank.
Arguments:
rank: The new rank this member should be assigned. Should be in the range of 0-255.
"""
await self.group.set_rank(self, rank)
async def kick(self):
"""
Kicks this member from the group.
"""
await self.group.kick_user(self)
__init__(self, shared: ClientSharedObject, user: Union[BaseUser, int], group: Union[BaseGroup, int])
special
¶
Source code in roblox/members.py
def __init__(self, shared: ClientSharedObject, user: Union[BaseUser, int], group: Union[BaseGroup, int]):
self._shared: ClientSharedObject = shared
super().__init__(shared=self._shared, user_id=int(user))
self.group: BaseGroup
if isinstance(group, int):
self.group = BaseGroup(shared=self._shared, group_id=group)
else:
self.group = group
kick(self)
async
¶
Kicks this member from the group.
Source code in roblox/members.py
async def kick(self):
"""
Kicks this member from the group.
"""
await self.group.kick_user(self)
set_rank(self, rank: int)
async
¶
Sets this member's rank.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rank |
int |
The new rank this member should be assigned. Should be in the range of 0-255. |
required |
Source code in roblox/members.py
async def set_rank(self, rank: int):
"""
Sets this member's rank.
Arguments:
rank: The new rank this member should be assigned. Should be in the range of 0-255.
"""
await self.group.set_rank(self, rank)
set_role(self, role: RoleOrRoleId)
async
¶
Sets this member's role.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
role |
RoleOrRoleId |
The new role this member should be assigned. |
required |
Source code in roblox/members.py
async def set_role(self, role: RoleOrRoleId):
"""
Sets this member's role.
Arguments:
role: The new role this member should be assigned.
"""
await self.group.set_role(self, role)