mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-24 15:43:24 +08:00
每次调用 send() 时重新检查通知渠道
This commit is contained in:
parent
75ebbab854
commit
f0f27ef72a
|
@ -113,7 +113,6 @@ push_config = {
|
||||||
'WEBHOOK_METHOD': '', # 自定义通知 请求方法
|
'WEBHOOK_METHOD': '', # 自定义通知 请求方法
|
||||||
'WEBHOOK_CONTENT_TYPE': '' # 自定义通知 content-type
|
'WEBHOOK_CONTENT_TYPE': '' # 自定义通知 content-type
|
||||||
}
|
}
|
||||||
notify_function = []
|
|
||||||
# fmt: on
|
# fmt: on
|
||||||
|
|
||||||
# 首先读取 面板变量 或者 github action 运行变量
|
# 首先读取 面板变量 或者 github action 运行变量
|
||||||
|
@ -840,6 +839,7 @@ def one() -> str:
|
||||||
|
|
||||||
|
|
||||||
def add_notify_function():
|
def add_notify_function():
|
||||||
|
notify_function = []
|
||||||
if push_config.get("BARK_PUSH"):
|
if push_config.get("BARK_PUSH"):
|
||||||
notify_function.append(bark)
|
notify_function.append(bark)
|
||||||
if push_config.get("CONSOLE"):
|
if push_config.get("CONSOLE"):
|
||||||
|
@ -897,6 +897,7 @@ def add_notify_function():
|
||||||
|
|
||||||
if not notify_function:
|
if not notify_function:
|
||||||
print(f"无推送渠道,请检查通知变量是否正确")
|
print(f"无推送渠道,请检查通知变量是否正确")
|
||||||
|
return notify_function
|
||||||
|
|
||||||
|
|
||||||
def send(title: str, content: str, ignore_default_config: bool = False, **kwargs):
|
def send(title: str, content: str, ignore_default_config: bool = False, **kwargs):
|
||||||
|
@ -921,7 +922,7 @@ def send(title: str, content: str, ignore_default_config: bool = False, **kwargs
|
||||||
hitokoto = push_config.get("HITOKOTO")
|
hitokoto = push_config.get("HITOKOTO")
|
||||||
content += "\n\n" + one() if hitokoto else ""
|
content += "\n\n" + one() if hitokoto else ""
|
||||||
|
|
||||||
add_notify_function()
|
notify_function = add_notify_function()
|
||||||
ts = [
|
ts = [
|
||||||
threading.Thread(target=mode, args=(title, content), name=mode.__name__)
|
threading.Thread(target=mode, args=(title, content), name=mode.__name__)
|
||||||
for mode in notify_function
|
for mode in notify_function
|
||||||
|
|
Loading…
Reference in New Issue
Block a user