Implement slashcommands for discord api

This commit is contained in:
clienthax 2021-08-15 14:44:50 +01:00
parent 5bd99aa8c3
commit 1d0a8b7088
19 changed files with 1239 additions and 0 deletions

View file

@ -48,6 +48,10 @@ with open(os.path.join(REPO_FOLDER, "resources/patchport-state.json")) as f:
VERSION = STATE["versioncode"]
BASE_APK_PATH = os.path.join(WORK_FOLDER, f"discord-base-{VERSION}")
BASE_JAR_PATH = os.path.join(WORK_FOLDER, f"discord-base-jar")
# Wipe and recreate the base jar folder
if os.path.exists(BASE_JAR_PATH):
shutil.rmtree(BASE_JAR_PATH)
# Prepare names of input and output APKs
INPUT_FILE = os.path.join(DISTOK_FOLDER, "android",
@ -79,6 +83,13 @@ if not os.path.exists(BASE_APK_PATH):
shell=True,
cwd=WORK_FOLDER)
# Convert the dexs to a jar (for slashcommands etc) TODO versionise gradle/this
if not os.path.exists(BASE_JAR_PATH):
subprocess.run(f"unzip -j {INPUT_FILE} *.dex -d {BASE_JAR_PATH}", shell=True, cwd=WORK_FOLDER)
subprocess.run(f"{DEX2JAR_BIN} *.dex", shell=True, cwd=BASE_JAR_PATH)
subprocess.run(f"zipmerge discord-base.jar classes*dex2jar.jar", shell=True, cwd=BASE_JAR_PATH)
subprocess.run(f"rm classes*dex2jar.jar *.dex", shell=True, cwd=BASE_JAR_PATH)
# Copy the base cache to work on it
shutil.copytree(BASE_APK_PATH, WORK_APK_PATH)