Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

更新 Server 酱的通知渠道,使其适配最新的 Server 酱³ 的通知渠道 #569

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion libs/funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import random
import time
import traceback
import re

import aiohttp
import croniter
Expand Down Expand Up @@ -134,7 +135,14 @@ async def send2s(self, skey: str, title: str, content: str):
r = 'False'
if skey != "":
try:
link = f"https://sctapi.ftqq.com/{skey.replace('.send', '')}.send"
match = re.match(r'^sctp(\d+)t', skey)

if match:
sc3uid = match.group(1)
link = f"https://{sc3uid}.push.ft07.com/send/{skey.replace('.send', '')}.send?tags=QD"
else:
link = f"https://sctapi.ftqq.com/{skey.replace('.send', '')}.send"

content = content.replace('\\r\\n', '\n\n')
d = {'text': title, 'desp': content}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新版Body也是这些字段么

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我在本地修改测试后是能够正常发送通知的,消息主体与Server Chan Turbo并没有太多区别,主要是更换了消息推送的渠道和新增了TAG功能。

async with aiohttp.ClientSession(conn_timeout=config.connect_timeout) as session:
Expand All @@ -147,6 +155,7 @@ async def send2s(self, skey: str, title: str, content: str):
return e
return r


async def send2tg(self, tg_token, title, content):
r = 'False'
tmp = tg_token.split(';')
Expand Down