Table of Contents

Interface IThreadPost

Namespace
Kook
Assembly
Kook.Net.Core.dll

表示一个通用的帖子评论。

public interface IThreadPost : IEntity<ulong>, IDeletable
Inherited Members
Extension Methods

Properties

Attachments

获取此帖子评论所包含的所有附件。

IReadOnlyCollection<IAttachment> Attachments { get; }

Property Value

IReadOnlyCollection<IAttachment>

Author

获取此帖子评论的作者。

IUser Author { get; }

Property Value

IUser

Cards

获取此帖子评论中包含的所有卡片。

IReadOnlyCollection<ICard> Cards { get; }

Property Value

IReadOnlyCollection<ICard>

Content

获取此帖子评论的内容。

string Content { get; }

Property Value

string

Remarks

此属性为卡片内容的原始代码。

IsEdited

获取此帖子评论是否已被编辑。

bool IsEdited { get; }

Property Value

bool

MentionedChannelIds

获取此帖子评论中提及的所有频道。

IReadOnlyCollection<ulong> MentionedChannelIds { get; }

Property Value

IReadOnlyCollection<ulong>

MentionedEveryone

获取此帖子评论是否提及了全体成员。

bool MentionedEveryone { get; }

Property Value

bool

MentionedHere

获取此帖子评论是否提及了在线成员。

bool MentionedHere { get; }

Property Value

bool

MentionedRoleIds

获取此帖子评论中提及的所有角色的 ID。

IReadOnlyCollection<uint> MentionedRoleIds { get; }

Property Value

IReadOnlyCollection<uint>

MentionedUserIds

获取此帖子评论中提及的所有用户的 ID。

IReadOnlyCollection<ulong> MentionedUserIds { get; }

Property Value

IReadOnlyCollection<ulong>

Replies

获取此帖子评论内的帖子回复。

IReadOnlyCollection<IThreadReply> Replies { get; }

Property Value

IReadOnlyCollection<IThreadReply>

Remarks

此属性仅包含当前帖子评论内最多 2 条帖子回复,要获取所有帖子回复,请访问 GetRepliesAsync(int, RequestOptions?) 及其重载方法。

Thread

获取此帖子评论所在的帖子。

IThread Thread { get; }

Property Value

IThread

Timestamp

获取此帖子的发布时间。

DateTimeOffset Timestamp { get; }

Property Value

DateTimeOffset

Methods

CreateReplyAsync(ICard, ulong?, RequestOptions?)

在此帖子评论中创建一条帖子回复。

Task<IThreadReply> CreateReplyAsync(ICard card, ulong? referenceReplyId = null, RequestOptions? options = null)

Parameters

card ICard

要发布的卡片内容。

referenceReplyId ulong?

在发布回复时要回复的帖子回复的 ID。如果未指定,则不会回复任何帖子回复。

options RequestOptions

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

Returns

Task<IThreadReply>

一个表示新创建帖子评论的回复操作的异步任务。

Remarks

卡片内仅允许包含文本内容。

CreateReplyAsync(IEnumerable<ICard>, ulong?, RequestOptions?)

在此帖子评论中创建一条帖子回复。

Task<IThreadReply> CreateReplyAsync(IEnumerable<ICard> cards, ulong? referenceReplyId = null, RequestOptions? options = null)

Parameters

cards IEnumerable<ICard>

要发布的卡片内容。

referenceReplyId ulong?

在发布回复时要回复的帖子回复的 ID。如果未指定,则不会回复任何帖子回复。

options RequestOptions

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

Returns

Task<IThreadReply>

一个表示新创建帖子评论的回复操作的异步任务。

Remarks

卡片内仅允许包含文本内容。

CreateReplyAsync(string, bool, ulong?, RequestOptions?)

在此帖子评论中创建一条帖子回复。

Task<IThreadReply> CreateReplyAsync(string content, bool isKMarkdown = false, ulong? referenceReplyId = null, RequestOptions? options = null)

Parameters

content string

要发布的文本内容。

isKMarkdown bool

是否为 KMarkdown 格式。

referenceReplyId ulong?

在发布回复时要回复的帖子回复的 ID。如果未指定,则不会回复任何帖子回复。

options RequestOptions

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

Returns

Task<IThreadReply>

一个表示新创建帖子评论的回复操作的异步任务。

DeleteReplyAsync(IThreadReply, RequestOptions?)

在此帖子评论中删除一条帖子回复。

Task DeleteReplyAsync(IThreadReply reply, RequestOptions? options = null)

Parameters

reply IThreadReply

要删除的帖子评论的回复。

options RequestOptions

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

Returns

Task

一个表示帖子评论的回复删除操作的异步任务。

DeleteReplyAsync(ulong, RequestOptions?)

