Class RestDMChannel
表示一个基于 REST 的私聊频道。
public class RestDMChannel : RestChannel, IDMChannel, IEntity<uint>, IRestPrivateChannel, IPrivateChannel, IRestMessageChannel, IMessageChannel, IChannel, IEntity<ulong>
- Inheritance
-
RestDMChannel
- Implements
- Inherited Members
- Extension Methods
Properties
CurrentUser
获取参与到此私聊频道中的当前用户。
public RestUser CurrentUser { get; }
Property Value
Id
获取此私聊频道的唯一标识符。
public uint Id { get; }
Property Value
Recipient
获取参与到此私聊频道的另外一位用户。
public RestUser Recipient { get; }
Property Value
Users
获取参与到此私聊频道中的所有用户。
public IReadOnlyCollection<RestUser> Users { get; }
Property Value
Methods
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
一个表示此私聊频道的格式化字符串。