From bc72fc9781439722e935757e26266bdfebb24cbd Mon Sep 17 00:00:00 2001 From: Andrew Glaze Date: Fri, 20 Mar 2026 22:37:55 -0400 Subject: [PATCH] fix: typing indicator lasting longer than 10s --- Sources/zundamon/Wolfram.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sources/zundamon/Wolfram.swift b/Sources/zundamon/Wolfram.swift index 5d78fbe..5b8fa6f 100644 --- a/Sources/zundamon/Wolfram.swift +++ b/Sources/zundamon/Wolfram.swift @@ -48,7 +48,12 @@ struct Wolfram { client: DiscordClient, ctx: MessageCreate ) async throws { - try await client.triggerTypingIndicator(channelId: ctx.channel_id) + let typingIndicatorTask = Task { + while !Task.isCancelled { + try await client.triggerTypingIndicator(channelId: ctx.channel_id) + try await Task.sleep(for: .seconds(8)) + } + } let question = String(args.joined(separator: " ")) @@ -59,6 +64,7 @@ struct Wolfram { if let img = img { attachments.append(.init(image: .init(url: img.absoluteString))) } + typingIndicatorTask.cancel() try await client.createMessage(channelId: ctx.channel_id, payload: .init( content: answer,