| author | Stephen Paul Weber
<singpolyma@singpolyma.net> 2026-03-11 18:39:36 UTC |
| committer | Stephen Paul Weber
<singpolyma@singpolyma.net> 2026-03-11 18:41:00 UTC |
| parent | 1472e1880a8e6f315de40699f5bbc33af0f312e8 |
| docs/js/index.md | +20 | -0 |
diff --git a/docs/js/index.md b/docs/js/index.md index a5d7f18..92d449b 100644 --- a/docs/js/index.md +++ b/docs/js/index.md @@ -68,6 +68,26 @@ chat.sendMessage(new borogove.ChatMessageBuilder({ })); ``` +We can also load the most recent messages from a chat's history: + +```typescript +const messages = await chat.getMessagesBefore(null, null); +``` + +and send a reply to one of those: + +```typescript +const reply = messages[0].reply(); +reply.text = "Is that so?"; +chat.sendMessage(reply); +``` + +and mark off that we've read all these: + +```typescript +chat.markReadUpTo(messages[messages.length - 1]); +``` + ## Events This is how you can listen to events: