Table of Contents

Class SpaceChat

Namespace
Twikit.Spaces
Assembly
Twikit.dll

スペースのチャット。履歴は HTTP で取得でき、ライブの受信・送信は WebSocket(.NET 標準の ClientWebSocket)を使います。

public sealed class SpaceChat
Inheritance
SpaceChat
Inherited Members

Constructors

SpaceChat(ProxseeApi, string, string?, string?, string?)

public SpaceChat(ProxseeApi proxsee, string chatToken, string? endpoint = null, string? roomId = null, string? accessToken = null)

Parameters

proxsee ProxseeApi
chatToken string
endpoint string
roomId string
accessToken string

Properties

AccessToken

public string? AccessToken { get; }

Property Value

string

ChatToken

public string ChatToken { get; }

Property Value

string

Endpoint

public string? Endpoint { get; }

Property Value

string

IsLive

ライブの WebSocket が開いているか。

public bool IsLive { get; }

Property Value

bool

ReadOnly

読み取り専用か(リプレイ、または参加者でない)。

public bool ReadOnly { get; }

Property Value

bool

RoomId

public string? RoomId { get; }

Property Value

string

Methods

CloseAsync()

public Task CloseAsync()

Returns

Task

ConnectAsync()

proxsee でチャットアクセスを解決し、スペースがライブなら WebSocket を開きます。 リプレイは読み取り専用で、履歴は取れますが WebSocket は提供されません。

public Task<SpaceChat> ConnectAsync()

Returns

Task<SpaceChat>

HistoryAsync(string?, int)

チャット履歴を取得します。

public Task<List<ChatMessage>> HistoryAsync(string? cursor = null, int limit = 1000)

Parameters

cursor string
limit int

Returns

Task<List<ChatMessage>>

ListenAsync(CancellationToken)

チャットメッセージを到着順に列挙します(WebSocket が必要)。

public IAsyncEnumerable<ChatMessage> ListenAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

IAsyncEnumerable<ChatMessage>

SendAsync(string)

チャットメッセージを送ります(WebSocket が必要。読み取り専用なら SpaceException)。

public Task SendAsync(string text)

Parameters

text string

Returns

Task