Skip to content

groups

Contains classes related to Roblox group data and parsing.

Group

Bases: BaseGroup

Represents a group.

Attributes:

Name Type Description
id int

the id of the group.

name str

name of the group.

description str

description of the group.

owner Optional[PartialUser]

player who owns the group.

shout Optional[Shout]

the current group shout.

member_count int

amount of members in the group.

is_builders_club_only bool

can only people with builder club join.

public_entry_allowed bool

can you join without your join request having to be accepted.

is_locked bool

Is the group locked?

has_verified_badge bool

If the group has a verified badge.

Source code in roblox/groups.py
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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
class Group(BaseGroup):
    """
    Represents a group.

    Attributes:
        id: the id of the group.
        name: name of the group.
        description: description of the group.
        owner: player who owns the group.
        shout: the current group shout.
        member_count: amount of members in the group.
        is_builders_club_only: can only people with builder club join.
        public_entry_allowed: can you join without your join request having to be accepted.
        is_locked: Is the group locked?
        has_verified_badge: If the group has a verified badge.
    """

    def __init__(self, client: Client, data: dict):
        """
        Arguments:
            data: The data we get back from the endpoint.
            client: The Client object, which is passed to all objects this Client generates.
        """
        super().__init__(client, data["id"])

        self._client: Client = client

        self.id: int = data["id"]
        self.name: str = data["name"]
        self.description: str = data["description"]
        self.owner: Optional[PartialUser] = PartialUser(client=client, data=data["owner"]) if data.get("owner") else \
            None
        self.shout: Optional[Shout] = Shout(
            client=self._client,
            data=data["shout"]
        ) if data.get("shout") else None

        self.member_count: int = data["memberCount"]
        self.is_builders_club_only: bool = data["isBuildersClubOnly"]
        self.public_entry_allowed: bool = data["publicEntryAllowed"]
        self.is_locked: bool = data.get("isLocked") or False
        self.has_verified_badge: bool = data["hasVerifiedBadge"]

    async def update_shout(self, message: str, update_self: bool = True) -> Tuple[Optional[Shout], Optional[Shout]]:
        """
        Updates the shout.

        Arguments:
            message: The new shout message.
            update_self: Whether to update self.shout automatically.
        Returns: 
            The old and new shout.
        """
        shout_response = await self._client.requests.patch(
            url=self._client.url_generator.get_url("groups", f"v1/groups/{self.id}/status"),
            json={
                "message": message
            }
        )

        shout_data = shout_response.json()

        old_shout: Optional[Shout] = self.shout
        new_shout: Optional[Shout] = shout_data and Shout(
            client=self._client,
            data=shout_data
        ) or None

        if update_self:
            self.shout = new_shout

        return old_shout, new_shout

__init__(client, data)

Parameters:

Name Type Description Default
data dict

The data we get back from the endpoint.

required
client Client

The Client object, which is passed to all objects this Client generates.

required
Source code in roblox/groups.py
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
def __init__(self, client: Client, data: dict):
    """
    Arguments:
        data: The data we get back from the endpoint.
        client: The Client object, which is passed to all objects this Client generates.
    """
    super().__init__(client, data["id"])

    self._client: Client = client

    self.id: int = data["id"]
    self.name: str = data["name"]
    self.description: str = data["description"]
    self.owner: Optional[PartialUser] = PartialUser(client=client, data=data["owner"]) if data.get("owner") else \
        None
    self.shout: Optional[Shout] = Shout(
        client=self._client,
        data=data["shout"]
    ) if data.get("shout") else None

    self.member_count: int = data["memberCount"]
    self.is_builders_club_only: bool = data["isBuildersClubOnly"]
    self.public_entry_allowed: bool = data["publicEntryAllowed"]
    self.is_locked: bool = data.get("isLocked") or False
    self.has_verified_badge: bool = data["hasVerifiedBadge"]

update_shout(message, update_self=True) async

Updates the shout.

Parameters:

Name Type Description Default
message str

The new shout message.

required
update_self bool

Whether to update self.shout automatically.

True
Source code in roblox/groups.py
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
async def update_shout(self, message: str, update_self: bool = True) -> Tuple[Optional[Shout], Optional[Shout]]:
    """
    Updates the shout.

    Arguments:
        message: The new shout message.
        update_self: Whether to update self.shout automatically.
    Returns: 
        The old and new shout.
    """
    shout_response = await self._client.requests.patch(
        url=self._client.url_generator.get_url("groups", f"v1/groups/{self.id}/status"),
        json={
            "message": message
        }
    )

    shout_data = shout_response.json()

    old_shout: Optional[Shout] = self.shout
    new_shout: Optional[Shout] = shout_data and Shout(
        client=self._client,
        data=shout_data
    ) or None

    if update_self:
        self.shout = new_shout

    return old_shout, new_shout