diff --git a/src/client.nim b/src/client.nim index bf64c9f..9c8d169 100644 --- a/src/client.nim +++ b/src/client.nim @@ -109,7 +109,6 @@ proc updateClientPresence*(client: DiscordClient, presence: Presence) {.async.} "d": presence.presenceToJson() } - echo "payload:", jsonPayload await client.sendGatewayRequest(jsonPayload) proc newDiscordClient(tkn: string): DiscordClient = @@ -121,8 +120,7 @@ proc newDiscordClient(tkn: string): DiscordClient = var cac: Cache new(cac) - result = DiscordClient(token: tkn, cache: cac) - globalDiscordClient = result + result = DiscordClient(token: tkn, cache: cac, reconnecting: false) var tokenStream = newFileStream("token.txt", fmRead) var tkn: string @@ -136,7 +134,6 @@ var bot = newDiscordClient(tkn) registerEventListener(EventType.evtReady, proc(bEvt: BaseEvent) = let event = ReadyEvent(bEvt) - bot.clientUser = event.clientUser echo "Ready! (v", nimcordMajor, ".", nimcordMinor, ".", nimcordMicro, ")" echo "Logged in as: ", bot.clientUser.username, "#", bot.clientUser.discriminator diff --git a/src/clientobjects.nim b/src/clientobjects.nim index 2a1808c..0549fd0 100644 --- a/src/clientobjects.nim +++ b/src/clientobjects.nim @@ -9,5 +9,6 @@ type DiscordClient* = ref object heartbeatInterval*: int heartbeatAcked*: bool lastSequence*: int - -var globalDiscordClient*: DiscordClient ## Global instance of the DiscordClient. \ No newline at end of file + endpoint*: string + reconnecting*: bool + sessionID*: string \ No newline at end of file diff --git a/src/eventhandler.nim b/src/eventhandler.nim index c331ac2..e2ba432 100644 --- a/src/eventhandler.nim +++ b/src/eventhandler.nim @@ -51,7 +51,6 @@ type ## The ready event is triggered everytime the bot starts up. ## Stores the readyPayload (JSON Payload) that gets received and the bot's user. readyPayload*: JsonNode - clientUser*: User # Channel Events