Save
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
import httpx
|
import httpx
|
||||||
import logging
|
import logging
|
||||||
from typing import Dict, Any, Optional
|
from typing import Dict, Any, Optional
|
||||||
from config import WEBHOOK_URL
|
from config import GetWebhookURL
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ class MessageSender:
|
|||||||
webhook_url: Webhook URL
|
webhook_url: Webhook URL
|
||||||
"""
|
"""
|
||||||
if webhook_url is None:
|
if webhook_url is None:
|
||||||
webhook_url = WEBHOOK_URL
|
webhook_url = GetWebhookURL()
|
||||||
self.webhook_url = webhook_url
|
self.webhook_url = webhook_url
|
||||||
self.client: Optional[httpx.AsyncClient] = None
|
self.client: Optional[httpx.AsyncClient] = None
|
||||||
|
|
||||||
@@ -130,5 +130,8 @@ def get_message_sender() -> MessageSender:
|
|||||||
global _sender_instance
|
global _sender_instance
|
||||||
if _sender_instance is None:
|
if _sender_instance is None:
|
||||||
_sender_instance = MessageSender()
|
_sender_instance = MessageSender()
|
||||||
|
else:
|
||||||
|
# 更新Webhook URL以确保使用最新的值
|
||||||
|
_sender_instance.webhook_url = GetWebhookURL()
|
||||||
return _sender_instance
|
return _sender_instance
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user