add marking threads as read and editing posts
parent
d2180c8717
commit
cca7ca2cd7
|
@ -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,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue