Image attach
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user