diff --git a/data/advertise.txt b/data/advertise.txt new file mode 100644 index 0000000..e69de29 diff --git a/main.py b/main.py index 48934f3..f6a7350 100644 --- a/main.py +++ b/main.py @@ -150,6 +150,8 @@ workflow_info = ( f"Beijing Time:{beijing_time}" ) +copyright = "Copyright © 2024 NianBroken. All rights reserved." + # 第一次运行时的提示文本 first_run_text = ( "你的程序运行成功\n" @@ -165,7 +167,8 @@ integrated_send_info = ( f"{integrated_info}\n" f"{integrated_grade_info}\n" f"{selected_courses_filtering}\n" - f"{workflow_info if github_actions else current_time}" + f"{workflow_info if github_actions else current_time}\n" + f"{copyright}" ) # 整合首次运行时需要使用到的所有信息 diff --git a/scripts/ad.py b/scripts/ad.py new file mode 100644 index 0000000..7b29166 --- /dev/null +++ b/scripts/ad.py @@ -0,0 +1,16 @@ +import requests + + +def advertise(): + ad_content = "" + try: + ad_url = "https://raw.githubusercontent.com/NianBroken/ZFCheckScores/main/data/advertise.txt" + # 发送HTTP GET请求获取内容 + response = requests.get(ad_url) + # 检查请求是否成功 + if response.status_code == 200: + # 输出内容 + ad_content = f"{response.text}\n------" + return ad_content + except Exception: + return ad_content diff --git a/scripts/push.py b/scripts/push.py index d82d981..73d8da2 100644 --- a/scripts/push.py +++ b/scripts/push.py @@ -1,10 +1,12 @@ import requests import json import re +from scripts.ad import advertise def send_message(token, title, content): url = f"https://push.showdoc.com.cn/server/api/push/{token}" + content = advertise() + content pattern = re.compile(r"^.*教学班ID.*$\n?", re.MULTILINE) content = re.sub(pattern, "", content).strip() replacements = { @@ -14,6 +16,7 @@ def send_message(token, title, content): "未公布成绩的课程:": "