Table of Contents

Interface IThread

Namespace
Kook
Assembly
Kook.Net.Core.dll

表示一个通用的帖子。

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

Properties

Attachments

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

IReadOnlyCollection<IAttachment> Attachments { get; }

Property Value

IReadOnlyCollection<IAttachment>

AuditStatus

获取此帖子的审核状态。

ThreadAuditStatus AuditStatus { get; }

Property Value

ThreadAuditStatus

Author

获取此帖子的作者。

IUser Author { get; }

Property Value

IUser

Cards

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

IReadOnlyCollection<ICard> Cards { get; }

Property Value

IReadOnlyCollection<ICard>

Category

获取此帖子的所属分区。

IThreadCategory? Category { get; }

Property Value

IThreadCategory

Channel

获取此帖子所在的频道。

IThreadChannel Channel { get; }

Property Value

IThreadChannel

Content

获取此帖子的内容。

string? Content { get; }

Property Value

string

Remarks

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

ContentDeletedBy

获取此帖子内容被删除的原因。

ThreadContentDeletedBy ContentDeletedBy { get; }

Property Value

ThreadContentDeletedBy

Cover

获取此帖子的封面图片链接。

string? Cover { get; }

Property Value

string

FavoriteCount

获取收藏此帖子的人数。

int FavoriteCount { get; }

Property Value

int

Guild

获取此帖子所在的服务器。

IGuild Guild { get; }

Property Value

IGuild

IsContentDeleted

获取此帖子的内容是否已被删除。

bool IsContentDeleted { get; }

Property Value

bool

IsEdited

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

bool IsEdited { get; }

Property Value

bool

LatestActiveTimestamp

获取此帖子最后一次活跃的时间。

DateTimeOffset LatestActiveTimestamp { get; }

Property Value

DateTimeOffset

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>

PostCount

获取此帖子的评论数量。

int PostCount { get; }

Property Value

int

PostId

获取此帖子主楼的评论 ID。

ulong PostId { get; }

Property Value

ulong

Remarks

帖子的发布者在发布帖子时所发布的内容为主楼。

PreviewContent

获取此帖子内容的预览文本。

string PreviewContent { get; }

Property Value

string

ThreadTags

获取此帖子所包含的所有话题标签。

IReadOnlyCollection<ThreadTag> ThreadTags { get; }

Property Value

IReadOnlyCollection<ThreadTag>

Timestamp

获取此帖子的发布时间。

DateTimeOffset Timestamp { get; }

Property Value

DateTimeOffset

Title

获取此帖子的标题。

string Title { get; }

Property Value

string

Methods

CreatePostAsync(ICard, RequestOptions?)

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

Task<IThreadPost> CreatePostAsync(ICard card, RequestOptions? options = null)

Parameters

card ICard

要发布的卡片内容。

options RequestOptions

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

Returns

Task<IThreadPost>

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

CreatePostAsync(IEnumerable<ICard>, RequestOptions?)

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

Task<IThreadPost> CreatePostAsync(IEnumerable<ICard> cards, RequestOptions? options = null)

Parameters

cards IEnumerable<ICard>

要发布的卡片内容。

options RequestOptions

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

Returns

Task<IThreadPost>

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

CreatePostAsync(string, bool, RequestOptions?)

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

Task<IThreadPost> CreatePostAsync(string content, bool isKMarkdown = false, RequestOptions? options = null)

Parameters

content string

要发布的文本内容。

isKMarkdown bool

是否为 KMarkdown 格式。

options RequestOptions

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

Returns

Task<IThreadPost>

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

DeleteContentAsync(RequestOptions?)

删除此帖子的主楼内容。

Task DeleteContentAsync(RequestOptions? options = null)

Parameters

options RequestOptions

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

Returns

Task

一个表示帖子主楼内容删除操作的异步任务。

Remarks

当帖子无任何评论时,删除主楼内容会导致帖子被删除。

DeletePostAsync(IThreadPost, RequestOptions?)

删除此帖子内的一条帖子评论。

Task DeletePostAsync(IThreadPost post, RequestOptions? options = null)

Parameters

post IThreadPost

要删除的帖子评论。

options RequestOptions

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

Returns

Task

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

Remarks

如果帖子的主楼内容已被删除,且此帖子评论是所属帖子的唯一一条评论,则删除此帖子评论会导致该帖子也被删除。

DeletePostAsync(ulong, RequestOptions?)

删除此帖子内的一条帖子评论。

Task DeletePostAsync(ulong postId, RequestOptions? options = null)

Parameters

postId ulong

要删除的帖子评论的 ID。

options RequestOptions

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

Returns

Task

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

Remarks

如果帖子的主楼内容已被删除,且此帖子评论是所属帖子的唯一一条评论,则删除此帖子评论会导致该帖子也被删除。

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

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

GetPostsAsync(IThreadPost, SortMode, int, RequestOptions?)

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

IAsyncEnumerable<IReadOnlyCollection<IThreadPost>> GetPostsAsync(IThreadPost referencePost, SortMode sortMode = SortMode.Ascending, int limit = 30, RequestOptions? options = null)

Parameters

referencePost IThreadPost

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

sortMode SortMode

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

limit int

要获取的评论数量。

options RequestOptions

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

Returns

IAsyncEnumerable<IReadOnlyCollection<IThreadPost>>

分页的评论集合的异步可枚举对象。

Remarks

important

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


warning

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


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

GetPostsAsync(DateTimeOffset, SortMode, int, RequestOptions?)

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

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

Parameters

referenceTimestamp DateTimeOffset
sortMode SortMode

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

limit int

要获取的评论数量。

options RequestOptions

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

Returns

IAsyncEnumerable<IReadOnlyCollection<IThreadPost>>

分页的评论集合的异步可枚举对象。

Remarks

important

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


warning

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


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

GetPostsAsync(int, RequestOptions?)

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

IAsyncEnumerable<IReadOnlyCollection<IThreadPost>> GetPostsAsync(int limit = 30, RequestOptions? options = null)

Parameters

limit int

要获取的评论数量。

options RequestOptions

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

Returns

IAsyncEnumerable<IReadOnlyCollection<IThreadPost>>

分页的评论集合的异步可枚举对象。

Remarks

important

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


warning

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


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