Skip to content

conversations

Contains objects related to Roblox chat conversations.

Conversation

Bases: BaseConversation

Represents a Roblox chat conversation.

Attributes:

Name Type Description
id int

Chat conversation ID.

title str

Chat conversation title.

initiator PartialUser

Conversation initiator entity.

has_unread_messages bool

Whether the conversation have any unread messages.

participants List[PartialUser]

Participants involved in the conversation.

conversation_type ConversationType

Type of the conversation.

conversation_title ConversationTitle

Specifies if the conversation title is generated by default.

last_updated datetime

Specifies the datetime when the conversation was last updated.

conversation_universe Optional[ChatPartialUniverse]

Specifies the universe associated with the conversation.

Source code in roblox/conversations.py
 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
class Conversation(BaseConversation):
    """
    Represents a Roblox chat conversation.

    Attributes:
        id: Chat conversation ID.
        title: Chat conversation title.
        initiator: Conversation initiator entity.
        has_unread_messages: Whether the conversation have any unread messages.
        participants: Participants involved in the conversation.
        conversation_type: Type of the conversation.
        conversation_title: Specifies if the conversation title is generated by default.
        last_updated: Specifies the datetime when the conversation was last updated.
        conversation_universe: Specifies the universe associated with the conversation.
    """

    def __init__(self, client: Client, data: dict):
        """
        Arguments:
            client: The Client object.
            data: The conversation data.
        """
        super().__init__(client=client, conversation_id=self.id)
        self.id: int = data["id"]
        self.title: str = data["title"]

        # Technically the initiator could be a group, but in practice that doesn't happen
        # so this is a partialuser
        # Nikita Petko: Well uhhh, the initiator is of the ChatParticipant model,
        # where it can either be from User or System.
        self.initiator: PartialUser = PartialUser(client, data["initiator"])

        self.has_unread_messages: bool = data["hasUnreadMessages"]
        self.participants: List[PartialUser] = [PartialUser(
            client=client,
            data=participant_data
        ) for participant_data in data["participants"]]

        self.conversation_type: ConversationType = ConversationType(data["conversationType"])
        self.conversation_title: ConversationTitle = ConversationTitle(
            data=data["conversationTitle"]
        )
        self.last_updated: datetime = parse(data["lastUpdated"])
        self.conversation_universe: Optional[ChatPartialUniverse] = data[
                                                                        "conversationUniverse"] and ChatPartialUniverse(
            client=client,
            data=data["conversationUniverse"]
        )

__init__(client, data)

Parameters:

Name Type Description Default
client Client

The Client object.

required
data dict

The conversation data.

required
Source code in roblox/conversations.py
 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
def __init__(self, client: Client, data: dict):
    """
    Arguments:
        client: The Client object.
        data: The conversation data.
    """
    super().__init__(client=client, conversation_id=self.id)
    self.id: int = data["id"]
    self.title: str = data["title"]

    # Technically the initiator could be a group, but in practice that doesn't happen
    # so this is a partialuser
    # Nikita Petko: Well uhhh, the initiator is of the ChatParticipant model,
    # where it can either be from User or System.
    self.initiator: PartialUser = PartialUser(client, data["initiator"])

    self.has_unread_messages: bool = data["hasUnreadMessages"]
    self.participants: List[PartialUser] = [PartialUser(
        client=client,
        data=participant_data
    ) for participant_data in data["participants"]]

    self.conversation_type: ConversationType = ConversationType(data["conversationType"])
    self.conversation_title: ConversationTitle = ConversationTitle(
        data=data["conversationTitle"]
    )
    self.last_updated: datetime = parse(data["lastUpdated"])
    self.conversation_universe: Optional[ChatPartialUniverse] = data[
                                                                    "conversationUniverse"] and ChatPartialUniverse(
        client=client,
        data=data["conversationUniverse"]
    )

ConversationTitle

A chat conversation's title.

Attributes:

Name Type Description
title_for_viewer str

Specifies the title for the conversation specific to the viewer.

is_default_title bool

Specifies if the title displayed for the user is generated as a default title or was edited by the user.

Source code in roblox/conversations.py
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
class ConversationTitle:
    """
    A chat conversation's title.

    Attributes:
        title_for_viewer: Specifies the title for the conversation specific to the viewer.
        is_default_title: Specifies if the title displayed for the user is generated as a default title or was edited by
                          the user.
    """

    def __init__(self, data: dict):
        """
        Arguments:
            data: The raw input data.
        """
        self.title_for_viewer: str = data["titleForViewer"]
        self.is_default_title: bool = data["isDefaultTitle"]

    def __repr__(self):
        return f"<{self.__class__.__name__} title_for_viewer={self.title_for_viewer!r} is_default_title={self.is_default_title}>"

__init__(data)

Parameters:

Name Type Description Default
data dict

The raw input data.

required
Source code in roblox/conversations.py
48
49
50
51
52
53
54
def __init__(self, data: dict):
    """
    Arguments:
        data: The raw input data.
    """
    self.title_for_viewer: str = data["titleForViewer"]
    self.is_default_title: bool = data["isDefaultTitle"]

ConversationType

Bases: Enum

A chat conversation's type.

Source code in roblox/conversations.py
25
26
27
28
29
30
31
32
33
34
35
class ConversationType(Enum):
    """
    A chat conversation's type.
    """

    multi_user_conversation = "MultiUserConversation"
    """Represents a chat with multiples users on the website."""
    one_to_one_conversation = "OneToOneConversation"
    """Represents a one-to-one conversation with person A and B."""
    cloud_edit_conversation = "CloudEditConversation"
    """Represents a chat in a team-create session."""

cloud_edit_conversation = 'CloudEditConversation' class-attribute instance-attribute

Represents a chat in a team-create session.

multi_user_conversation = 'MultiUserConversation' class-attribute instance-attribute

Represents a chat with multiples users on the website.

one_to_one_conversation = 'OneToOneConversation' class-attribute instance-attribute

Represents a one-to-one conversation with person A and B.