refactor(config): 重构通知配置项并优化Webhook获取逻辑

This commit is contained in:
2025-09-27 16:32:54 +08:00
parent d2066e9631
commit 2d6dae3fc9
4 changed files with 27 additions and 22 deletions

View File

@@ -1907,7 +1907,10 @@ class MaaManager:
)
# 发送自定义Webhook通知
custom_webhooks = Config.get("Notify", "CustomWebhooks", [])
try:
custom_webhooks = Config.get("Notify", "CustomWebhooks")
except AttributeError:
custom_webhooks = []
if custom_webhooks:
for webhook in custom_webhooks:
if webhook.get("enabled", True):
@@ -1970,7 +1973,10 @@ class MaaManager:
)
# 发送自定义Webhook通知
custom_webhooks = Config.get("Notify", "CustomWebhooks", [])
try:
custom_webhooks = Config.get("Notify", "CustomWebhooks")
except AttributeError:
custom_webhooks = []
if custom_webhooks:
for webhook in custom_webhooks:
if webhook.get("enabled", True):
@@ -2055,7 +2061,10 @@ class MaaManager:
)
# 发送自定义Webhook通知六星喜报
custom_webhooks = Config.get("Notify", "CustomWebhooks", [])
try:
custom_webhooks = Config.get("Notify", "CustomWebhooks")
except AttributeError:
custom_webhooks = []
if custom_webhooks:
for webhook in custom_webhooks:
if webhook.get("enabled", True):

View File

@@ -983,7 +983,10 @@ class GeneralManager:
)
# 发送自定义Webhook通知
custom_webhooks = Config.get("Notify", "CustomWebhooks", [])
try:
custom_webhooks = Config.get("Notify", "CustomWebhooks")
except AttributeError:
custom_webhooks = []
if custom_webhooks:
for webhook in custom_webhooks:
if webhook.get("enabled", True):
@@ -1027,7 +1030,10 @@ class GeneralManager:
)
# 发送自定义Webhook通知
custom_webhooks = Config.get("Notify", "CustomWebhooks", [])
try:
custom_webhooks = Config.get("Notify", "CustomWebhooks")
except AttributeError:
custom_webhooks = []
if custom_webhooks:
for webhook in custom_webhooks:
if webhook.get("enabled", True):