# ChatData

Kind: Class · Namespace: Sansar.Simulation · Assembly: Sansar.Simulation.dll · Script API 47.10.0

<div class="api-meta">
<span class="api-kind api-kind-class" data-pagefind-filter="kind:Class">Class</span>
<span data-pagefind-filter="namespace:Sansar.Simulation">Namespace <a href="/scripting/api/sansar.simulation"><code>Sansar.Simulation</code></a></span>
<span>Inherits <a href="/scripting/api/sansar.script/eventdata">Sansar.Script.EventData</a></span>
</div>

<span id="T:Sansar.Simulation.ChatData"></span>

Subscribe to receive events on chat messages from the system, users or scripts.

```csharp
public class ChatData : Sansar.Script.EventData
```

## Members at a glance

| Kind | Members |
|---|---|
| **Properties** | [Channel](#channel) · [Message](#message) · [Source](#source) · [SourceId](#sourceid) · [SourceScriptId](#sourcescriptid) |
| **Methods** | [ToString](#tostring) |

## Properties

### Channel

<div class="api-card">
<span id="P:Sansar.Simulation.ChatData.Channel"></span>

```csharp signature
public int Channel { get; }
```

int channel which the chat occurs on.

</div>

### Message

<div class="api-card">
<span id="P:Sansar.Simulation.ChatData.Message"></span>

```csharp signature
public string Message { get; }
```

string message of the chat event.

</div>

### Source

<div class="api-card">
<span id="P:Sansar.Simulation.ChatData.Source"></span>

```csharp signature
public string Source { get; }
```

string source of the chat: system, user or script.

</div>

### SourceId

<div class="api-card">
<span id="P:Sansar.Simulation.ChatData.SourceId"></span>

```csharp signature
public Sansar.Script.SessionId SourceId { get; }
```

Sansar.Script.SessionId id of the chat source. May be [`SessionId.Invalid`](/scripting/api/sansar.script/sessionid#invalid) if the source is not an agent.

</div>

### SourceScriptId

<div class="api-card">
<span id="P:Sansar.Simulation.ChatData.SourceScriptId"></span>

```csharp signature
public Sansar.Script.ScriptId SourceScriptId { get; }
```

Sansar.Script.ScriptId id of the chat source. May be [`ScriptId.Invalid`](/scripting/api/sansar.script/scriptid#invalid) if the source is not a script.

</div>


## Methods

### ToString

<div class="api-card">
<span id="M:Sansar.Simulation.ChatData.ToString"></span>
<span id="M:Sansar.Simulation.ChatData.ToString()"></span>

```csharp signature
public override string ToString()
```

A string representation of this object.

**Returns:** [string](https://learn.microsoft.com/dotnet/api/system.string) — A string representation of this object.

<details class="api-remarks"><summary>Remarks</summary>

The format of this string may change between releases.

</details>

</div>


## Used in examples

- [StatsExample.cs](/scripting/examples/stats-example)
- [VisitorTrackerExample.cs](/scripting/examples/visitor-tracker)
- `CameraShakeExample.cs`
- `ColorLutExample.cs`
- [GravityExample.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/GravityExample.cs)
- [MediaOverrideExample.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/MediaOverrideExample.cs)
- [QuestDebugExample.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/QuestDebugExample.cs)
- [ScriptLibrary/Scene/ChatCommand.cs](https://github.com/Wookey-Technologies/sansar-script-starter/blob/66af8b516b701088d043e4615acfcf5779356604/examples/official/ScriptLibrary/Scene/ChatCommand.cs)
- `TimeOfDayExample.cs`

<p class="api-generated" data-pagefind-ignore>Generated from the Sansar 47.10.0 client ScriptApi snapshot.</p>