Skip to content

Commit 3504017

Browse files
Fixed global variable declaration
1 parent 5f56b91 commit 3504017

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

urlwatcher/Sources/urlwatcher/Functions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func cropScreenshot(path: String, output: String? = nil, x: Int, y: Int, width:
6565

6666
func sendTelegramMessage(_ message: String, to chatID: Int, image: String? = nil, file: String? = nil) throws {
6767
var arguments: [String] = [
68-
"-t", telegramBotToken,
68+
"-t", telegramBotToken!,
6969
"-c", "\(chatID)"
7070
]
7171
if let image = image {

urlwatcher/Sources/urlwatcher/main.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ let fileManager = FileManager.default
88
/// The directory, the executable is in
99
let currentPath = Bundle.main.bundlePath
1010
/// The telegram bot token is read from a file
11-
guard let telegramBotToken = try String(contentsOfFile: "\(currentPath)/../BOT_TOKEN", encoding: .utf8).components(separatedBy: .newlines).first else {
11+
let telegramBotToken = try String(contentsOfFile: "\(currentPath)/../BOT_TOKEN", encoding: .utf8).components(separatedBy: .newlines).first
12+
guard telegramBotToken != nil else {
1213
print("Unable to read bot token. Please place it into the file \(currentPath.components(separatedBy: "/").dropLast().joined(separator: "/"))/BOT_TOKEN")
1314
exit(1)
1415
}

0 commit comments

Comments
 (0)