We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d7cbc60 commit 985f864Copy full SHA for 985f864
NotifierBot/Sources/Notifier/main.swift
@@ -51,13 +51,16 @@ let bot: Bot!
51
52
do {
53
54
- if let t = try? String(contentsOfFile: "BOT_TOKEN") {
+ if let t = try? String(contentsOfFile: "BOT_TOKEN").components(separatedBy: .newlines).first {
55
// Read the token from a the file
56
+ print("Reading token from file.")
57
token = t
58
} else if let t = Enviroment.get("TELEGRAM_BOT_TOKEN") {
59
// Read the token from the environment, if it exists
60
+ print("Reading token from environment.")
61
62
} else {
63
+ print("Error: Unable to read token.")
64
exit(1)
65
}
66
bot = try Bot(token: token)
0 commit comments