From 85c699412f0b7f19ba21036db1ec1f068f39e83e Mon Sep 17 00:00:00 2001 From: Andrew Glaze Date: Fri, 20 Mar 2026 22:00:19 -0400 Subject: [PATCH] feat: typing indicator --- Sources/DiscordKit/DiscordClient.swift | 6 ++++++ Sources/zundamon/Wolfram.swift | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Sources/DiscordKit/DiscordClient.swift b/Sources/DiscordKit/DiscordClient.swift index 018e059..4eaf29c 100644 --- a/Sources/DiscordKit/DiscordClient.swift +++ b/Sources/DiscordKit/DiscordClient.swift @@ -47,6 +47,12 @@ public struct DiscordClient: Sendable { req.httpBody = try json.encode(payload) try await authReq(req) } + + public func triggerTypingIndicator(channelId: String) async throws { + var req = URLRequest(url: DiscordClient.apiUrl.appending(path: "/channels/\(channelId)/typing")) + req.httpMethod = "POST" + try await authReq(req) + } } public enum ApiError: Error { diff --git a/Sources/zundamon/Wolfram.swift b/Sources/zundamon/Wolfram.swift index 9d5aecc..5d78fbe 100644 --- a/Sources/zundamon/Wolfram.swift +++ b/Sources/zundamon/Wolfram.swift @@ -48,7 +48,7 @@ struct Wolfram { client: DiscordClient, ctx: MessageCreate ) async throws { - //try await client.triggerTypingIndicator(channelId: ctx.channel_id).guardSuccess() + try await client.triggerTypingIndicator(channelId: ctx.channel_id) let question = String(args.joined(separator: " "))