Skip to content

Commit e330735

Browse files
patch(guild/members): handle invalidate op
1 parent 364c34f commit e330735

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Sources/DiscordKitCore/Objects/Gateway/Event/GuildMemberEvt.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,14 @@ public struct GuildMemberListUpdate: Decodable, GatewayData {
5050
case sync = "SYNC"
5151
case delete = "DELETE"
5252
case insert = "INSERT"
53+
case invalidate = "INVALIDATE"
5354
}
5455

5556
case update(Data, index: Int)
5657
case insert(Data, index: Int)
5758
case delete(Int)
5859
case sync([Data], range: DiscordRange)
60+
case invalidate(DiscordRange)
5961

6062
enum CodingKeys: CodingKey {
6163
case index
@@ -77,6 +79,8 @@ public struct GuildMemberListUpdate: Decodable, GatewayData {
7779
self = .insert(try container.decode(Data.self, forKey: .item), index: try container.decode(Int.self, forKey: .index))
7880
case .delete:
7981
self = .delete(try container.decode(Int.self, forKey: .index))
82+
case .invalidate:
83+
self = .invalidate(try container.decode(DiscordRange.self, forKey: .range))
8084
}
8185
}
8286
}

Sources/DiscordKitCore/Utils/DiscordRange.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77

88
import Foundation
99

10-
public struct DiscordRange: Codable {
10+
public struct DiscordRange: Codable, CustomStringConvertible, CustomDebugStringConvertible {
11+
public var description: String {
12+
closedRange.description
13+
}
14+
public var debugDescription: String {
15+
closedRange.debugDescription
16+
}
17+
1118
public let start: Int
1219
public let end: Int
1320

0 commit comments

Comments
 (0)