fix(discord): prevent stuck typing indicator

This commit is contained in:
Nimrod Gutman
2026-02-25 10:16:00 +02:00
committed by Nimrod Gutman
parent fb76e316fb
commit a0fa283839
3 changed files with 40 additions and 5 deletions

View File

@@ -17,6 +17,7 @@ export function createTypingCallbacks(params: {
const stop = params.stop;
const keepaliveIntervalMs = params.keepaliveIntervalMs ?? 3_000;
let stopSent = false;
let closed = false;
const fireStart = async () => {
try {
@@ -32,6 +33,9 @@ export function createTypingCallbacks(params: {
});
const onReplyStart = async () => {
if (closed) {
return;
}
stopSent = false;
keepaliveLoop.stop();
await fireStart();
@@ -39,6 +43,7 @@ export function createTypingCallbacks(params: {
};
const fireStop = () => {
closed = true;
keepaliveLoop.stop();
if (!stop || stopSent) {
return;