Optimized code
This commit is contained in:
+3
-3
@@ -1,12 +1,13 @@
|
||||
import requests
|
||||
import json
|
||||
import re
|
||||
from scripts.ad import advertise
|
||||
from scripts.ad import get_advertise
|
||||
|
||||
|
||||
def send_message(token, title, content):
|
||||
url = f"https://push.showdoc.com.cn/server/api/push/{token}"
|
||||
content = advertise() + content
|
||||
advertise = get_advertise()
|
||||
content = f"{advertise}{content}" if advertise else content
|
||||
pattern = re.compile(r"^.*教学班ID.*$\n?", re.MULTILINE)
|
||||
content = re.sub(pattern, "", content).strip()
|
||||
replacements = {
|
||||
@@ -14,7 +15,6 @@ def send_message(token, title, content):
|
||||
"个人信息:": "<h1>个人信息</h1>\n",
|
||||
"成绩信息:": "<h1>成绩信息</h1>\n",
|
||||
"未公布成绩的课程:": "<h1>未公布成绩的课程</h1>\n",
|
||||
"异常的课程:": "<h1>异常的课程</h1>\n",
|
||||
"工作流信息:": "<h1>工作流信息</h1>\n",
|
||||
"Copyright © 2024 NianBroken. All rights reserved.": "Copyright © 2024 <a href='https://www.nianbroken.top/' target='_blank'>NianBroken</a>. All rights reserved.",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user