ci: fix release scripts

This commit is contained in:
Luv Letter 2023-03-16 07:39:52 +08:00 committed by luvletter2333
parent 4933c7107b
commit e392d0db9b
No known key found for this signature in database
GPG Key ID: 9EB7723F3A0ACF92
1 changed files with 19 additions and 18 deletions

View File

@ -64,6 +64,8 @@ def sendMessage(message, user_id = BOT_TARGET, entities = None) -> int:
"text": message, "text": message,
"entities": entities "entities": entities
} }
print(message)
print(entities)
resp = requests.post(API_PREFIX + "sendMessage", json=data).json() resp = requests.post(API_PREFIX + "sendMessage", json=data).json()
print(resp) print(resp)
return int(resp["result"]["message_id"]) return int(resp["result"]["message_id"])
@ -105,6 +107,8 @@ def sendRelease():
text += " " text += " "
text += addEntity(entities, text, "bold", VERSION_NAME) text += addEntity(entities, text, "bold", VERSION_NAME)
text += "\n\n" text += "\n\n"
if "entities" not in admin_resp:
admin_resp["entities"] = list()
resp_entities = admin_resp["entities"] resp_entities = admin_resp["entities"]
for en in resp_entities: for en in resp_entities:
copy = en.copy() copy = en.copy()
@ -140,24 +144,21 @@ if __name__ == '__main__':
print(sys.argv) print(sys.argv)
if len(sys.argv) != 2: if len(sys.argv) != 2:
print("Run Type: release, ci, debug") print("Run Type: release, ci, debug")
sys.stdout.flush()
sys.stderr.flush()
exit(1) exit(1)
mode = sys.argv[1] mode = sys.argv[1]
try: if mode == "release":
if mode == "release": sendRelease()
sendRelease() elif mode == "ci":
elif mode == "ci": if COMMIT_MESSAGE.startswith("ci"):
if COMMIT_MESSAGE.startswith("ci"): CI_CHANNEL_ID = BOT_TARGET
CI_CHANNEL_ID = BOT_TARGET sendCIRelease()
sendCIRelease() elif mode == "debug":
elif mode == "debug": APK_CHANNEL_ID = "@test_channel_nekox"
APK_CHANNEL_ID = "@test_channel_nekox" UPDATE_CHANNEL_ID = "@test_channel_nekox"
UPDATE_CHANNEL_ID = "@test_channel_nekox" UPDATE_METADATA_CHANNEL_ID = "@test_channel_nekox"
UPDATE_METADATA_CHANNEL_ID = "@test_channel_nekox" sendRelease()
sendRelease() else:
else: print("unknown mode")
print("unknown mode")
exit(1)
except Exception as e:
print(e)
exit(1)