Skip to content

Commit 1e43461

Browse files
authored
fix: include message id and chatroom id in page props (#277)
1 parent e32155e commit 1e43461

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

apps/example-bot/src/app/page.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ export default async function Page({
44
isInGroup,
55
hasBeenMentioned,
66
groupId,
7+
chatroomId,
8+
messageId,
79
}: PageProps) {
810
return (
911
<div>
@@ -19,7 +21,11 @@ export default async function Page({
1921
<br />
2022
Click the menu button to see the available options.
2123
</p>
22-
<blockquote>Hello world</blockquote>
24+
<blockquote>
25+
Chatroom ID: {chatroomId}
26+
<br />
27+
Message ID: {messageId}
28+
</blockquote>
2329
</div>
2430
);
2531
}

packages/common/src/page.interface.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@ export interface PageProps {
5454
* Group id of the chatroom.
5555
*/
5656
groupId?: string;
57+
58+
/**
59+
* The message id of the current message.
60+
*/
61+
messageId: string;
62+
63+
/**
64+
* The chatroom id of the current chatroom.
65+
*/
66+
chatroomId: string;
5767
}
5868

5969
export interface ErrorPageProps {

packages/core/src/core/core.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,8 @@ export class Core<T extends Container<BaseChatroomInfo, BaseMessage>>
468468
isInGroup: container.isInGroup,
469469
groupId: container.groupId,
470470
hasBeenMentioned: container.hasBeenMentioned,
471+
messageId: container.chatroomInfo.messageId?.toString() as any,
472+
chatroomId: container.chatroomInfo.id.toString() as any,
471473
...this.element.props,
472474
...oldProps,
473475
storage: {

0 commit comments

Comments
 (0)