File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
urlwatcher/Sources/urlwatcher Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,10 @@ let fileManager = FileManager.default
88/// The directory, the executable is in
99let currentPath = Bundle . main. bundlePath
1010/// The telegram bot token is read from a file
11- let telegramBotToken = try String ( contentsOfFile: " \( currentPath) /../BOT_TOKEN " , encoding: . utf8)
11+ guard let telegramBotToken = try String ( contentsOfFile: " \( currentPath) /../BOT_TOKEN " , encoding: . utf8) . components ( separatedBy: . newlines) . first else {
12+ print ( " Unable to read bot token. Please place it into the file \( currentPath. components ( separatedBy: " / " ) . dropLast ( ) . joined ( separator: " / " ) ) /BOT_TOKEN " )
13+ exit ( 1 )
14+ }
1215/// The script used to send the telegram messages
1316let telegramScript = " \( currentPath) /../tools/telegram.sh "
1417
You can’t perform that action at this time.
0 commit comments