diff --git a/src/forum/index.ts b/src/forum/index.ts index 66094a5..a997263 100644 --- a/src/forum/index.ts +++ b/src/forum/index.ts @@ -15,6 +15,7 @@ export class ForumModule extends Module { "forum.viewposts", { getSomeBackscroll: reverse, + includeThreadMetadata: true, includePost, threadId, postId, @@ -31,6 +32,28 @@ export class ForumModule extends Module { text, threadId, } - ) + ); + } + + public async readThread(postId: number, threadId: number) { + return await this.client._call( + TCResponse, + "forum.readthread", + { + postId, + threadId, + } + ); + } + + public async editPost(postId: number, text: string) { + return await this.client._call( + TCResponse, + "forum.editpost", + { + postId, + text, + } + ); } } diff --git a/src/forum/types.ts b/src/forum/types.ts index fa311c4..05f713f 100644 --- a/src/forum/types.ts +++ b/src/forum/types.ts @@ -5,6 +5,7 @@ export class ViewPostsResponse extends TCResponse { numPostsBefore: number; numPostsAfter: number; jumpTo: number; + thread: Thread; public constructor(response: TCResponseRaw) { super(response); @@ -12,6 +13,7 @@ export class ViewPostsResponse extends TCResponse { this.numPostsBefore = response["numPostsBefore"] ?? 0; this.numPostsAfter = response["numPostsAfter"] ?? 0; this.jumpTo = response["jumpTo"] ?? 0; + this.thread = response["thread"] ?? {}; } } @@ -21,3 +23,12 @@ export interface Post { readonly text: string; readonly time: number; } + +export interface Thread { + readonly id: number; + readonly lastPostId: number; + readonly title: string; + readonly locked: boolean; + // TODO: add category + //readonly category +}