Skip to content

Commit 691f5fd

Browse files
committed
Bump swift-discord and fix interaction responses
1 parent bbd276b commit 691f5fd

File tree

6 files changed

+15
-14
lines changed

6 files changed

+15
-14
lines changed

Diff for: Package.resolved

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"originHash" : "96c960f5953494c86c4c1c2ccac1b3bdad84624a121d804b27bec6f4d69d0323",
2+
"originHash" : "c6ae4c140de386ef7bd40fa61d968c22c06b4f89a844cb2bc394fb2bde4599c6",
33
"pins" : [
44
{
55
"identity" : "async-http-client",
@@ -167,8 +167,8 @@
167167
"kind" : "remoteSourceControl",
168168
"location" : "https://github.com/fwcd/swift-discord.git",
169169
"state" : {
170-
"revision" : "a1f953afa89141706a4f81590e6ca536861f5c86",
171-
"version" : "12.0.0"
170+
"revision" : "fb02932ae2984cb12286a993ad518a1df54d02b1",
171+
"version" : "12.0.2"
172172
}
173173
},
174174
{

Diff for: Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let package = Package(
1111
],
1212
dependencies: [
1313
// Dependencies declare other packages that this package depends on.
14-
.package(url: "https://github.com/fwcd/swift-discord.git", .upToNextMinor(from: "12.0.0")),
14+
.package(url: "https://github.com/fwcd/swift-discord.git", .upToNextMinor(from: "12.0.2")),
1515
.package(url: "https://github.com/attaswift/BigInt.git", from: "5.3.0"),
1616
.package(url: "https://github.com/scinfu/SwiftSoup.git", from: "2.4.3"),
1717
.package(url: "https://github.com/apple/swift-log.git", from: "1.4.2"),

Diff for: Sources/D2DiscordIO/DiscordInteractionResponseConverter.swift

+2-3
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ extension InteractionResponse.ResponseType: DiscordAPIConvertible {
2222
public var usingDiscordAPI: DiscordInteractionResponseType {
2323
switch self {
2424
case .pong: .pong
25-
case .acknowledge: .acknowledge
26-
case .channelMessage: .channelMessage
2725
case .channelMessageWithSource: .channelMessageWithSource
28-
case .ackWithSource: .ackWithSource
26+
case .deferredChannelMessageWithSource: .deferredChannelMessageWithSource
27+
case .deferredUpdateMessage: .deferredUpdateMessage
2928
}
3029
}
3130
}

Diff for: Sources/D2DiscordIO/DiscordSink.swift

+6-3
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ struct DiscordSink: DefaultSink {
222222

223223
func deleteMIOCommand(_ commandId: MIOCommandID) async throws {
224224
try await withCheckedThrowingContinuation { continuation in
225-
client.deleteApplicationCommand(commandId.usingDiscordAPI) { response in
225+
client.deleteApplicationCommand(commandId.usingDiscordAPI) { (data, response) in
226+
// TODO: Return data in error
226227
continuation.resume(with: Result { try check(response: response, "deleting MIO command") })
227228
}
228229
}
@@ -254,15 +255,17 @@ struct DiscordSink: DefaultSink {
254255

255256
func deleteMIOCommand(_ commandId: MIOCommandID, on guildId: D2MessageIO.GuildID) async throws {
256257
try await withCheckedThrowingContinuation { continuation in
257-
client.deleteApplicationCommand(commandId.usingDiscordAPI, on: guildId.usingDiscordAPI) { response in
258+
client.deleteApplicationCommand(commandId.usingDiscordAPI, on: guildId.usingDiscordAPI) { (data, response) in
259+
// TODO: Return data in error
258260
continuation.resume(with: Result { try check(response: response, "deleting MIO command") })
259261
}
260262
}
261263
}
262264

263265
func createInteractionResponse(for interactionId: D2MessageIO.InteractionID, token: String, response: InteractionResponse) async throws {
264266
try await withCheckedThrowingContinuation { continuation in
265-
client.createInteractionResponse(for: interactionId.usingDiscordAPI, token: token, response: response.usingDiscordAPI) { response in
267+
client.createInteractionResponse(for: interactionId.usingDiscordAPI, token: token, response: response.usingDiscordAPI) { (data, response) in
268+
// TODO: Return data in error
266269
continuation.resume(with: Result { try check(response: response, "creating interaction response") })
267270
}
268271
}

Diff for: Sources/D2Handlers/D2Receiver.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ public class D2Receiver: Receiver {
624624
try await sink.createInteractionResponse(
625625
for: interaction.id,
626626
token: token,
627-
response: .init(type: .acknowledge)
627+
response: .init(type: .deferredUpdateMessage)
628628
)
629629
}
630630
} catch {

Diff for: Sources/D2MessageIO/Structures/InteractionResponse.swift

+2-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ public struct InteractionResponse {
99

1010
public enum ResponseType {
1111
case pong
12-
case acknowledge
13-
case channelMessage
1412
case channelMessageWithSource
15-
case ackWithSource
13+
case deferredChannelMessageWithSource
14+
case deferredUpdateMessage
1615
}
1716
}

0 commit comments

Comments
 (0)