> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PartyChatTextReceivedStateChange

> Information specific to the *ChatTextReceived* type of state change.

Information specific to the *ChatTextReceived* type of state change.

## Syntax

```cpp theme={null}
struct PartyChatTextReceivedStateChange : PartyStateChange {  
    PartyChatControl* senderChatControl;  
    uint32_t receiverChatControlCount;  
    PartyLocalChatControlArray receiverChatControls;  
    PartyString languageCode;  
    PartyString chatText;  
    uint32_t dataSize;  
    const void* data;  
    uint32_t translationCount;  
    PartyTranslation* translations;  
    PartyChatTextReceivedOptions options;  
    PartyString originalChatText;  
    PartyError errorDetail;  
}  
```

### Members

**`senderChatControl`**   [PartyChatControl](/services/playfab/multiplayer/networking/reference/classes/PartyChatControl/partychatcontrol)\*

The chat control object that originated the text message.

**`receiverChatControlCount`**   uint32\_t

The number of local receiver chat controls to which the text message is addressed.

**`receiverChatControls`**   [PartyLocalChatControlArray](/services/playfab/multiplayer/networking/reference/typedefs)\
*array of size `receiverChatControlCount`*

The local receiver chat controls to which the text message is addressed.

**`languageCode`**   [PartyString](/services/playfab/multiplayer/networking/reference/typedefs)

The language of the chat text.

The language is only provided when translation to the local language is enabled. If translation isn't enabled, or failure is encountered during translation, the language code is an empty string. <br /><br /> The language code is in BCP 47 format, such as en-US for English (United States). Supported language codes are enumerated in [Language support](https://learn.microsoft.com/en-us/azure/ai-services/speech-service/language-support).

**`chatText`**   [PartyString](/services/playfab/multiplayer/networking/reference/typedefs)

The received chat text.

The string may be up to `c_maxChatTextMessageLength` characters long, not including the null terminator. <br /><br /> When filtering is enabled, this text may not be the exact text sent by the remote user. The exact source text can be retrieved from the `originalChatText` field.

**`dataSize`**   uint32\_t

The size of the data associated with this text message.

**`data`**   const void\*\
*buffer of size `dataSize` bytes*

The data associated with this text message.

**`translationCount`**   uint32\_t

The number of translations associated with the chat text.

Translations are provided if [PartyTextChatOptions::TranslateToLocalLanguage](/services/playfab/multiplayer/networking/reference/enums/partytextchatoptions) has previously been specified via [PartyLocalChatControl::SetTextChatOptions()](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_settextchatoptions) on a chat control local to this device. There may be more than one translation if multiple local chat controls have enabled translation and the local chat controls have specified different languages via [PartyLocalDevice::CreateChatControl()](/services/playfab/multiplayer/networking/reference/classes/PartyLocalDevice/methods/partylocaldevice_createchatcontrol). In that case, the app can compare the `languageCode` field of each PartyTranslation in `translations` against the language code, obtained via [PartyLocalChatControl::GetLanguage()](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_getlanguage), for each local chat control in `receiverChatControls` to determine the target local chat control for each translation.

**`translations`**   [PartyTranslation](/services/playfab/multiplayer/networking/reference/structs/partytranslation)\*\
*array of size `translationCount`*

An array containing the translations of the chat text string.

Translations are provided if [PartyTextChatOptions::TranslateToLocalLanguage](/services/playfab/multiplayer/networking/reference/enums/partytextchatoptions) has previously been specified via [PartyLocalChatControl::SetTextChatOptions()](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_settextchatoptions) on a chat control local to this device. There may be more than one translation if multiple local chat controls have enabled translation and the local chat controls have specified different languages via [PartyLocalDevice::CreateChatControl()](/services/playfab/multiplayer/networking/reference/classes/PartyLocalDevice/methods/partylocaldevice_createchatcontrol). In that case, the app can compare the `languageCode` field of each PartyTranslation in `translations` against the language code, obtained via [PartyLocalChatControl::GetLanguage()](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_getlanguage), for each local chat control in `receiverChatControls` to determine the target local chat control for each translation.

**`options`**   [PartyChatTextReceivedOptions](/services/playfab/multiplayer/networking/reference/enums/partychattextreceivedoptions)

Flags describing additional information about the chat text.

**`originalChatText`**   [PartyString](/services/playfab/multiplayer/networking/reference/typedefs)

The original version of the incoming text chat.

This field is always the unfiltered source text sent by the remote user. If filtering isn't enabled, it's a pointer to `chatText`. If filtering is enabled but filtering was not needed, as indicated by PartyChatTextReceivedOptions::None in the `options` field, then this is a pointer to `chatText`.

**`errorDetail`**   PartyError

A diagnostic value providing additional troubleshooting information regarding any potential error condition.

This error is intended for diagnostic purposes only. If an error occurs, the [PartyChatTextReceivedOptions::FilteredDueToError](/services/playfab/multiplayer/networking/reference/enums/partychattextreceivedoptions) flag will be present in the `options` field.

## Requirements

**Header:** Party.h

## See also

[Party members](/services/playfab/multiplayer/networking/reference/party_members)\
[PartyLocalDevice::CreateChatControl](/services/playfab/multiplayer/networking/reference/classes/PartyLocalDevice/methods/partylocaldevice_createchatcontrol)\
[PartyLocalChatControl::SendText](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_sendtext)\
[PartyLocalChatControl::SetTextChatOptions](/services/playfab/multiplayer/networking/reference/classes/PartyLocalChatControl/methods/partylocalchatcontrol_settextchatoptions)