在此帖子评论中删除一条帖子回复。

Task DeleteReplyAsync(ulong replyId, RequestOptions? options = null)

Parameters

replyId ulong

要删除的帖子评论的回复的 ID。

options RequestOptions

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

Returns

Task

一个表示帖子评论的回复删除操作的异步任务。

GetRepliesAsync(IThreadReply, SortMode, int, RequestOptions?)

获取此帖子评论中的一些回复。

IAsyncEnumerable<IReadOnlyCollection<IThreadReply>> GetRepliesAsync(IThreadReply referenceReply, SortMode sortMode = SortMode.Ascending, int limit = 30, RequestOptions? options = null)

Parameters

referenceReply IThreadReply

要开始获取回复的参考位置的回复,获取的结果不包含此回复。

sortMode SortMode

要以参考位置为基准,获取回复的排序方式。

limit int

要获取的回复数量。

options RequestOptions

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

Returns

IAsyncEnumerable<IReadOnlyCollection<IThreadReply>>

分页的回复集合的异步可枚举对象。

Remarks

important

返回的集合是一个异步可枚举对象;调用 FlattenAsync<T>(IAsyncEnumerable<IEnumerable<T>>) 可以异步枚举所有分页,并将其合并为一个集合。


warning

请勿一次性获取过多回复,这可能会导致抢占式速率限制,甚至触发实际的速率限制,从而导致 Bot 服务暂停。


此方法将尝试获取此最新的 limit 条回复。此方法会根据 MaxThreadsPerBatch 将请求拆分。换句话说,如果要获取 300 条回复,而 MaxThreadsPerBatch 的常量为 30,则请求将被拆分为 10 个单独请求,因此异步枚举器会异步枚举返回 10 个响应。 FlattenAsync<T>(IAsyncEnumerable<IEnumerable<T>>) 方法可以展开这 10 个响应返回的集合,并将其合并为一个集合。

GetRepliesAsync(DateTimeOffset, SortMode, int, RequestOptions?)

获取此帖子评论中的一些回复。

IAsyncEnumerable<IReadOnlyCollection<IThreadReply>> GetRepliesAsync(DateTimeOffset referenceTimestamp, SortMode sortMode = SortMode.Ascending, int limit = 30, RequestOptions? options = null)

Parameters

referenceTimestamp DateTimeOffset
sortMode SortMode

要以参考位置为基准,获取回复的排序方式。

limit int

要获取的回复数量。

options RequestOptions

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

Returns

IAsyncEnumerable<IReadOnlyCollection<IThreadReply>>

分页的回复集合的异步可枚举对象。

Remarks

important

返回的集合是一个异步可枚举对象;调用 FlattenAsync<T>(IAsyncEnumerable<IEnumerable<T>>) 可以异步枚举所有分页,并将其合并为一个集合。


warning

请勿一次性获取过多回复,这可能会导致抢占式速率限制,甚至触发实际的速率限制,从而导致 Bot 服务暂停。


此方法将尝试获取此最新的 limit 条回复。此方法会根据 MaxThreadsPerBatch 将请求拆分。换句话说,如果要获取 300 条回复,而 MaxThreadsPerBatch 的常量为 30,则请求将被拆分为 10 个单独请求,因此异步枚举器会异步枚举返回 10 个响应。 FlattenAsync<T>(IAsyncEnumerable<IEnumerable<T>>) 方法可以展开这 10 个响应返回的集合,并将其合并为一个集合。

GetRepliesAsync(int, RequestOptions?)

获取此帖子评论中的最新的一些回复。

IAsyncEnumerable<IReadOnlyCollection<IThreadReply>> GetRepliesAsync(int limit = 30, RequestOptions? options = null)

Parameters

limit int

要获取的回复数量。

options RequestOptions

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

Returns

IAsyncEnumerable<IReadOnlyCollection<IThreadReply>>

分页的回复集合的异步可枚举对象。

Remarks

important

返回的集合是一个异步可枚举对象;调用 FlattenAsync<T>(IAsyncEnumerable<IEnumerable<T>>) 可以异步枚举所有分页,并将其合并为一个集合。


warning

请勿一次性获取过多回复,这可能会导致抢占式速率限制,甚至触发实际的速率限制,从而导致 Bot 服务暂停。


此方法将尝试获取此最新的 limit 条回复。此方法会根据 MaxThreadsPerBatch 将请求拆分。换句话说,如果要获取 300 条回复,而 MaxThreadsPerBatch 的常量为 30,则请求将被拆分为 10 个单独请求,因此异步枚举器会异步枚举返回 10 个响应。 FlattenAsync<T>(IAsyncEnumerable<IEnumerable<T>>) 方法可以展开这 10 个响应返回的集合,并将其合并为一个集合。