add marking threads as read and editing posts
parent
d2180c8717
commit
cca7ca2cd7
|
@ -15,6 +15,7 @@ export class ForumModule extends Module {
|
||||||
"forum.viewposts",
|
"forum.viewposts",
|
||||||
{
|
{
|
||||||
getSomeBackscroll: reverse,
|
getSomeBackscroll: reverse,
|
||||||
|
includeThreadMetadata: true,
|
||||||
includePost,
|
includePost,
|
||||||
threadId,
|
threadId,
|
||||||
postId,
|
postId,
|
||||||
|
@ -31,6 +32,28 @@ export class ForumModule extends Module {
|
||||||
text,
|
text,
|
||||||
threadId,
|
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;
|
numPostsBefore: number;
|
||||||
numPostsAfter: number;
|
numPostsAfter: number;
|
||||||
jumpTo: number;
|
jumpTo: number;
|
||||||
|
thread: Thread;
|
||||||
|
|
||||||
public constructor(response: TCResponseRaw) {
|
public constructor(response: TCResponseRaw) {
|
||||||
super(response);
|
super(response);
|
||||||
|
@ -12,6 +13,7 @@ export class ViewPostsResponse extends TCResponse {
|
||||||
this.numPostsBefore = response["numPostsBefore"] ?? 0;
|
this.numPostsBefore = response["numPostsBefore"] ?? 0;
|
||||||
this.numPostsAfter = response["numPostsAfter"] ?? 0;
|
this.numPostsAfter = response["numPostsAfter"] ?? 0;
|
||||||
this.jumpTo = response["jumpTo"] ?? 0;
|
this.jumpTo = response["jumpTo"] ?? 0;
|
||||||
|
this.thread = response["thread"] ?? {};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,3 +23,12 @@ export interface Post {
|
||||||
readonly text: string;
|
readonly text: string;
|
||||||
readonly time: number;
|
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