Table of Contents

Class SocketDMChannel

Namespace
HeyBox.WebSocket
Assembly
HeyBox.Net.WebSocket.dll

表示一个基于 SOCKET 的私聊频道。

public class SocketDMChannel : SocketChannel, IDMChannel, IEntity<uint>, ISocketPrivateChannel, IPrivateChannel, ISocketMessageChannel, IMessageChannel, IChannel, IEntity<ulong>
Inheritance
SocketDMChannel
Implements
Inherited Members
Extension Methods

Properties

CurrentUser

获取参与到此私聊频道中的当前用户。

public SocketUser CurrentUser { get; }

Property Value

SocketUser

Id

获取此私聊频道的唯一标识符。

public uint Id { get; }

Property Value

uint

Recipient

获取参与到此私聊频道的另外一位用户。

public SocketUser Recipient { get; }

Property Value

SocketUser

Users

获取参与到此私聊频道中的所有用户。

public IReadOnlyCollection<SocketUser> Users { get; }

Property Value

IReadOnlyCollection<SocketUser>

Methods

GetUser(ulong)

获取此频道中的一个用户。

public SocketUser? GetUser(ulong id)

Parameters

id ulong

要获取的用户的 ID。

Returns

SocketUser

如果找到了具有指定 ID 的用户,则返回该用户;否则返回 null

SendCardAsync(ICard, RequestOptions?)

发送卡片消息到此消息频道。

public Task<IUserMessage> SendCardAsync(ICard card, RequestOptions? options = null)

Parameters

card ICard

要发送的卡片。

options RequestOptions

发送请求时要使用的选项。

Returns

Task<IUserMessage>

一个表示异步发送操作的任务。任务的结果包含所发送的消息。

SendCardsAsync(IEnumerable<ICard>, RequestOptions?)

发送卡片消息到此消息频道。

public Task<IUserMessage> SendCardsAsync(IEnumerable<ICard> cards, RequestOptions? options = null)

Parameters

cards IEnumerable<ICard>

要发送的卡片。

options RequestOptions

发送请求时要使用的选项。

Returns

Task<IUserMessage>

一个表示异步发送操作的任务。任务的结果包含所发送的消息。

SendFileAsync(FileAttachment, RequestOptions?)

发送文件到此消息频道。

public Task<IUserMessage> SendFileAsync(FileAttachment attachment, RequestOptions? options = null)

Parameters

attachment FileAttachment

文件的附件信息。

options RequestOptions

发送请求时要使用的选项。

Returns

Task<IUserMessage>

一个表示异步发送操作的任务。任务的结果包含所发送的消息。

SendFileAsync(Stream, string, AttachmentType, Size?, RequestOptions?)

发送文件到此消息频道。

public Task<IUserMessage> SendFileAsync(Stream stream, string filename, AttachmentType type = AttachmentType.Image, Size? imageSize = null, RequestOptions? options = null)

Parameters

stream Stream

文件的流。

filename string

文件名。

type AttachmentType

文件的媒体类型。

imageSize Size?

图片文件的图像尺寸。

options RequestOptions

发送请求时要使用的选项。

Returns

Task<IUserMessage>

一个表示异步发送操作的任务。任务的结果包含所发送的消息。

SendFileAsync(string, string?, AttachmentType, Size?, RequestOptions?)

发送文件到此消息频道。

public Task<IUserMessage> SendFileAsync(string path, string? filename = null, AttachmentType type = AttachmentType.Image, Size? imageSize = null, RequestOptions? options = null)

Parameters

path string

文件的路径。

filename string

文件名。

type AttachmentType

文件的媒体类型。

imageSize Size?

图片文件的图像尺寸。

options RequestOptions

发送请求时要使用的选项。

Returns

Task<IUserMessage>

一个表示异步发送操作的任务。任务的结果包含所发送的消息。

SendTextAsync(string, IEnumerable<FileAttachment>?, RequestOptions?)

发送文本消息到此私聊消息频道。

public Task<IUserMessage> SendTextAsync(string text, IEnumerable<FileAttachment>? imageFileInfos = null, RequestOptions? options = null)

Parameters

text string

要发送的文本。

imageFileInfos IEnumerable<FileAttachment>

图片文件的信息。

options RequestOptions

发送请求时要使用的选项。

Returns

Task<IUserMessage>

一个表示异步发送操作的任务。任务的结果包含所发送的消息。

ToString()

获取此参与到此私聊频道的另外一位用户的包含 @ 前缀的用户名及识别号格式化字符串。

public override string ToString()

Returns

string

一个表示此私聊频道的格式化字符串。