feat: Resume after disconnect
This commit is contained in:
@@ -6,20 +6,18 @@ import FoundationNetworking
|
||||
public actor Bot {
|
||||
public let client: DiscordClient
|
||||
let gateway: GatewayClient
|
||||
let intents: Intents
|
||||
|
||||
public init(token: String, intents: Intents) async throws {
|
||||
client = DiscordClient(token: token)
|
||||
self.intents = intents
|
||||
let gatewayURL = try await client.getGatewayURL()
|
||||
gateway = GatewayClient(gatewayURL: gatewayURL, token: token)
|
||||
gateway = GatewayClient(gatewayURL: gatewayURL, token: token, intents: intents)
|
||||
}
|
||||
|
||||
public func connect() async throws {
|
||||
try await gateway.openConnection(intents: intents)
|
||||
try await gateway.openConnection()
|
||||
}
|
||||
|
||||
public var events: AsyncStream<GatewayMessage> {
|
||||
public var events: AsyncStream<GatewayPayload> {
|
||||
get async { await gateway.events }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user