Class RestMessage
表示一个基于 REST 的通用消息。
public abstract class RestMessage : RestEntity<ulong>, IMessage, IEntity<ulong>
- Inheritance
-
RestMessage
- Implements
- Derived
- Inherited Members
Constructors
RestMessage(BaseHeyBoxClient, ulong, MessageType, IMessageChannel, IUser, MessageSource)
protected RestMessage(BaseHeyBoxClient client, ulong id, MessageType messageType, IMessageChannel channel, IUser author, MessageSource source)
Parameters
client
BaseHeyBoxClientid
ulongmessageType
MessageTypechannel
IMessageChannelauthor
IUsersource
MessageSource
Properties
Author
获取此消息的作者。
public IUser Author { get; }
Property Value
Cards
public virtual IReadOnlyCollection<ICard> Cards { get; }
Property Value
Channel
获取此消息的来源频道。
public IMessageChannel Channel { get; }
Property Value
CleanContent
获取此消息的纯净内容。
public string CleanContent { get; }
Property Value
- string
此属性会对 Content 的内容进行两步操作:
- 使用 Resolve(TagHandling, TagHandling, TagHandling, TagHandling, TagHandling)
方法解析所有标签的完整名称;
- 使用 StripMarkdown(string) 清理所有 Markdown 格式字符。
- 使用 Resolve(TagHandling, TagHandling, TagHandling, TagHandling, TagHandling)
方法解析所有标签的完整名称;
- See Also
Content
获取此消息的内容。
public string Content { get; }
Property Value
Remarks
如果消息不是文本消息,则此属性可能为空或包含原始代码。
Reference
获取此消息的引用信息。
public IMessageReference? Reference { get; }
Property Value
Source
获取此消息的来源。
public MessageSource Source { get; }
Property Value
Tags
获取此消息中解析出的所有标签。
public IReadOnlyCollection<ITag> Tags { get; }
Property Value
Type
获取此消息的类型。
public MessageType Type { get; }
Property Value
Methods
AddReactionAsync(IEmote, RequestOptions?)
向此消息添加一个回应。
public Task AddReactionAsync(IEmote emote, RequestOptions? options = null)
Parameters
emote
IEmote要用于向此消息添加回应的表情符号。
options
RequestOptions发送请求时要使用的选项。
Returns
- Task
一个表示添加添加异步操作的任务。
Exceptions
- NotSupportedException
此类型的消息不支持此操作。
RemoveReactionAsync(IEmote, RequestOptions?)
从此消息中移除一个回应。
public Task RemoveReactionAsync(IEmote emote, RequestOptions? options = null)
Parameters
emote
IEmote要从此消息移除的回应的表情符号。
options
RequestOptions发送请求时要使用的选项。
Returns
- Task
一个表示异步移除操作的任务。
Exceptions
- NotSupportedException
此类型的消息不支持此操作。