@sesamespace/sesame 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* heartbeats, reconnection, and message routing automatically.
|
|
14
14
|
*/
|
|
15
15
|
// Plugin version (injected from package.json at build time, fallback to static)
|
|
16
|
-
const PLUGIN_VERSION = "0.2.
|
|
16
|
+
const PLUGIN_VERSION = "0.2.6";
|
|
17
17
|
/** Standard headers for Sesame API calls */
|
|
18
18
|
function sesameHeaders(apiKey, json = true) {
|
|
19
19
|
const h = {
|
|
@@ -796,11 +796,11 @@ async function handleMessage(message, account, state, ctx) {
|
|
|
796
796
|
trackSentMessage(sentId);
|
|
797
797
|
return sentId;
|
|
798
798
|
};
|
|
799
|
-
const editMessage = async (msgId, text) => {
|
|
799
|
+
const editMessage = async (msgId, text, isStreaming = false) => {
|
|
800
800
|
const res = await fetch(`${account.apiUrl}/api/v1/channels/${channelId}/messages/${msgId}`, {
|
|
801
801
|
method: "PATCH",
|
|
802
802
|
headers: sesameHeaders(account.apiKey),
|
|
803
|
-
body: JSON.stringify({ content: text }),
|
|
803
|
+
body: JSON.stringify({ content: text, ...(isStreaming ? { streaming: true } : {}) }),
|
|
804
804
|
});
|
|
805
805
|
if (!res.ok) {
|
|
806
806
|
log.warn?.(`[sesame] Edit failed (${res.status})`);
|
|
@@ -812,7 +812,7 @@ async function handleMessage(message, account, state, ctx) {
|
|
|
812
812
|
streamEditTimer = setTimeout(async () => {
|
|
813
813
|
streamEditTimer = null;
|
|
814
814
|
if (streamMessageId && streamPendingText) {
|
|
815
|
-
await editMessage(streamMessageId, streamPendingText);
|
|
815
|
+
await editMessage(streamMessageId, streamPendingText, true);
|
|
816
816
|
}
|
|
817
817
|
}, STREAM_EDIT_DEBOUNCE_MS);
|
|
818
818
|
};
|