Image attach

This commit is contained in:
Andrew Glaze
2026-03-20 19:13:45 -04:00
parent 4d39ed8053
commit 6a48936f6c
7 changed files with 289 additions and 241 deletions

View File

@@ -7,6 +7,7 @@ public struct DiscordClient: Sendable {
static let apiUrl: URL = URL(string: "https://discord.com/api/v10")!
let token: String
@discardableResult
private func authReq(_ request: consuming URLRequest) async throws -> (Data, URLResponse) {
request.setValue("Bot \(token)", forHTTPHeaderField: "Authorization")
request.setValue("DiscordKit (https:\\candy123.moe, v0.0.1)", forHTTPHeaderField: "User-Agent")
@@ -44,8 +45,7 @@ public struct DiscordClient: Sendable {
let json = JSONEncoder()
req.httpBody = try json.encode(payload)
let (data, res) = try await authReq(req)
try await authReq(req)
}
}