From ec8e41fa8417f424d88694856c59e528d4840a20 Mon Sep 17 00:00:00 2001 From: SeanOMik Date: Sun, 31 May 2020 01:14:56 -0500 Subject: [PATCH] Fix exception when trying to read from token file. --- src/client.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/client.nim b/src/client.nim index 368bc77..fb4eaf9 100644 --- a/src/client.nim +++ b/src/client.nim @@ -100,10 +100,12 @@ proc startConnection*(client: DiscordClient) {.async.} = e.msg = "Failed to get gateway url, token may of been incorrect!" raise e -var tokenStream = newFileStream("../token.txt", fmWrite) +var tokenStream = newFileStream("token.txt", fmRead) var tkn: string if (not isNil(tokenStream)): discard tokenStream.readLine(tkn) + echo "Read token from the file: ", tkn + tokenStream.close() var bot = DiscordClient(token: tkn)