mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-11-04 15:07:32 +00:00
* bots, nodejs: document chat, connection, member contact and network commands, typed commands in library * bots, nodejs: restore apiConnect, wrap domain once, test all connect responses * nodejs: JSDoc for new methods * docs: plan for bot API commands and typed Node library methods * tests: channel prepared with a domain has a verified SimpleX name * docs: apply review fixes to the plan for bot API commands * docs: apply second review pass to the plan for bot API commands * docs: refer the bot API plan to the rewritten test commit * docs: record decisions in the plan for bot API commands * docs: plan tests of the generated Python command strings * python: test the generated strings of the documented commands * docs: plan the message information command for bots * bots, nodejs: message information with the file servers for bots * docs: plan the relay approval option of receiving files in Node * nodejs: receive files without approving unknown relays * docs: plan the user servers command for bots * bots, nodejs: user servers and relays by operator for bots * nodejs: document the message information method * docs: plan the file upload progress event for bots * bots: file upload progress event for bots * bots: drop the file upload progress event * docs: drop the upload progress event plan * nodejs: document user servers and relay approval of received files
99 lines
1.7 KiB
Markdown
99 lines
1.7 KiB
Markdown
[**simplex-chat**](README.md)
|
|
|
|
***
|
|
|
|
[simplex-chat](README.md) / [api](Namespace.api.md) / LiveMessage
|
|
|
|
# Class: LiveMessage
|
|
|
|
Defined in: [src/api.ts:1134](../api.ts#L1134)
|
|
|
|
Text shown as a live message while it is written, e.g. a streamed reply.
|
|
|
|
## Constructors
|
|
|
|
### Constructor
|
|
|
|
> **new LiveMessage**(`chat`, `chatType`, `chatId`, `interval?`, `onError?`): `LiveMessage`
|
|
|
|
Defined in: [src/api.ts:1148](../api.ts#L1148)
|
|
|
|
#### Parameters
|
|
|
|
##### chat
|
|
|
|
`Pick`\<[`ChatApi`](api.Class.ChatApi.md), `"apiSendMessages"` \| `"apiUpdateChatItem"` \| `"apiDeleteChatItems"`\>
|
|
|
|
Chat API, or an object with its methods to send, update and delete messages.
|
|
|
|
##### chatType
|
|
|
|
`ChatType`
|
|
|
|
Chat type.
|
|
|
|
##### chatId
|
|
|
|
`number`
|
|
|
|
Contact or group ID.
|
|
|
|
##### interval?
|
|
|
|
`number` = `3000`
|
|
|
|
Minimum interval between updates of the live message, in milliseconds.
|
|
|
|
##### onError?
|
|
|
|
(`error`) => `void`
|
|
|
|
Error handler for sending, updating and deleting messages. Errors are logged when it is omitted.
|
|
|
|
#### Returns
|
|
|
|
`LiveMessage`
|
|
|
|
## Methods
|
|
|
|
### end()
|
|
|
|
> **end**(`text?`): `Promise`\<`void`\>
|
|
|
|
Defined in: [src/api.ts:1178](../api.ts#L1178)
|
|
|
|
Finalize the live message with the text, or with the last text when omitted.
|
|
A message without text is deleted. The next update starts a new live message.
|
|
The returned promise resolves after all queued commands complete.
|
|
|
|
#### Parameters
|
|
|
|
##### text?
|
|
|
|
`string` = `...`
|
|
|
|
#### Returns
|
|
|
|
`Promise`\<`void`\>
|
|
|
|
***
|
|
|
|
### update()
|
|
|
|
> **update**(`text`): `void`
|
|
|
|
Defined in: [src/api.ts:1160](../api.ts#L1160)
|
|
|
|
Set the text of the live message.
|
|
The first text is sent at once; later texts update the message at most once per interval.
|
|
|
|
#### Parameters
|
|
|
|
##### text
|
|
|
|
`string`
|
|
|
|
#### Returns
|
|
|
|
`void`
|