Skip to content

Commit 05ef6a1

Browse files
Fixed fetch command by removing DispatchQueue call
1 parent dc88f49 commit 05ef6a1

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

NotifierBot/Sources/Notifier/Commands/Command.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ extension Command {
4545
throw JFBotError.noPermissions(self)
4646
}
4747
// Run the command
48+
print("Executing command for '\(update.message?.text ?? "nil")'")
4849
try self.run(update: update, context: context)
4950
} catch let error as JFBotError {
5051
JFErrorHandler.shared.handle(error, update: update)

NotifierBot/Sources/Notifier/Commands/FetchCommand.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,10 @@ struct FetchCommand: Command {
3131
try bot.sendMessage("There is no entry with the name '\(name)'", to: chatID)
3232
return
3333
}
34-
DispatchQueue.main.async {
35-
// Take the screenshot
36-
JFUtils.takeScreenshot(url: entry!.url, filename: "/tmp/screenshot.png", area: entry!.area)
37-
// Send the screenshot as file
38-
// Use the script, because its easier than sending the file in swift
39-
JFUtils.sendFile(path: "/tmp/screenshot.png", chatID: chatID)
40-
}
34+
// Take the screenshot
35+
JFUtils.takeScreenshot(url: entry!.url, filename: "/tmp/screenshot.png", area: entry!.area)
36+
// Send the screenshot as file
37+
// Use the script, because its easier than sending the file in swift
38+
JFUtils.sendFile(path: "/tmp/screenshot.png", chatID: chatID)
4139
}
4240
}

0 commit comments

Comments
 (0)