Skip to content

Commit dbdf8f2

Browse files
Updated screenshot tool path
Fixed some more markdown character escaping
1 parent de65d97 commit dbdf8f2

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

NotifierBot/Sources/Notifier/Commands/FetchURLCommand.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@ struct FetchURLCommand: Command {
4040
try bot.sendMessage("Please enter a valid URL, starting with 'http://' or 'https://'", to: chatID)
4141
return
4242
}
43-
DispatchQueue.main.async {
44-
JFUtils.takeScreenshot(url: url, filename: "/tmp/screenshot.png", area: area)
45-
JFUtils.sendFile(path: "/tmp/screenshot.png", chatID: chatID)
46-
}
43+
JFUtils.takeScreenshot(url: url, filename: "/tmp/screenshot.png", area: area)
44+
JFUtils.sendFile(path: "/tmp/screenshot.png", chatID: chatID)
4745
}
4846
}

NotifierBot/Sources/Notifier/Commands/ListAllCommand.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ struct ListAllCommand: Command {
2828
let groups = Array(Set(entries.map({ $0.chatID })))
2929
var list = "*Monitored Websites:*\n"
3030
for chatID in groups {
31-
list += "*\(chatID):*\n"
31+
// Escape the chat ID because it could have a minus sign in front of it
32+
list += "*\(String(chatID).escaped()):*\n"
3233
for entry in entries.filter({ $0.chatID == chatID }) {
3334
// For each entry in this group
3435
list += "- \(entry.name): \(entry.url)".escaped()

NotifierBot/Sources/Notifier/JFUtils.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct JFUtils {
3232
}
3333

3434
static func takeScreenshot(url: String, filename: String, area: Rectangle = .zero) {
35-
shell("\(kPythonPath) \(kScreenshotScript) \(filename) \"\(url)\"")
35+
shell("\(kScreenshotScript) \(filename) \"\(url)\"")
3636
if area.width != 0 && area.height != 0 {
3737
// Crop the screenshot
3838
shell("\(kConvertPath) \(filename) -crop \(area.width)x\(area.height)+\(area.x)+\(area.y) \(filename)")

NotifierBot/Sources/Notifier/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ let kURLListFile = "\(mainDirectory!)/urlwatcher/urls.list"
2424
// The url_watcher.sh script that actually performs the monitoring
2525
let kUrlwatchTool = "\(mainDirectory!)/urlwatcher/urlwatcher.sh"
2626
// The python screenshot script that takes the screenshot
27-
let kScreenshotScript = "\(mainDirectory!)/tools/screenshot.py"
27+
let kScreenshotScript = "\(mainDirectory!)/tools/screenshot.sh"
2828
// The telegram.sh script from here: https://github.com/fabianonline/telegram.sh
2929
let kTelegramScript = "\(mainDirectory!)/tools/telegram.sh"
3030

0 commit comments

Comments
 (0)