Skip to content

Commit

Permalink
fix another typo
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Keller committed Mar 2, 2017
1 parent b3aa40f commit 4ad25c3
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions Sources/main.swift
Expand Up @@ -102,10 +102,7 @@ extension ChatRoom {
}

case .manuallyReported:
if shouldNotify == true {
shouldNotify = true
}

break
}
}

Expand Down Expand Up @@ -252,11 +249,18 @@ func main() throws {

//Post the startup message
let startupMessage: String?
let startupMessageCompletion: ((Int) -> Void)?

currentVersion = getCurrentVersion()
if FileManager.default.fileExists(atPath: "update-failure") {
startupMessage = "Update failed!"
try! FileManager.default.removeItem(atPath: "update-failure")
startupMessageCompletion = {_ in
do {
try FileManager.default.removeItem(atPath: "update-failure")
} catch {
handleError(error, "while clearing the update status")
}
}
}
else if let new = try? loadFile("version-new.txt").replacingOccurrences(of: "\n", with: "") {
let components = new.components(separatedBy: " ")
Expand All @@ -273,18 +277,25 @@ func main() throws {
startupMessage = "Updated from [`\(oldShort)`](\(oldLink)) to [`\(newShort)`](\(newLink))\(message)."
try! new.write(toFile: "version.txt", atomically: true, encoding: .utf8)
currentVersion = new
try! FileManager.default.removeItem(atPath: "version-new.txt")
startupMessageCompletion = {_ in
do {
try FileManager.default.removeItem(atPath: "version-new.txt")
} catch {
handleError(error, "while clearing the update status")
}
}
}
else {
startupMessage = nil
startupMessageCompletion = nil
let short = getShortVersion(currentVersion)
let link = getVersionLink(currentVersion)

rooms.first?.postMessage("[ [\(botName)](\(stackAppsLink)) ] FireAlarm started at revision [`\(short)`](\(link)) on \(location).")
}

if let message = startupMessage {
rooms.forEach { $0.postMessage(message) }
rooms.forEach { $0.postMessage(message, completion: startupMessageCompletion) }
}

shortVersion = getShortVersion(currentVersion)
Expand Down Expand Up @@ -326,10 +337,10 @@ func main() throws {
var updated = false
while !updated {
//wait one minute
/*sleep(60)
sleep(60)
if !updated && !development {
updated = update(listener, rooms, auto: true)
}*/
}
save()
}
}
Expand Down

0 comments on commit 4ad25c3

Please sign in to comment.