Viewerclass

Someone we currently believe is in chat. Tracked from join/leave/message events, so this is a best-effort roster of active chatters - not silent lurkers.

objectViewer
Namespace
global
Assembly
Sandbox.Engine
Declaration
public class Sandbox.Streamer.Viewer

Constructors1

Showing 1 constructors

public Viewer()PUBLICCONSTRUCTOR

Properties11

Showing 11 properties

public string[] Sandbox.Streamer.Viewer.Badges { get; set; }PUBLICGETSET

Their chat badges, if we've seen a message from them.

Returns:string[]

public System.Nullable`1<Color> Sandbox.Streamer.Viewer.Color { get; set; }PUBLICGETSET

Their chat name color, if we've seen a message from them with a valid color set.

Returns:Nullable<Color>

public Sandbox.DataBag Sandbox.Streamer.Viewer.Data { get; set; }PUBLICGETSET

Arbitrary per-viewer data - stash gameplay state here, e.g. `viewer.Data.Set( "score", 10 )`. Lazily created, so viewers with no data cost nothing. This lives only as long as the viewer is in the roster: if they leave (or get pruned) and come back it's a fresh viewer with an empty bag, so keep anything you can't afford to lose in your own game state instead.

Returns:DataBag

public string Sandbox.Streamer.Viewer.DisplayName { get; set; }PUBLICGETSET

Their display name. Falls back to `Sandbox.Streamer.Viewer.Username` until we've seen a chat message from them.

Returns:string

public bool Sandbox.Streamer.Viewer.HasChatted { get; set; }PUBLICGETSET

Whether we've seen this viewer actually chat, or only join.

Returns:bool

public bool Sandbox.Streamer.Viewer.IsBroadcaster { get; set; }PUBLICGETSET

Whether this viewer is the broadcaster (channel owner).

Returns:bool

public bool Sandbox.Streamer.Viewer.IsModerator { get; set; }PUBLICGETSET

Whether this viewer is a channel moderator.

Returns:bool

public bool Sandbox.Streamer.Viewer.IsSubscriber { get; set; }PUBLICGETSET

Whether this viewer is a subscriber (founders count as subscribers).

Returns:bool

public bool Sandbox.Streamer.Viewer.IsVip { get; set; }PUBLICGETSET

Whether this viewer is a VIP.

Returns:bool

public string Sandbox.Streamer.Viewer.StreamerId { get; set; }PUBLICGETSET

The viewer's stable numeric platform user id. Unlike `Sandbox.Streamer.Viewer.Username` this never changes, so it's the key to use when persisting per-viewer state. Null until we've seen them chat, sub, or appear in the chatter list.

Returns:string

public string Sandbox.Streamer.Viewer.Username { get; set; }PUBLICGETSET

The viewer's login name (lowercase). This is the key we track them by in the roster, but a viewer can change it - use `Sandbox.Streamer.Viewer.StreamerId` as their persistent identity.

Returns:string

On this page